commonMain.krono.Clock.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of krono-api Show documentation
Show all versions of krono-api Show documentation
An multiplatform interoperable datetime library
@file:JsExport
@file:Suppress("NON_EXPORTABLE_TYPE")
package krono
import kotlinx.JsExport
interface Clock {
fun currentMicrosAsLong(): Long
fun currentMicrosAsDouble() = currentMicrosAsLong().toDouble()
fun currentMillisAsLong() = currentMicrosAsLong() / 1_000
fun currentMillisAsDouble() = currentMillisAsLong().toDouble()
fun currentSecondsAsLong() = currentMicrosAsLong() / 1_000_000
fun currentSecondsAsDouble() = currentMicrosAsLong().toDouble() / 1_000_000
}