Simple Stopwatch
- Since
3.0.0
- Companion
- object
Value members
Constructors
Concrete methods
Returns the current elapsed time shown on this stopwatch, expressed in milliseconds, with any fraction rounded down. This is identical to <code>elapsedTime(TimeUnit.MILLISECONDS</code>.
Returns the current elapsed time shown on this stopwatch, expressed in milliseconds, with any fraction rounded down. This is identical to <code>elapsedTime(TimeUnit.MILLISECONDS</code>.
Returns the current elapsed time shown on this stopwatch, expressed in the desired time unit, with any fraction rounded down.
Returns the current elapsed time shown on this stopwatch, expressed in the desired time unit, with any fraction rounded down.
Note that the overhead of measurement can be more than a microsecond, so it is generally not
useful to specify [[TimeUnit#NANOSECONDS]]
precision here.
Sets the elapsed time for this stopwatch to zero, and places it in a stopped state.
Sets the elapsed time for this stopwatch to zero, and places it in a stopped state.
- Returns
this <code>Stopwatch</code> instance
Starts the stopwatch.
Starts the stopwatch.
- Returns
this <code>Stopwatch</code> instance
- Throws
- IllegalStateException
if the stopwatch is already running.
Stops the stopwatch. Future reads will return the fixed duration that had elapsed up to this point.
Stops the stopwatch. Future reads will return the fixed duration that had elapsed up to this point.
- Returns
this <code>Stopwatch</code> instance
- Throws
- IllegalStateException
if the stopwatch is already stopped.