toComponents

Common
JVM
JS
Native
1.0
inline fun <T> toComponents(
    action: (days: Long, hours: Int, minutes: Int, seconds: Int, nanoseconds: Int) -> T
): T

(source)

Splits this duration into days, hours, minutes, seconds, and nanoseconds and executes the given action with these components. The result of action is returned as the result of this function.

  • nanoseconds represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;
  • seconds represents the whole number of seconds in this duration, and its absolute value is less than 60;
  • minutes represents the whole number of minutes in this duration, and its absolute value is less than 60;
  • hours represents the whole number of hours in this duration, and its absolute value is less than 24;
  • days represents the whole number of days in this duration.

Infinite durations are represented as either Long.MAX_VALUE days, or Long.MIN_VALUE days (depending on the sign of infinity), and zeroes in the lower components.

Common
JVM
JS
Native
1.0
inline fun <T> toComponents(
    action: (hours: Long, minutes: Int, seconds: Int, nanoseconds: Int) -> T
): T

(source)

Splits this duration into hours, minutes, seconds, and nanoseconds and executes the given action with these components. The result of action is returned as the result of this function.

  • nanoseconds represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;
  • seconds represents the whole number of seconds in this duration, and its absolute value is less than 60;
  • minutes represents the whole number of minutes in this duration, and its absolute value is less than 60;
  • hours represents the whole number of hours in this duration.

Infinite durations are represented as either Long.MAX_VALUE hours, or Long.MIN_VALUE hours (depending on the sign of infinity), and zeroes in the lower components.

Common
JVM
JS
Native
1.0
inline fun <T> toComponents(
    action: (minutes: Long, seconds: Int, nanoseconds: Int) -> T
): T

(source)

Splits this duration into minutes, seconds, and nanoseconds and executes the given action with these components. The result of action is returned as the result of this function.

  • nanoseconds represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;
  • seconds represents the whole number of seconds in this duration, and its absolute value is less than 60;
  • minutes represents the whole number of minutes in this duration.

Infinite durations are represented as either Long.MAX_VALUE minutes, or Long.MIN_VALUE minutes (depending on the sign of infinity), and zeroes in the lower components.

Common
JVM
JS
Native
1.0
inline fun <T> toComponents(
    action: (seconds: Long, nanoseconds: Int) -> T
): T

(source)

Splits this duration into seconds, and nanoseconds and executes the given action with these components. The result of action is returned as the result of this function.

  • nanoseconds represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;
  • seconds represents the whole number of seconds in this duration.

Infinite durations are represented as either Long.MAX_VALUE seconds, or Long.MIN_VALUE seconds (depending on the sign of infinity), and zero nanoseconds.