ge211
Pausable_timer Class Reference

Detailed Description

A class for timing intervals while supporting pausing.

Definition at line 291 of file ge211_time.h.

Public Member Functions

 Pausable_timer (bool start_paused=false)
 Constructs a new pausable timer. More...
 
bool is_paused () const
 Checks whether the timer is currently paused.
 
Duration elapsed_time () const
 The elapsed time since the start or most recent reset, not counting paused times.
 
Duration pause ()
 Pauses the timer. More...
 
void resume ()
 Unpauses the timer. If the timer is already running, has no effect.
 
Duration reset ()
 Resets the timer, returning the elapsed time since starting or the most recent reset(). More...
 

Constructor & Destructor Documentation

◆ Pausable_timer()

Pausable_timer ( bool  start_paused = false)
inlineexplicit

Constructs a new pausable timer.

The timer is started running by default, but can be started paused by passing true.

Definition at line 296 of file ge211_time.h.

Member Function Documentation

◆ pause()

Duration pause ( )
inline

Pauses the timer.

If the timer is already paused, has no effect. In either case, the elapsed time thus far is saved, and can be queried with elapsed_time() const, or will continue to accumulate if we unpause().

Definition at line 328 of file ge211_time.h.

◆ reset()

Duration reset ( )
inline

Resets the timer, returning the elapsed time since starting or the most recent reset().

Leaves the pause state unchanged.

Definition at line 349 of file ge211_time.h.


The documentation for this class was generated from the following file: