public class StopWatch
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private long |
time |
Constructor and Description |
---|
StopWatch() |
Modifier and Type | Method and Description |
---|---|
long |
elapsed()
The total elapsed time in milliseconds.
|
static long |
getTime() |
boolean |
isStarted() |
void |
printElapsed(java.lang.String message) |
void |
reset()
Reset elapsed time to 0 and stop the timer.
|
void |
restart()
Reset elapsed time to 0 and start the timer.
|
void |
start()
Start the timer.
|
void |
stop()
Stop the timer, but store the elapsed time so that when
start() is called,
the elapsed time will continue to increase. |
public long elapsed()
public static long getTime()
public boolean isStarted()
public void printElapsed(java.lang.String message)
public void reset()
public void restart()
public void start()
public void stop()
start()
is called,
the elapsed time will continue to increase.
If the timer is already stopped, this has no effect.