From d3a71af6dd87c2b132f25c2c836f6e3dddbab131 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Thu, 9 Jul 2020 01:44:04 -0400 Subject: [PATCH] Added a function that will return a time string from a duration passed into it --- src/main/java/mattrixwv/Stopwatch.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/mattrixwv/Stopwatch.java b/src/main/java/mattrixwv/Stopwatch.java index 95771d4..fea7ac1 100644 --- a/src/main/java/mattrixwv/Stopwatch.java +++ b/src/main/java/mattrixwv/Stopwatch.java @@ -97,7 +97,11 @@ public class Stopwatch{ //Returns the time as a string at the 'best' resolution. (Goal is xxx.xxx) public String getStr(){ //Get the current duration from time - Double duration = getTime().doubleValue(); + return getStr(getTime().doubleValue()); + } + + public static String getStr(double nanoseconds){ + Double duration = nanoseconds; //Reduce the number to the appropriate number of digits. (xxx.x). //This loop works down to seconds TIME_RESOLUTION resolution;