{"id":18727704,"url":"https://github.com/mobilenativefoundation/kronos","last_synced_at":"2025-04-09T04:04:24.504Z","repository":{"id":45420790,"uuid":"59043521","full_name":"MobileNativeFoundation/Kronos","owner":"MobileNativeFoundation","description":"Elegant NTP date library in Swift","archived":false,"fork":false,"pushed_at":"2024-07-30T17:58:17.000Z","size":180,"stargazers_count":650,"open_issues_count":17,"forks_count":88,"subscribers_count":25,"default_branch":"main","last_synced_at":"2024-08-04T00:06:44.479Z","etag":null,"topics":["lyft"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MobileNativeFoundation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-17T17:19:45.000Z","updated_at":"2024-08-13T14:29:09.135Z","dependencies_parsed_at":"2022-11-29T13:20:17.646Z","dependency_job_id":"8f72d9ad-04c7-452b-b32d-4a55393d9a35","html_url":"https://github.com/MobileNativeFoundation/Kronos","commit_stats":{"total_commits":132,"total_committers":26,"mean_commits":5.076923076923077,"dds":0.5151515151515151,"last_synced_commit":"f331821314f9b35867a18c5c8fc2f918536d79ac"},"previous_names":["lyft/kronos"],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MobileNativeFoundation%2FKronos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MobileNativeFoundation%2FKronos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MobileNativeFoundation%2FKronos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MobileNativeFoundation%2FKronos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MobileNativeFoundation","download_url":"https://codeload.github.com/MobileNativeFoundation/Kronos/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974715,"owners_count":21026742,"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","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":["lyft"],"created_at":"2024-11-07T14:18:31.698Z","updated_at":"2025-04-09T04:04:24.479Z","avatar_url":"https://github.com/MobileNativeFoundation.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://cloud.githubusercontent.com/assets/232113/15371638/505de80a-1cf1-11e6-9e16-d462e02d9e45.png\" height=\"140\" /\u003e\n\nKronos is an NTP client library written in Swift. It supports\nsub-seconds precision and provides a stable monotonic clock that won't\nbe affected by changes in the clock.\n\n## Example app\n\n[This](https://github.com/MobileNativeFoundation/Kronos/blob/master/Example/main.swift) is an\nexample app that displays the monotonic `Clock.now` on the left and the\nsystem clock (initially out of date) on the right.\n\n![ascii-clock](https://cloud.githubusercontent.com/assets/232113/15371331/c24e8570-1cef-11e6-8598-428a0b5d66f9.gif)\n\n## Usage\n\n### Sync clock using a pool of NTP servers\n\nCalling `Clock.sync` will fire a bunch of NTP requests to up to 5 of the\nservers on the given NTP pool (default is `time.apple.com`). As soon as\nwe get the first response, the given closure is called but the `Clock`\nwill keep trying to get a more accurate response.\n\n```swift\nClock.sync { date, offset in\n    // This is the first sync (note that this is the fastest but not the\n    // most accurate run\n    print(date)\n}\n```\n\n### Get an NTP sync'ed date\n\n`Clock.now` is a monotonic NSDate that won't be affected by clock\nchanges.\n\n```swift\nNSTimer.scheduledTimerWithTimeInterval(1.0, target: self,\n                                       selector: #selector(Example.tick),\n                                       userInfo: nil, repeats: true)\n\n@objc func tick() {\n    print(Clock.now) // Note that this clock will get more accurate as\n                     // more NTP servers respond.\n}\n```\n\n## Installation\n\n### [CocoaPods](http://cocoapods.org)\n\nAdd Kronos to your `Podfile`:\n\n```ruby\npod 'Kronos'\n```\n\n### Swift Package Manager\n\nAdd Kronos to your `Pacakge.swift`:\n\n```bash\n.package(name: \"Kronos\", url: \"https://github.com/MobileNativeFoundation/Kronos.git\", .upToNextMajor(from: \"TAG\")),\n```\n\n### Bazel\n\nAdd Kronos to your `WORKSPACE`:\n\n```bzl\nhttp_archive(\n    name = \"Kronos\",\n    sha256 = \"\",\n    strip_prefix = \"Kronos-TAG/\",\n    url = \"https://github.com/MobileNativeFoundation/Kronos/archive/TAG.tar.gz\",\n)\n```\n\nThen depend on `@Kronos//:Kronos`\n\n### Android\n\nCheck out [Kronos for Android](https://github.com/lyft/Kronos-Android)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobilenativefoundation%2Fkronos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobilenativefoundation%2Fkronos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobilenativefoundation%2Fkronos/lists"}