From 940a24f03825d7ff7919f603aefac08ee3aabc4b Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Tue, 16 Jun 2020 22:25:38 -0400 Subject: [PATCH] Fixed bug that cause incorrect interpreting of time resolution --- src/Stopwatch.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Stopwatch.rs b/src/Stopwatch.rs index 2bf83e4..ac2c04b 100644 --- a/src/Stopwatch.rs +++ b/src/Stopwatch.rs @@ -88,14 +88,15 @@ impl Stopwatch{ timeRes += 1; } //Check if the duration needs reduced to minutes - if(duration >= 120.0){ + if((duration >= 120.0) && (timeRes == TimeResolution::SECOND as i32)){ duration /= 60.0; timeRes = TimeResolution::MINUTE as i32; - } - //Check if the duration needs reduced to hours - if(duration >= 60.0){ - duration /= 60.0; - timeRes = TimeResolution::HOUR as i32; + + //Check if the duration needs reduced to hours + if(duration >= 60.0){ + duration /= 60.0; + timeRes = TimeResolution::HOUR as i32; + } } //Turn the number into a string