📅  最后修改于: 2022-03-11 14:49:24.734000             🧑  作者: Mango
use std::time::{Duration, Instant};
use std::thread::sleep;
fn main() {
let now = Instant::now();
// we sleep for 2 seconds
sleep(Duration::new(2, 0));
// it prints '2'
println!("{}", now.elapsed().as_secs());
}