Dart API Referencedart:coreStopwatch

Stopwatch Interface

A simple Stopwatch interface to measure elapsed time.

Default class

StopwatchImplementation

Implemented by

StopwatchImplementation

Constructors

Code new Stopwatch() #

Creates a Stopwatch in stopped state with a zero elapsed count.

Stopwatch();

Code new Stopwatch.start() #

Creates a Stopwatch in started state with a zero elapsed count.

Stopwatch.start();

Methods

Code int elapsed() #

Returns the elapsed number of clock ticks since calling start while the Stopwatch is running. Returns the elapsed number of clock ticks between calling start and calling stop. Returns 0 if the Stopwatch has never been started. The elapsed number of clock ticks increases by frequency every second.

int elapsed();

Code int elapsedInMs() #

Returns the elapsed counter converted to milliseconds.

int elapsedInMs();

Code int elapsedInUs() #

Returns the elapsed counter converted to microseconds.

int elapsedInUs();

Code int frequency() #

Returns the frequency of the elapsed counter in Hz.

int frequency();

Code void reset() #

Resets the elapsed count to zero. This method does not stop or start the Stopwatch.

void reset();

Code void start() #

Starts the Stopwatch. The elapsed count is increasing monotonically. If the Stopwatch has been stopped, then calling start again restarts it without resetting the elapsed count. If the Stopwatch is currently running, then calling start does nothing.

void start();

Code void stop() #

Stops the Stopwatch. The elapsed count stops increasing. If the Stopwatch is currently not running, then calling stop does nothing.

void stop();