You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a regression bug #870 in manual merge #1006
importkotlinx.coroutines.time.withTimeoutimportkotlinx.coroutines.withTimeoutimportjava.time.Durationsuspendfunmain() {
withTimeout(Duration.ZERO) {} // Duration works
withTimeout(0) {} // Long does not work
}
Proposed changes are:
fun Duration.coerceToMillis(): Long {
if (this<=Duration.ZERO) return0if (this<=ChronoUnit.MILLIS.duration) return1// Maximum scalar values of Duration.ofMillis(Long.MAX_VALUE)val maxSeconds =9223372036854775val maxNanos =807000000returnif (seconds < maxSeconds || seconds == maxSeconds && nano < maxNanos) toMillis()
elseLong.MAX_VALUE
}
or original PR (logharitmic search):
fun Duration.toMillisDelay(): Long=if (this<=ChronoUnit.MILLIS.duration) {
if (this<=Duration.ZERO) 0else1
} else {
// Maximum scalar values of Duration.ofMillis(Long.MAX_VALUE)val maxSeconds =9223372036854775val maxNanos =807000000if (seconds < maxSeconds || seconds == maxSeconds && nano < maxNanos) toMillis()
elseLong.MAX_VALUE
}
The text was updated successfully, but these errors were encountered:
I found a regression bug #870 in manual merge #1006
Proposed changes are:
or original PR (logharitmic search):
The text was updated successfully, but these errors were encountered: