Migrate Instant to kotlin.time

This commit is contained in:
sergeych committed 2026-02-18 21:13:21 +03:00
1 parent 79a541b148
commit 6d943c5e1e
5 files changed
+38 -20

No files matched your search

+5 -4
View File
@@ -25,6 +25,7 @@ import net.sergeych.lyng.obj.*
import net.sergeych.lynon.*
import java.nio.file.Files
import java.nio.file.Path
import kotlin.time.Instant
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertContentEquals
@@ -368,11 +369,11 @@ class LynonTests {
roundTrip(ObjReal(1.22345))
roundTrip(ObjReal(-Math.PI))
val now = kotlinx.datetime.Instant.fromEpochMilliseconds(System.currentTimeMillis())
roundTrip(ObjInstant(kotlinx.datetime.Instant.fromEpochSeconds(now.epochSeconds), LynonSettings.InstantTruncateMode.Second))
val now = Instant.fromEpochMilliseconds(System.currentTimeMillis())
roundTrip(ObjInstant(Instant.fromEpochSeconds(now.epochSeconds), LynonSettings.InstantTruncateMode.Second))
roundTrip(
ObjInstant(
kotlinx.datetime.Instant.fromEpochSeconds(
Instant.fromEpochSeconds(
now.epochSeconds,
now.nanosecondsOfSecond / 1_000_000 * 1_000_000
),
@@ -381,7 +382,7 @@ class LynonTests {
)
roundTrip(
ObjInstant(
kotlinx.datetime.Instant.fromEpochSeconds(
Instant.fromEpochSeconds(
now.epochSeconds,
now.nanosecondsOfSecond / 1_000 * 1_000
),