Add Duration.inWholeTicks to convert a Duration to ticks

This commit is contained in:
Niels van Velzen 2022-12-28 11:19:48 +01:00 committed by Max Rumpf
parent 44f85694b7
commit 6dc72ca5be

View File

@ -20,3 +20,8 @@ public inline val Int.ticks: Duration get() = times(100).toDuration(DurationUnit
* Returns a [Duration] equal to this [Double] number of ticks.
*/
public inline val Double.ticks: Duration get() = times(100.0).toDuration(DurationUnit.NANOSECONDS)
/**
* The value of this duration expressed as a [Long] number of ticks.
*/
public val Duration.inWholeTicks: Long get() = toLong(DurationUnit.NANOSECONDS).div(100L)