Skip to main content

advance

Function advance 

Source
pub async fn advance(duration: Duration)
Expand description

Moves the clock of the runtime this code runs in forward by duration, paused or running, then lets the timers that came due fire before it returns.

use std::time::Duration;
use nuclei::time::{self, Instant};

time::pause();
let start = Instant::now();
time::advance(Duration::from_millis(250)).await;
assert_eq!(start.elapsed(), Duration::from_millis(250));