Fix time calculation

Use unwrap_or_get to avoid checking time when not necessary
This commit is contained in:
Ulf Lilleengen 2021-10-20 14:25:34 +02:00
parent 3c2daf0d32
commit 5e6ee59ecd

View file

@ -90,7 +90,7 @@ impl TimeDriver {
// Ensure we don't overflow
let until = zero
.checked_add(StdDuration::from_micros(next_alarm))
.unwrap_or(zero + StdDuration::from_secs(1));
.unwrap_or_else(|| StdInstant::now() + StdDuration::from_secs(1));
unsafe { DRIVER.signaler.as_ref() }.wait_until(until);
}