aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/TimeMark.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/TimeMark.kt')
-rw-r--r--src/main/kotlin/util/TimeMark.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/kotlin/util/TimeMark.kt b/src/main/kotlin/util/TimeMark.kt
index 4a076ac..112a727 100644
--- a/src/main/kotlin/util/TimeMark.kt
+++ b/src/main/kotlin/util/TimeMark.kt
@@ -2,6 +2,7 @@ package moe.nea.firmament.util
import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
+import kotlin.time.DurationUnit
class TimeMark private constructor(private val timeMark: Long) : Comparable<TimeMark> {
fun passedTime() =
@@ -50,3 +51,7 @@ class TimeMark private constructor(private val timeMark: Long) : Comparable<Time
return this.timeMark.compareTo(other.timeMark)
}
}
+
+fun Duration.toTicks(): Long {
+ return toLong(DurationUnit.MILLISECONDS) / 50
+}