Home
Base module

Stopwatch

A simple facility to measure time intervals with microsecond resolution.

Stopwatch

#include <icy/datetime.h>
class Stopwatch

Defined in src/base/include/icy/datetime.h:1733

A simple facility to measure time intervals with microsecond resolution.

The Stopwatch uses the current system time, so if the system time changes the measured time will be incorrect.

List of all members

NameKindOwner
StopwatchfunctionDeclared here
~StopwatchfunctionDeclared here
startfunctionDeclared here
stopfunctionDeclared here
resetfunctionDeclared here
restartfunctionDeclared here
elapsedfunctionDeclared here
elapsedSecondsfunctionDeclared here
elapsedMillisecondsfunctionDeclared here
resolutionfunctionDeclared here
_startvariableDeclared here
_elapsedvariableDeclared here
_runningvariableDeclared here
StopwatchfunctionDeclared here
operator=functionDeclared here

Public Methods

ReturnNameDescription
Stopwatch
voidstartStarts (or restarts) the stopwatch.
voidstopStops or pauses the stopwatch.
voidresetResets the stopwatch.
voidrestartResets and starts the stopwatch.
Timestamp::TimeDiffelapsed constReturns the elapsed time in microseconds since the stopwatch started.
intelapsedSeconds constReturns the number of seconds elapsed since the stopwatch started.
intelapsedMilliseconds constReturns the number of milliseconds elapsed since the stopwatch started.

Stopwatch

Stopwatch()

Defined in src/base/include/icy/datetime.h:1736


start

void start()

Defined in src/base/include/icy/datetime.h:1740

Starts (or restarts) the stopwatch.


stop

void stop()

Defined in src/base/include/icy/datetime.h:1743

Stops or pauses the stopwatch.


reset

void reset()

Defined in src/base/include/icy/datetime.h:1746

Resets the stopwatch.


restart

void restart()

Defined in src/base/include/icy/datetime.h:1749

Resets and starts the stopwatch.


elapsed

const

Timestamp::TimeDiff elapsed() const

Defined in src/base/include/icy/datetime.h:1753

Returns the elapsed time in microseconds since the stopwatch started.


elapsedSeconds

const

int elapsedSeconds() const

Defined in src/base/include/icy/datetime.h:1757

Returns the number of seconds elapsed since the stopwatch started.


elapsedMilliseconds

const

int elapsedMilliseconds() const

Defined in src/base/include/icy/datetime.h:1761

Returns the number of milliseconds elapsed since the stopwatch started.

Public Static Methods

ReturnNameDescription
Timestamp::TimeValresolution staticReturns the resolution of the stopwatch.

resolution

static

static Timestamp::TimeVal resolution()

Defined in src/base/include/icy/datetime.h:1764

Returns the resolution of the stopwatch.

Private Attributes

ReturnNameDescription
Timestamp_start
Timestamp::TimeDiff_elapsed
bool_running

_start

Timestamp _start

Defined in src/base/include/icy/datetime.h:1770


_elapsed

Timestamp::TimeDiff _elapsed

Defined in src/base/include/icy/datetime.h:1771


_running

bool _running

Defined in src/base/include/icy/datetime.h:1772

Private Methods

ReturnNameDescription
StopwatchDeleted constructor.

Stopwatch

Stopwatch(const Stopwatch &) = delete

Defined in src/base/include/icy/datetime.h:1767

Deleted constructor.