You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In cases where you want exact control over time without drift we can use exact points in time using `Instant`, and spans of time using `Duration`. Operations on the `Instant` and `Duration` types come from the [`fugit`] crate.
91
78
92
79
[fugit]: https://crates.io/crates/fugit
93
80
94
81
```rust
95
-
// get the current time instance
96
-
letmutinstant=Systick::now();
97
-
98
-
// do this 3 times
99
-
fornin0..3 {
100
-
// absolute point in time without drift
101
-
instant+=1000.millis();
102
-
Systick::delay_until(instant).await;
103
-
104
-
// absolute point it time for timeout
105
-
lettimeout=instant+500.millis();
106
-
hprintln!("now is {:?}, timeout at {:?}", Systick::now(), timeout);
0 commit comments