toDuration

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

Since Kotlin

1.6

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

Since Kotlin

1.6

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

Depending on its magnitude, the value is rounded to an integer number of nanoseconds or milliseconds.

Since Kotlin

1.6

Throws

if this Double value is NaN.