All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.TimeHepler.kt Maven / Gradle / Ivy

The newest version!
import kotlinx.datetime.Clock

fun gregorian(): Long {
    val now = Clock.System.now()
    val nano = now.nanosecondsOfSecond
    val second = now.epochSeconds + GREGORIAN_OFFSET
    return (second * 10_000_000L) + (nano / 100L)
}

/**
 * 1582-10-15T00:00:00Z
 */
private const val GREGORIAN_OFFSET = 12219292800L




© 2015 - 2024 Weber Informatics LLC | Privacy Policy