rust elapsed time code example
Example: rust elapsed time
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());
}