{"id":32143262,"url":"https://github.com/yshrkt/elapse","last_synced_at":"2025-10-21T07:55:40.272Z","repository":{"id":50985503,"uuid":"93121307","full_name":"yshrkt/Elapse","owner":"yshrkt","description":"Elapse is tiny helper library for manipulating TimeInterval.","archived":false,"fork":false,"pushed_at":"2021-05-26T11:03:29.000Z","size":18,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-05T02:53:26.057Z","etag":null,"topics":["swift","timeinterval"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yshrkt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-02T03:02:40.000Z","updated_at":"2025-08-20T07:31:25.000Z","dependencies_parsed_at":"2022-09-11T20:31:08.808Z","dependency_job_id":null,"html_url":"https://github.com/yshrkt/Elapse","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/yshrkt/Elapse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yshrkt%2FElapse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yshrkt%2FElapse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yshrkt%2FElapse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yshrkt%2FElapse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yshrkt","download_url":"https://codeload.github.com/yshrkt/Elapse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yshrkt%2FElapse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280225807,"owners_count":26293888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["swift","timeinterval"],"created_at":"2025-10-21T07:55:39.317Z","updated_at":"2025-10-21T07:55:40.260Z","avatar_url":"https://github.com/yshrkt.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elapse\n![Xcode](https://img.shields.io/badge/Xcode-10-brightgreen.svg)\n![Swift](https://img.shields.io/badge/Swift-4.2-brightgreen.svg)\n![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS-333333.svg)\n![Travis CI](https://travis-ci.org/yshrkt/Elapse.svg?branch=master)\n\nElapse is tiny helper library for manipulating TimeInterval.\n\n## Usage\n\n### Calcurate TimeInterval easily.\n\n```swift\nlet days: TimeInterval = 3.days // 3 * 24 * 60 * 60\nlet hours: TimeInterval = 3.hours // 3 * 60 * 60\nlet minutes: TimeInterval = 3.minutes // 3 * 60\nlet seconds: TimeInterval = 3.seconds // 3.0\nlet mills: TimeInterval =  3.milliseconds // 0.003\n\nlet time: TimeInterval = 3.days + 3.hours + 3.minutes\n\n```\n\n### Separates TimeInterval to each components easily.\n```swift\n\nlet input: TimeInterval = 30.minutes + 30.seconds\n\nlet output1 = input.components(of: [.minutes, .seconds])\nprint(\"\\(output1.minutes):\\(output1.seconds)\") // \"3:30\"\n\nlet output2 = input.components(of: [.minutes])\nprint(\"\\(output2.minutes)min\") // \"30min\"\n\n// You can also set the rounding mode. the default value is .floor\nlet output3 = input.components(of: [.minutes], roundingMode: .ceiling)\nprint(\"\\(output3.minutes)min\") // \"31min\"\n\nlet output4 = input.components(of: [.minutes], roundingMode: .halfAwayFromZero)\nprint(\"\\(output4.minutes)min\") // \"31min\"\n\nlet output5 = (input - 1.seconds).components(of: [.minutes], roundingMode: .halfAwayFromZero)\nprint(\"\\(output5.minutes)min\") // \"30min\"\n\nlet output6 = input.components(of: [.hour], roundingMode: .halfAwayFromZero)\nprint(\"\\(output6.hours)hour\") // \"1hour\"\n```\n\n## Requirements\n\n* Xcode 10\n* Swift 4.2\n\n## Installation\n\n### Carthage\n\nTo install it, simply add the following line to your `Cartfile`:\n\n```\ngithub \"yshrkt/Elapse\"\n```\n\n### CocoaPods\n\nTo install it, simply add the following line to your `Podfile`:\n\n```\npod \"Elapse\"\n```\n\n### Swift Package Manager\n\nTo install it, simply add the proper description to your `Package.swift`:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    targets: [],\n    dependencies: [\n        .Package(url: \"https://github.com/yshrkt/Elapse.git\"),\n    ]\n)\n```\n\n## Licence\n\nElapse is released under the MIT license. [See LICENSE](https://github.com/yshrkt/Elapse/blob/master/LICENSE) for details.\n\n## Author\n\n[yshrkt](https://github.com/yshrkt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyshrkt%2Felapse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyshrkt%2Felapse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyshrkt%2Felapse/lists"}