pub fn pause()Expand description
Stops the clock of the runtime this code runs in (or of the default
runtime): Instant::now stands still, and timers fire only as the clock
is moved, by advance or by itself whenever every shard of the runtime is
idle with a timer armed (it jumps to the earliest one). A paused clock stays
paused.
use std::time::Duration;
use nuclei::time::{self, Instant};
time::pause();
let start = Instant::now();
// Nothing else runs: the clock jumps to the sleep's end at once.
time::sleep(Duration::from_secs(3600)).await;
assert_eq!(Instant::now() - start, Duration::from_secs(3600));