mirror of https://github.com/stjepang/smol
Add timer example
This commit is contained in:
parent
8a238b892f
commit
db4dd0b82f
|
@ -0,0 +1,14 @@
|
|||
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());
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue