Stopwatch

org.beangle.commons.lang.time.Stopwatch
See theStopwatch companion object
class Stopwatch(val ticker: Ticker, immediately: Boolean)

Simple Stopwatch

Attributes

Since

3.0.0

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(immediately: Boolean)

Concrete methods

def elapsedMillis: Long

Returns the current elapsed time shown on this stopwatch, expressed in milliseconds, with any fraction rounded down. This is identical to elapsedTime(TimeUnit.MILLISECONDS.

Returns the current elapsed time shown on this stopwatch, expressed in milliseconds, with any fraction rounded down. This is identical to elapsedTime(TimeUnit.MILLISECONDS.

Attributes

def elapsedTime(desiredUnit: TimeUnit): Long

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.

Attributes

def reset(): Stopwatch

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.

Attributes

Returns

this Stopwatch instance

def start(): Stopwatch

Starts the stopwatch.

Starts the stopwatch.

Attributes

Returns

this Stopwatch instance

def stop(): Stopwatch

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.

Attributes

Returns

this Stopwatch instance

override def toString: String

Returns a string representation of the current elapsed time equivalent to toString(4) (four significant figures).

Returns a string representation of the current elapsed time equivalent to toString(4) (four significant figures).

Attributes

Definition Classes
Any

Concrete fields

var running: Boolean
val ticker: Ticker