public final class StopWatch
extends java.lang.Object
Constructor and Description |
---|
StopWatch()
Create and start the stop watch.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
formattedToString() |
static java.lang.String |
formattedToString(double secondsPassed) |
long |
nanoTicksPassed() |
void |
start()
Starts or restarts the watch.
|
long |
ticksPassed() |
double |
timePassed(TimeUnit unit)
Calculates and returns the time passed in the requested unit.
|
java.lang.String |
toString() |
static java.lang.String |
toTime(java.lang.String inputResource,
int currentSeconds)
Returns a 24h time string based on an input resource.
|
public long ticksPassed()
ticksPassed
. In milliseconds or 10^-3 seconds.public long nanoTicksPassed()
ticksPassed
. In nanoseconds or 10^-9 seconds.public double timePassed(TimeUnit unit)
unit
- The requested time unit.public void start()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String toTime(java.lang.String inputResource, int currentSeconds)
inputResource
- The name of the input resource with a date and time part. E.g. "20120325-235950.wav"currentSeconds
- The number of seconds to add to the time part.public java.lang.String formattedToString()
public static java.lang.String formattedToString(double secondsPassed)