A `Duration` represents an amount of time. In Rust, it can describe time elapsed between `Instant` values or specify how long a thread should sleep. section 17.2
use std::time::Duration;
use std::thread::sleep;
fn main() {
let three_seconds = Duration::from_secs(3);
println!("I must sleep now.");
sleep(three_seconds);
println!("Did I miss anything?");
}
This example creates a three-second duration and uses it to pause execution. section 17.2
