jvmMain.krono.LocalDateTimeJvmFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of krono-api-jvm Show documentation
Show all versions of krono-api-jvm Show documentation
An multiplatform interoperable datetime library
@file:Suppress("NOTHING_TO_INLINE")
package krono
import java.time.Instant
import java.time.LocalDateTime
import java.time.ZoneId
inline fun Clock.currentJavaLocalDateTime() = LocalDateTime.ofInstant(Instant.ofEpochMilli(currentMillisAsLong()), ZoneId.of("UTC"))
inline fun LocalDate.toLocalDate() = java.time.LocalDate.of(year, monthNumber, dayOfMonth)
inline fun java.time.LocalDate.toLocalDate() = LocalDate(year, month.value, dayOfMonth)