From 69794dec298458641a78d8ef08c5a9275a5c0db8 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Tue, 21 Jul 2020 21:40:51 -0400 Subject: [PATCH] Added function to get string from duration --- src/Stopwatch.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Stopwatch.rs b/src/Stopwatch.rs index ac2c04b..cea0ea5 100644 --- a/src/Stopwatch.rs +++ b/src/Stopwatch.rs @@ -79,7 +79,11 @@ impl Stopwatch{ } pub fn getString(&self) -> String{ //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; //Reduce the number until it has the appropriate number of digits. (xxx.xxx) //This loop works down to seconds