From 805282625ba2e7faf5154a4680e10844761db996 Mon Sep 17 00:00:00 2001 From: James Roome Date: Sat, 31 Aug 2024 12:55:23 +0530 Subject: [PATCH] Fix duration Test (#155) --- src/commonMain/kotlin/com/github/quillraven/fleks/world.kt | 3 +-- src/commonTest/kotlin/com/github/quillraven/fleks/WorldTest.kt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/commonMain/kotlin/com/github/quillraven/fleks/world.kt b/src/commonMain/kotlin/com/github/quillraven/fleks/world.kt index fca025d..2a2c4ee 100644 --- a/src/commonMain/kotlin/com/github/quillraven/fleks/world.kt +++ b/src/commonMain/kotlin/com/github/quillraven/fleks/world.kt @@ -6,7 +6,6 @@ import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable import kotlin.native.concurrent.ThreadLocal import kotlin.time.Duration -import kotlin.time.DurationUnit /** * Snapshot for an [entity][Entity] that contains its [components][Component] and [tags][EntityTag]. @@ -455,7 +454,7 @@ class World internal constructor( * using the given [duration]. The duration is converted to seconds. */ fun update(duration: Duration) { - update(duration.toLong(DurationUnit.NANOSECONDS) * 0.000000001f) + update(duration.inWholeNanoseconds * 0.000000001f) } /** diff --git a/src/commonTest/kotlin/com/github/quillraven/fleks/WorldTest.kt b/src/commonTest/kotlin/com/github/quillraven/fleks/WorldTest.kt index c42c2f2..be7175b 100644 --- a/src/commonTest/kotlin/com/github/quillraven/fleks/WorldTest.kt +++ b/src/commonTest/kotlin/com/github/quillraven/fleks/WorldTest.kt @@ -332,7 +332,7 @@ internal class WorldTest { } w.system().enabled = false - w.update(1.milliseconds) + w.update(1.seconds) assertEquals(1f, w.deltaTime) assertEquals(1, w.system().numCalls)