public class Timer
extends java.lang.Object
Not very exact, measures user time, not processor time.
Modifier and Type | Field and Description |
---|---|
private boolean |
running |
private long |
startTime |
private long |
stopTime |
Constructor and Description |
---|
Timer()
Construct a new timer that starts immediately.
|
Modifier and Type | Method and Description |
---|---|
long |
diff()
Return the number of milliseconds the timer has been running.
|
void |
start()
Start the timer.
|
void |
stop()
Stop the timer.
|
java.lang.String |
toString()
Return a string representation of the timer.
|
private long startTime
private long stopTime
private boolean running
public void start()
public void stop()
public long diff()
(up till now, if it still runs, up to the stop time if it has been stopped)
public java.lang.String toString()
toString
in class java.lang.Object
diff()