mirror of
https://bitbucket.org/Mattrixwv/javaclasses.git
synced 2025-12-07 07:23:57 -05:00
Fixed bug where part returned by getStr was off by a factor of 10
This commit is contained in:
Binary file not shown.
@@ -101,8 +101,8 @@ public class Stopwatch{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Turn the number into a string
|
//Turn the number into a string
|
||||||
Double durationFraction = ((duration % 1) * 100);
|
Double durationFraction = ((duration % 1) * 1000);
|
||||||
String time = String.format("% 3d.%03d", duration.intValue(), durationFraction.intValue());
|
String time = String.format("%d.%03d", duration.intValue(), durationFraction.intValue());
|
||||||
|
|
||||||
//Tack on the appropriate suffix for resolution
|
//Tack on the appropriate suffix for resolution
|
||||||
switch(resolution){
|
switch(resolution){
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public class testStopwatch{
|
|||||||
|
|
||||||
//Print the results
|
//Print the results
|
||||||
System.out.printf("The timer results in: %s\n", timer.getStr());
|
System.out.printf("The timer results in: %s\n", timer.getStr());
|
||||||
|
System.out.printf("The timer results in: %f milliseconds\n", timer.getMilli());
|
||||||
|
|
||||||
if(!failed){
|
if(!failed){
|
||||||
System.out.println("All tests completed successfully");
|
System.out.println("All tests completed successfully");
|
||||||
|
|||||||
Reference in New Issue
Block a user