smol/examples/timer.rs

15 lines
271 B
Rust
Raw Normal View History

2020-02-05 18:56:07 +00:00
use std::time::{Duration, Instant};
use smol::Timer;
fn main() {
futures::executor::block_on(async {
let start = std::time::Instant::now();
let dur = Duration::from_secs(1);
Timer::after(dur).await;
dbg!(start.elapsed());
})
}