mirror of
https://bitbucket.org/Mattrixwv/rustclasses.git
synced 2025-12-06 18:34:00 -05:00
Fixed bug that cause incorrect interpreting of time
resolution
This commit is contained in:
@@ -88,15 +88,16 @@ 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
|
||||||
let mut time = format!("{:0.3} ", duration);
|
let mut time = format!("{:0.3} ", duration);
|
||||||
|
|||||||
Reference in New Issue
Block a user