Base module
Stopwatch
A simple facility to measure time intervals with microsecond resolution.
Stopwatch
#include <icy/datetime.h>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.
Public Methods
| Return | Name | Description |
|---|---|---|
Stopwatch | ||
void | start | Starts (or restarts) the stopwatch. |
void | stop | Stops or pauses the stopwatch. |
void | reset | Resets the stopwatch. |
void | restart | Resets and starts the stopwatch. |
Timestamp::TimeDiff | elapsed const | Returns the elapsed time in microseconds since the stopwatch started. |
int | elapsedSeconds const | Returns the number of seconds elapsed since the stopwatch started. |
int | elapsedMilliseconds const | Returns the number of milliseconds elapsed since the stopwatch started. |
Stopwatch
Stopwatch()start
void start()Starts (or restarts) the stopwatch.
stop
void stop()Stops or pauses the stopwatch.
reset
void reset()Resets the stopwatch.
restart
void restart()Resets and starts the stopwatch.
elapsed
const
Timestamp::TimeDiff elapsed() constReturns the elapsed time in microseconds since the stopwatch started.
elapsedSeconds
const
int elapsedSeconds() constReturns the number of seconds elapsed since the stopwatch started.
elapsedMilliseconds
const
int elapsedMilliseconds() constReturns the number of milliseconds elapsed since the stopwatch started.
Public Static Methods
| Return | Name | Description |
|---|---|---|
Timestamp::TimeVal | resolution static | Returns the resolution of the stopwatch. |
resolution
static
static Timestamp::TimeVal resolution()Returns the resolution of the stopwatch.
Private Attributes
_start
Timestamp _start_elapsed
Timestamp::TimeDiff _elapsed_running
bool _runningPrivate Methods
| Return | Name | Description |
|---|---|---|
Stopwatch | Deleted constructor. |
Stopwatch
Stopwatch(const Stopwatch &) = deleteDeleted constructor.
