Companion

object Companion

Functions

convert
Link copied to clipboard
fun convert(value: Double, sourceUnit: DurationUnit, targetUnit: DurationUnit): Double

Converts the given time duration value expressed in the specified sourceUnit into the specified targetUnit.

days
Link copied to clipboard
fun days(value: Double): Duration
fun days(value: Int): Duration
fun days(value: Long): Duration

Returns a Duration representing the specified value number of days.

Since Kotlin

1.5
hours
Link copied to clipboard
fun hours(value: Double): Duration
fun hours(value: Int): Duration
fun hours(value: Long): Duration

Returns a Duration representing the specified value number of hours.

Since Kotlin

1.5
microseconds
Link copied to clipboard
fun microseconds(value: Double): Duration
fun microseconds(value: Int): Duration
fun microseconds(value: Long): Duration

Returns a Duration representing the specified value number of microseconds.

Since Kotlin

1.5
milliseconds
Link copied to clipboard
fun milliseconds(value: Double): Duration
fun milliseconds(value: Int): Duration
fun milliseconds(value: Long): Duration

Returns a Duration representing the specified value number of milliseconds.

Since Kotlin

1.5
minutes
Link copied to clipboard
fun minutes(value: Double): Duration
fun minutes(value: Int): Duration
fun minutes(value: Long): Duration

Returns a Duration representing the specified value number of minutes.

Since Kotlin

1.5
nanoseconds
Link copied to clipboard
fun nanoseconds(value: Double): Duration
fun nanoseconds(value: Int): Duration
fun nanoseconds(value: Long): Duration

Returns a Duration representing the specified value number of nanoseconds.

Since Kotlin

1.5
seconds
Link copied to clipboard
fun seconds(value: Double): Duration
fun seconds(value: Int): Duration
fun seconds(value: Long): Duration

Returns a Duration representing the specified value number of seconds.

Since Kotlin

1.5

Properties

INFINITE
Link copied to clipboard
val INFINITE: Duration

The duration whose value is positive infinity. It is useful for representing timeouts that should never expire.

ZERO
Link copied to clipboard
val ZERO: Duration

The duration equal to exactly 0 seconds.