public class StopWatch
extends java.lang.Object
Constructor and Description |
---|
StopWatch()
Initialize the new instance with default values.
|
Modifier and Type | Method and Description |
---|---|
static StopWatch |
create()
Returns a newly created and immediately started StopWatch.
|
static StopWatch |
createAndStart()
Returns a newly created and immediately started StopWatch.
|
Duration |
duration()
Returns the duration between start and stop in milliseconds.
|
long |
getDuration()
Returns the duration between start and stop in milliseconds.
|
long |
getStartTime() |
long |
getStopTime() |
void |
reset()
Resets the watch to a state before it gets started
|
long |
start()
Starts the stop watch.
|
long |
stop()
Stops the stop watch.
|
java.lang.String |
toString() |
public static StopWatch create()
public static StopWatch createAndStart()
public long start()
public long stop()
public long getDuration()
stop()
has not been called yet it returns the duration from
start to now.public Duration duration()
stop()
has not been called yet it returns the duration from
start to now.public long getStartTime()
public long getStopTime()
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object