Fixed bug that cause incorrect interpreting of time

resolution
This commit is contained in:
2020-06-16 22:25:38 -04:00
parent ecea61f7cc
commit 940a24f038

View File

@@ -88,15 +88,16 @@ 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;
}
}
//Turn the number into a string
let mut time = format!("{:0.3} ", duration);