mirror of
https://bitbucket.org/Mattrixwv/rustclasses.git
synced 2025-12-06 18:34:00 -05:00
Added function to get string from duration
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user