diff options
Diffstat (limited to 'src/main/kotlin/util/json/InstantAsLongSerializer.kt')
| -rw-r--r-- | src/main/kotlin/util/json/InstantAsLongSerializer.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/kotlin/util/json/InstantAsLongSerializer.kt b/src/main/kotlin/util/json/InstantAsLongSerializer.kt index ad738dc..51b5f0a 100644 --- a/src/main/kotlin/util/json/InstantAsLongSerializer.kt +++ b/src/main/kotlin/util/json/InstantAsLongSerializer.kt @@ -2,7 +2,7 @@ package moe.nea.firmament.util.json -import kotlinx.datetime.Instant +import java.time.Instant import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor @@ -13,10 +13,10 @@ import kotlinx.serialization.encoding.Encoder object InstantAsLongSerializer : KSerializer<Instant> { override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("InstantAsLongSerializer", PrimitiveKind.LONG) override fun deserialize(decoder: Decoder): Instant { - return Instant.fromEpochMilliseconds(decoder.decodeLong()) + return Instant.ofEpochMilli(decoder.decodeLong()) } override fun serialize(encoder: Encoder, value: Instant) { - encoder.encodeLong(value.toEpochMilliseconds()) + encoder.encodeLong(value.toEpochMilli()) } } |
