Skip to content

Commit

Permalink
Fix duration conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
sghpjuikit committed Jan 14, 2025
1 parent e509af4 commit 7e0de49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util/main/sp/it/util/units/Duration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import javafx.util.Duration as Dur
import kotlin.time.Duration as DurationKt
import java.time.Duration
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.DurationUnit
import kotlin.time.DurationUnit.MILLISECONDS
import kotlin.time.DurationUnit.NANOSECONDS
import sp.it.util.dev.Dependency
import sp.it.util.dev.failIf
Expand All @@ -17,7 +19,7 @@ import sp.it.util.functional.runTry
val Duration.javafx: Dur get() = toMillis().millis

/** Converts to javafx [Dur] */
val DurationKt.javafx: Dur get() = toDouble(NANOSECONDS).millis
val DurationKt.javafx: Dur get() = toDouble(MILLISECONDS).millis

/** Converts to [Duration] */
val Dur.java: Duration get() = Duration.ofMillis(toMillis().toLong())
Expand Down

0 comments on commit 7e0de49

Please sign in to comment.