Advertisement
Guest User

Untitled

a guest
Dec 27th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.42 KB | None | 0 0
  1.     let duration = Duration::from_secs(config.time);
  2.     let increment = Duration::new(1, 0);
  3.  
  4.     loop {
  5.     match duration.checked_sub(increment) {
  6.         Some(_) => {
  7.             println!("Time passed: {:?} ", duration);
  8.             duration - increment;
  9.         }
  10.         None => {
  11.             println!("I finished waiting. The time is now {:?} ", Instant::now());
  12.             break
  13.             }
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement