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,14 +88,15 @@ impl Stopwatch{
timeRes += 1; timeRes += 1;
} }
//Check if the duration needs reduced to minutes //Check if the duration needs reduced to minutes
if(duration >= 120.0){ if((duration >= 120.0) && (timeRes == TimeResolution::SECOND as i32)){
duration /= 60.0; duration /= 60.0;
timeRes = TimeResolution::MINUTE as i32; timeRes = TimeResolution::MINUTE as i32;
}
//Check if the duration needs reduced to hours //Check if the duration needs reduced to hours
if(duration >= 60.0){ if(duration >= 60.0){
duration /= 60.0; duration /= 60.0;
timeRes = TimeResolution::HOUR as i32; timeRes = TimeResolution::HOUR as i32;
}
} }
//Turn the number into a string //Turn the number into a string