Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We're using seconds now #155

Merged
merged 2 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/commonMain/kotlin/com/github/quillraven/fleks/world.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down Expand Up @@ -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)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ internal class WorldTest {
}
w.system<WorldTestIteratingSystem>().enabled = false

w.update(1.milliseconds)
w.update(1.seconds)

assertEquals(1f, w.deltaTime)
assertEquals(1, w.system<WorldTestIntervalSystem>().numCalls)
Expand Down