Added function to get string from duration

This commit is contained in:
2020-07-21 21:40:51 -04:00
parent 523a0cad65
commit 69794dec29

View File

@@ -79,7 +79,11 @@ impl Stopwatch{
} }
pub fn getString(&self) -> String{ pub fn getString(&self) -> String{
//Get the time in the most granular form possible //Get the time in the most granular form possible
let mut duration = self.getNano() as f64; return Stopwatch::getStr(self.getNano() as f64);
}
//A function to print out the time for any nanosecond duration passed to it
pub fn getStr(nano: f64) -> String{
let mut duration = nano;
let mut timeRes = TimeResolution::NANOSECOND as i32; let mut timeRes = TimeResolution::NANOSECOND as i32;
//Reduce the number until it has the appropriate number of digits. (xxx.xxx) //Reduce the number until it has the appropriate number of digits. (xxx.xxx)
//This loop works down to seconds //This loop works down to seconds