Klock
Klock is a Date & Time library for Multiplatform Kotlin 1.3.
It is designed to be as allocation-free as possible using Kotlin inline classes, to be consistent and portable across targets since all the code is written in Common Kotlin, and to provide an API that is powerful, fun and easy to use.
https://github.com/korlibs/korge/tree/main/klock
Table of contents:
Pages
- Dates - DateTime, Date, DayOfWeek, Month, Year, YearMonth, TimeZone...
- Spans - TimeSpan, MonthSpan, DateTimeSpan, DateTimeRange...
- Measure - measureTime, measureTimeWithResult & PerformanceCounter
- Format - Formatting, parsing and localization
- Testing - TimeProvider and testing
Using with gradle
Requires Gradle 7.1.1
(JVM 11~17
) for building and Kotlin >=1.7.21
for running:
build.gradle.kts
val klockVersion = "4.0.2"
// For multiplatform projects
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("com.soywiz.korlibs.klock:klock:$klockVersion")
}
}
}
}
dependencies {
// For JVM only
implementation("com.soywiz.korlibs.klock:klock-jvm:$klockVersion")
// For Android only
implementation("com.soywiz.korlibs.klock:klock-android:$klockVersion")
// For JS only
implementation("com.soywiz.korlibs.klock:klock-js:$klockVersion")
}