Provides a timer mechanism. More...
Public Member Functions | |
timer (const duration t=duration::zero()) noexcept | |
void | reset (void) noexcept |
void | reset (const duration t) noexcept |
Resets this timer and sets a different timeout. | |
bool | expired (const time_point t=now()) const noexcept |
Returns if the timer is expired. | |
duration | remaining (void) const noexcept |
Returns the time until timer::expired()==true in milliseconds. | |
Static Public Member Functions | |
static time_point | now (void) noexcept |
Returns the current time. | |
Public Types | |
using | duration = std::chrono::milliseconds |
using | time_point = typename Clock::time_point |
Provides a timer mechanism.
The caller has to start the timer and check at regular intervals if it expired. It is assumed that it has milliseconds accuracy but it is not guaranteed that it will expire at the exact timeout.