toDuration

Common
JVM
JS
Native
1.3
@ExperimentalTime fun Int.toDuration(
    unit: DurationUnit
): Duration

Returns a Duration equal to this Int number of the specified unit.

Common
JVM
JS
Native
1.3
@ExperimentalTime fun Long.toDuration(
    unit: DurationUnit
): Duration

Returns a Duration equal to this Long number of the specified unit.

Common
JVM
JS
Native
1.3
@ExperimentalTime fun Double.toDuration(
    unit: DurationUnit
): Duration

Returns a Duration equal to this Double number of the specified unit.

Exceptions

IllegalArgumentException - if this Double value is NaN.