Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Instant sleep Duration

  • Instant
fn main() {
    let start = std::time::Instant::now();
    println!("{:?}", start);
    std::thread::sleep(std::time::Duration::from_secs(1));
    let end = std::time::Instant::now();
    println!("{:?}", end);
    let elapsed = end - start;
    println!("{:?}", elapsed);
    println!("{:?}", start.elapsed());
}
Instant { tv_sec: 5093638, tv_nsec: 944727638 }
Instant { tv_sec: 5093639, tv_nsec: 944974927 }
1.000247289s
1.000311683s