Replace references to NEU with Firmament
This commit is contained in:
23
src/main/kotlin/moe/nea/firmament/util/Timer.kt
Normal file
23
src/main/kotlin/moe/nea/firmament/util/Timer.kt
Normal file
@@ -0,0 +1,23 @@
|
||||
package moe.nea.firmament.util
|
||||
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.TimeSource
|
||||
|
||||
@OptIn(ExperimentalTime::class)
|
||||
class Timer {
|
||||
private var mark: TimeSource.Monotonic.ValueTimeMark? = null
|
||||
|
||||
fun timePassed(): Duration {
|
||||
return mark?.elapsedNow() ?: Duration.INFINITE
|
||||
}
|
||||
|
||||
fun markNow() {
|
||||
mark = TimeSource.Monotonic.markNow()
|
||||
}
|
||||
|
||||
fun markFarPast() {
|
||||
mark = null
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user