Skip to content

Commit aa0d0c8

Browse files
authored
Merge pull request async-rs#73 from sporksmith/now-timer
Process timers set for exactly `now`
2 parents 36f4581 + ff76625 commit aa0d0c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/reactor.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ impl Reactor {
187187
let now = Instant::now();
188188

189189
// Split timers into ready and pending timers.
190-
let pending = timers.split_off(&(now, 0));
190+
//
191+
// Careful to split just *after* `now`, so that a timer set for exactly `now` is considered
192+
// ready.
193+
let pending = timers.split_off(&(now + Duration::from_nanos(1), 0));
191194
let ready = mem::replace(&mut *timers, pending);
192195

193196
// Calculate the duration until the next event.

0 commit comments

Comments
 (0)