Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let duration = Duration::from_secs(config.time);
- let increment = Duration::new(1, 0);
- loop {
- match duration.checked_sub(increment) {
- Some(_) => {
- println!("Time passed: {:?} ", duration);
- duration - increment;
- }
- None => {
- println!("I finished waiting. The time is now {:?} ", Instant::now());
- break
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement