Skip to content

Commit

Permalink
Avoid ill-defined > operation on Instant
Browse files Browse the repository at this point in the history
See korken89/fugit#36.

Here, we know that the underlying u64 won't overflow, so const_cmp is fine.
  • Loading branch information
jannic committed Sep 17, 2022
1 parent 034681b commit cebf1e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion boards/rp-pico-w/src/embassy_time_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl TimerDriver {
let (n, timestamp) = next;
let now = self.now_instant();
// alarm peripheral has only 32 bits, so might have triggered early
if timestamp <= now {
if timestamp.const_cmp(now) != core::cmp::Ordering::Less {
self.trigger_alarm(n, cs)
}
// next alarm could have changed - rearm
Expand Down

0 comments on commit cebf1e5

Please sign in to comment.