Added a function that will return a time string
from a duration passed into it
This commit is contained in:
@@ -97,7 +97,11 @@ public class Stopwatch{
|
|||||||
//Returns the time as a string at the 'best' resolution. (Goal is xxx.xxx)
|
//Returns the time as a string at the 'best' resolution. (Goal is xxx.xxx)
|
||||||
public String getStr(){
|
public String getStr(){
|
||||||
//Get the current duration from time
|
//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).
|
//Reduce the number to the appropriate number of digits. (xxx.x).
|
||||||
//This loop works down to seconds
|
//This loop works down to seconds
|
||||||
TIME_RESOLUTION resolution;
|
TIME_RESOLUTION resolution;
|
||||||
|
|||||||
Reference in New Issue
Block a user