class Duration
source · line 9public class Duration private constructor(
/**
* The whole-second component rounded toward negative infinity.
*/
public val floorSeconds: Long,
/**
* The nonnegative fractional component in 0..999999999.
*/
public val nanosecondsOfSecond: Int
) : Equals<Duration>, Compare<Duration>, Hash, ToString, Add<Duration, Duration>, Sub<
Duration,
Duration
>, Mul<Long, Duration>, Div<Long, Duration>, UnaryMinus<Duration>
- Supertype
Equals<Duration> - Supertype
Compare<Duration> - Supertype
Hash - Supertype
ToString - Supertype
Add<Duration, Duration> - Supertype
Sub<Duration, Duration> - Supertype
Mul<Long, Duration> - Supertype
Div<Long, Duration> - Supertype
UnaryMinus<Duration>
A signed elapsed duration with nanosecond precision, normalized as floor seconds plus nonnegative fractional nanoseconds. Arithmetic throws on representational overflow.
function toComponents
source · line 138public fun toComponents(): (Long, Int)
Returns whole seconds truncated toward zero and a signed nanosecond remainder.
function hash
source · line 40public override fun hash(): Long
- Overrides
hash
Computes a hash consistent with component equality.
function equals
source · line 27public override operator fun equals(other: Duration): Boolean
- Overrides
equals
Compares the stored value components for equality.
parameter other
source · line 27other: Duration
function plus
source · line 44public override operator fun plus(other: Duration): Duration
- Overrides
plus
Adds another duration with checked representational overflow.
parameter other
source · line 44other: Duration
function toString
source · line 153public override fun toString(): String
- Overrides
toString
Formats this value as ISO duration.
function compareTo
source · line 32public override operator fun compareTo(other: Duration): Long
- Overrides
compareTo
Orders values by their chronological or numeric value; only the result sign is significant.
parameter other
source · line 32other: Duration
function div
source · line 85public override operator fun div(other: Long): Duration
- Overrides
div
Divides by a signed integer, truncating subnanosecond remainder toward zero; zero divisor or overflow throws.
parameter other
source · line 85other: Long
function times
source · line 79public override operator fun times(other: Long): Duration
- Overrides
times
Multiplies by a signed integer with checked overflow.
parameter other
source · line 79other: Long
property inWholeHours
source · line 113public val inWholeHours: Long
get: public read-only
Returns whole hours truncated toward zero; a result outside Long range throws ArithmeticException.
getter get
source · line 113get(): Long
property nanosecondsOfSecond
source · line 17public val nanosecondsOfSecond: Int
get: public read-only
The nonnegative fractional component in 0..999999999.
property absoluteValue
source · line 90public val absoluteValue: Duration
get: public read-only
Returns the nonnegative magnitude, throwing if it cannot be represented.
getter get
source · line 90get(): Duration
property inWholeDays
source · line 118public val inWholeDays: Long
get: public read-only
Returns whole days truncated toward zero; a result outside Long range throws ArithmeticException.
getter get
source · line 118get(): Long
function minus
source · line 59public override operator fun minus(other: Duration): Duration
- Overrides
minus
Subtracts another duration with checked representational overflow.
parameter other
source · line 59other: Duration
function toIsoString
source · line 149public fun toIsoString(): String
Formats the signed duration in ISO duration notation.
property floorSeconds
source · line 13public val floorSeconds: Long
get: public read-only
The whole-second component rounded toward negative infinity.
property inWholeMicroseconds
source · line 128public val inWholeMicroseconds: Long
get: public read-only
Returns whole microseconds truncated toward zero; a result outside Long range throws ArithmeticException.
getter get
source · line 128get(): Long
property inWholeMinutes
source · line 108public val inWholeMinutes: Long
get: public read-only
Returns whole minutes truncated toward zero; a result outside Long range throws ArithmeticException.
getter get
source · line 108get(): Long
property inWholeNanoseconds
source · line 133public val inWholeNanoseconds: Long
get: public read-only
Returns whole nanoseconds truncated toward zero; a result outside Long range throws ArithmeticException.
getter get
source · line 133get(): Long
property inWholeMilliseconds
source · line 123public val inWholeMilliseconds: Long
get: public read-only
Returns whole milliseconds truncated toward zero; a result outside Long range throws ArithmeticException.
getter get
source · line 123get(): Long
property inWholeSeconds
source · line 99public val inWholeSeconds: Long
get: public read-only
Returns whole seconds truncated toward zero; a result outside Long range throws ArithmeticException.
getter get
source · line 99get(): Long
function unaryMinus
source · line 74public override operator fun unaryMinus(): Duration
- Overrides
unaryMinus
Negates the duration, throwing if the result cannot be represented.