We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d50499 commit fbf1ef6Copy full SHA for fbf1ef6
src/utils.rs
@@ -84,7 +84,13 @@ mod timer {
84
85
impl Timer {
86
pub(crate) fn after(dur: std::time::Duration) -> Self {
87
- Timer(TimeoutFuture::new(dur.as_millis() as u32))
+ // Round up to the nearest millisecond.
88
+ let mut timeout_ms = dur.as_millis() as u32;
89
+ if std::time::Duration::from_millis(timeout_ms as u64) < dur {
90
+ timeout_ms += 1;
91
+ }
92
+
93
+ Timer(TimeoutFuture::new(timeout_ms))
94
}
95
96
0 commit comments