Add shortcuts to convert duration to milliseconds and nanoseconds

This commit is contained in:
Ilya Gorbunov
2019-05-23 21:20:13 +03:00
parent 8004c34e44
commit 796ad29637
2 changed files with 10 additions and 0 deletions
@@ -100,6 +100,10 @@ public inline class Duration internal constructor(internal val _value: Double) :
val inMicroseconds: Double get() = toDouble(DurationUnit.MICROSECONDS)
val inNanoseconds: Double get() = toDouble(DurationUnit.NANOSECONDS)
// shortcuts
fun toLongNanoseconds(): Long = toLong(DurationUnit.NANOSECONDS)
fun toLongMilliseconds(): Long = toLong(DurationUnit.MILLISECONDS)
override fun toString(): String = buildString {
if (isInfinite()) {