From 1576f7d888a6ec17e1431598700b7a270b7c7fcc Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Thu, 8 Mar 2018 08:47:47 +0100 Subject: Fix signed/unsigned issue regarding remaining time --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index c36da4f..9596896 100644 --- a/src/main.rs +++ b/src/main.rs @@ -178,7 +178,7 @@ fn main() { let threads = 16; - let mut generation_time = 30; + let mut generation_time : i64 = 30; println!("Starting Threads"); @@ -200,7 +200,7 @@ fn main() { println!("Letting workers work"); while generation_time > 0{ println!("Remaining time: {}",generation_time); - thread::sleep(time::Duration::from_secs(cmp::min(5,generation_time))); + thread::sleep(time::Duration::from_secs(cmp::max(0,cmp::min(5,generation_time)) as u64)); generation_time -= 5; } -- cgit v1.2.3