From: Lanius Trolling Date: Wed, 10 Apr 2024 23:40:45 +0000 (-0400) Subject: Fix overflow X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=c7ce85a1372b484cb7f4ff0c8764dad727ffb20b;p=factbooks Fix overflow --- diff --git a/src/jvmMain/kotlin/info/mechyrdia/lore/asset_caching.kt b/src/jvmMain/kotlin/info/mechyrdia/lore/asset_caching.kt index 8c6d1f6..f4e3da9 100644 --- a/src/jvmMain/kotlin/info/mechyrdia/lore/asset_caching.kt +++ b/src/jvmMain/kotlin/info/mechyrdia/lore/asset_caching.kt @@ -17,7 +17,7 @@ val StoragePathAttributeKey = AttributeKey("Mechyrdia.StoragePath") abstract class FileDependentCache { private inner class Entry(updated: Instant?, data: T?) { - private val updatedAtomic = AtomicLong((updated ?: Instant.MIN).toEpochMilli()) + private val updatedAtomic = AtomicLong(updated?.toEpochMilli() ?: Long.MIN_VALUE) val updated: Instant get() = Instant.ofEpochMilli(updatedAtomic.get()) @@ -28,7 +28,7 @@ abstract class FileDependentCache { private val updateLock = Mutex() private fun clear() { - updatedAtomic.set(Instant.MIN.toEpochMilli()) + updatedAtomic.set(Long.MIN_VALUE) dataAtomic.set(null) }