-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly round Duration
instances to milliseconds
#3921
Properly round Duration
instances to milliseconds
#3921
Conversation
@@ -133,7 +133,7 @@ public suspend fun delay(timeMillis: Long) { | |||
} | |||
|
|||
/** | |||
* Delays coroutine for a given [duration] without blocking a thread and resumes it after the specified time. | |||
* Delays coroutine for at least the given [duration] without blocking a thread and resumes it after the specified time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt that this was an important distinction which felt natural to make here. Please let me know if I should revert.
Hi! If there's any other desired changes I'm happy to make them. |
Please rebase your changes on top of |
Prior to this commit Durations used in for delays or timeouts lost their nanosecond granularity when being converted to a millisecond Long value. This effectively meant that delays could resume prior to when they were scheduled to do so. This commit solves this by rounding a Duration with nanosecond components up to the next largest millisecond. Closes Kotlin#3920
4071820
to
5e6ab6f
Compare
Done. Sorry, I should have checked the contribution guide first. |
Do we think there's a chance this will be merged prior to the next version release? 😄 |
Yes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:thumb-up:
Nice! Thank you. |
Prior to this commit Durations used for delays or timeouts lost their nanosecond granularity when being converted to a millisecond Long value. This effectively meant that delays could resume prior to when they were scheduled to do so.
This commit solves this by rounding a Duration with nanosecond components up to the next largest millisecond.
Closes #3920