Package nl.colorize.util
Class Stopwatch
java.lang.Object
nl.colorize.util.Stopwatch
A timer with millisecond precision. Although the timer granularity
is in milliseconds, the timer resolution is dependent on the
platform and might be more than 1 millisecond. Depending on the platform,
either
System.currentTimeMillis()
or System.nanoTime()
will
be used for the underlying timer.
This class is not thread safe, Stopwatch
instances should not be
shared between multiple threads.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Stopwatch
public Stopwatch()
-
-
Method Details
-
value
public long value()Returns the current value of the underlying timer. Although the absolute value is meaningless, multiple invocations of this method can be compared against each other to determine the elapsed time. -
tick
public long tick()Marks this point in time. Callingtock()
will return the time relative to this point. Returns the interval between now and the previous tick, in milliseconds. -
tock
public long tock()Returns the time since the lasttick()
, but does not set a new tick. Returns the interval between now and the previous tick, in milliseconds.
-