toComponents

Common
JVM
JS
Native
1.0
inline fun <T> toComponents(
    action: (days: Int, 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. If the value doesn't fit in Int range, i.e. it's greater than Int.MAX_VALUE or less than Int.MIN_VALUE, it is coerced into that range.
Common
JVM
JS
Native
1.0
inline fun <T> toComponents(
    action: (hours: Int, 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. If the value doesn't fit in Int range, i.e. it's greater than Int.MAX_VALUE or less than Int.MIN_VALUE, it is coerced into that range.
Common
JVM
JS
Native
1.0
inline fun <T> toComponents(
    action: (minutes: Int, 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. If the value doesn't fit in Int range, i.e. it's greater than Int.MAX_VALUE or less than Int.MIN_VALUE, it is coerced into that range.
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. If the value doesn't fit in Long range, i.e. it's greater than Long.MAX_VALUE or less than Long.MIN_VALUE, it is coerced into that range.