public class Stopwatch
extends java.lang.Object
Stopwatch time is elapsed (wall-clock) time, not process or CPU time. Stopwatch time resolution is one nanosecond. In other words, a stopwatch cannot measure a time difference less than one nanosecond. On the other hand, the granularity of the stopwatch depends on the underlying operating system and may be larger.
System.nanoTime()
Constructor and Description |
---|
Stopwatch() |
Modifier and Type | Method and Description |
---|---|
void |
reset()
Stops this stopwatch and resets the time to zero.
|
void |
restart()
Resets and starts this stopwatch.
|
void |
start()
Starts this stopwatch.
|
void |
stop()
Stops this stopwatch.
|
double |
time()
Returns the stopwatch time, in seconds.
|
public void start()
public void stop()
public void reset()
public void restart()
public double time()