toKotlinDuration

Converts java.time.Duration value to kotlin.time.Duration value.

Accuracy of conversion:

  • Durations in range of ±146 years are converted exactly.

  • Durations out of that range, but in range of ±146 million years can be rounded to millisecond precision.

  • Durations greater than that are converted to a positive or negative infinite Duration (see Duration.INFINITE).

Since Kotlin

1.6