mirror of
https://bitbucket.org/Mattrixwv/javaclasses.git
synced 2025-12-07 07:23:57 -05:00
Updated libraries and increased test coverage
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
//JavaClasses/src/main/java/mattrixwv/Stopwatch.java
|
||||
//Matthew Ellison (Mattrixwv)
|
||||
// Created: 03-01-19
|
||||
//Modified: 06-26-22
|
||||
//Modified: 04-13-23
|
||||
//This file contains a class that is used to time the execution time of other programs
|
||||
/*
|
||||
Copyright (C) 2022 Matthew Ellison
|
||||
Copyright (C) 2023 Matthew Ellison
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -122,6 +122,10 @@ public class Stopwatch{
|
||||
}
|
||||
}
|
||||
|
||||
if(duration < 0){
|
||||
resolution = TIME_RESOLUTION.ERROR;
|
||||
}
|
||||
|
||||
//Turn the number into a string
|
||||
int durationFraction = (int)Math.round(((duration % 1) * 1000));
|
||||
String time = String.format("%d.%03d", duration.intValue(), durationFraction);
|
||||
@@ -143,11 +147,6 @@ public class Stopwatch{
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
try{
|
||||
return getStr();
|
||||
}
|
||||
catch(InvalidResult error){
|
||||
return "There was an error in getStr(): " + error;
|
||||
}
|
||||
return getStr();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user