{"id":28338287,"url":"https://github.com/softartdev/kronos-multiplatform","last_synced_at":"2025-10-10T04:33:12.635Z","repository":{"id":165508626,"uuid":"618633459","full_name":"softartdev/Kronos-Multiplatform","owner":"softartdev","description":"Kotlin Multiplatform SNTP library","archived":false,"fork":false,"pushed_at":"2025-07-01T11:15:14.000Z","size":260,"stargazers_count":21,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T02:50:07.813Z","etag":null,"topics":["android","datetime","ios","java","kotlin","kotlin-coroutines","kotlin-multiplatform","kotlin-multiplatform-mobile","kotlin-native","kronos","ntp","sntp","time"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softartdev.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-24T22:57:58.000Z","updated_at":"2025-07-01T02:12:01.000Z","dependencies_parsed_at":"2025-07-07T02:40:31.611Z","dependency_job_id":"bef1325c-ef22-4305-a492-27864787da22","html_url":"https://github.com/softartdev/Kronos-Multiplatform","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":"JetBrains/compose-multiplatform-template","purl":"pkg:github/softartdev/Kronos-Multiplatform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softartdev%2FKronos-Multiplatform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softartdev%2FKronos-Multiplatform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softartdev%2FKronos-Multiplatform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softartdev%2FKronos-Multiplatform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softartdev","download_url":"https://codeload.github.com/softartdev/Kronos-Multiplatform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softartdev%2FKronos-Multiplatform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002674,"owners_count":26083442,"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-10T02:00:06.843Z","response_time":62,"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":["android","datetime","ios","java","kotlin","kotlin-coroutines","kotlin-multiplatform","kotlin-multiplatform-mobile","kotlin-native","kronos","ntp","sntp","time"],"created_at":"2025-05-27T00:19:04.925Z","updated_at":"2025-10-10T04:33:12.607Z","avatar_url":"https://github.com/softartdev.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kronos Multiplatform Library\n\n![Maven Central](https://img.shields.io/maven-central/v/io.github.softartdev/kronos)\n[![Build \u0026 Publish CI/CD](https://github.com/softartdev/Kronos-Multiplatform/actions/workflows/build_publish.yml/badge.svg)](https://github.com/softartdev/Kronos-Multiplatform/actions/workflows/build_publish.yml)\n\nKotlin Multiplatform library for network time synchronization. It extends the [`kotlin.time`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/) API and supports the following platforms:\n- Android\n- iOS\n- Desktop JVM (MacOS, Linux, Windows)\n## Usage\n### `kotlin.time` Extension\nThe library [extends the main `Clock` interface](https://github.com/softartdev/Kronos-Multiplatform/blob/main/kronos/src/commonMain/kotlin/com/softartdev/kronos/ClockExt.kt) from the standard library. You can use the [`Clock.Network`](https://github.com/softartdev/Kronos-Multiplatform/blob/main/kronos/src/commonMain/kotlin/com/softartdev/kronos/NetworkClock.kt) class to retrieve the current network time, similar to using the built-in [`Clock.System`](https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/src/kotlin/time/Clock.kt#L60) instance.\n```kotlin\nval networkTime: Instant = Clock.Network.now()  // 2025-06-30T13:42:43.712Z\nval systemTime: Instant = Clock.System.now()    // 2025-06-30T13:42:43.566455Z\nval diff: Duration = networkTime - systemTime   // 145.545ms\n```\n### Synchronization\nWhen running the application, it's necessary to synchronize the time with the network using the platform-specific code:\n- Android:\n```kotlin\nclass App : Application() {\n    override fun onCreate() {\n        super.onCreate()\n        Clock.Network.sync(applicationContext)\n    }\n}\n```\n- iOS:\n```swift\n@main\nstruct iosApp: App {\n    init() {\n        Clock.Network.sync()\n    }\n    var body: some Scene { ... }\n}\n```\n- Desktop JVM:\n```kotlin\nfun main() {\n    Clock.Network.sync()\n    ...\n}\n```\n### Installation\nThe latest release is available on [Maven Central](https://repo1.maven.org/maven2/io/github/softartdev/kronos/).\n1. Add the Maven Central repository if it is not already included:\n```kotlin\nrepositories {\n    mavenCentral()\n}\n```\n2. In multiplatform projects, add the following dependency to the `commonMain` source set dependencies:\n```kotlin\ncommonMain {\n    dependencies {\n        implementation(\"io.github.softartdev:kronos:$latestVersion\")\n    }\n}\n```\n## Implementation\nThe main common interface is implemented using the following:\n- [lyft/Kronos](https://github.com/lyft/Kronos-Android) for Java \u0026 Android\n- [MobileNativeFoundation/Kronos](https://github.com/MobileNativeFoundation/Kronos) for iOS\n\nThe project is built and tested using the following:\n- [Swift Klib Gradle Plugin](https://github.com/ttypic/swift-klib-plugin) for including Swift source files in KMM shared module\n- [Compose Multiplatform, by JetBrains](https://github.com/JetBrains/compose-jb) for UI samples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftartdev%2Fkronos-multiplatform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftartdev%2Fkronos-multiplatform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftartdev%2Fkronos-multiplatform/lists"}