#include <icy/timeout.h>Subclassed by:
TimedToken
Timeout counter which expires after a given delay. Delay is specified in milliseconds.
| Return | Name | Description |
|---|---|---|
Timeout | Constructs a Timeout with the given delay. | |
Timeout | Copy constructor. | |
Timeout | Defaulted constructor. | |
bool | running const | Returns true if the timer is currently running. |
void | start | Starts (or restarts) the timer, recording the current time as the start point. |
void | stop | Stops the timer without resetting it. expired() will return false after this call. |
void | reset | Restarts the timer from now, equivalent to calling start(). |
long | remaining const | Returns the number of milliseconds remaining before expiry. Returns 0 if already expired, or the full delay if not running. |
bool | expired const | Returns true if the timer is running and the delay has fully elapsed. |
void | setDelay inline | Sets the expiry delay without restarting the timer. |
long | delay const inline | Returns the configured delay in milliseconds. |
Timeout & | operator= | Copy assignment operator. |
Timeout(long delay, bool autoStart)Constructs a Timeout with the given delay.
delay Expiry duration in milliseconds (default: 0).
autoStart If true, starts the timer immediately on construction.
Timeout(const Timeout & src)Copy constructor.
src Source Timeout to copy state from.Timeout(Timeout && src) = defaultDefaulted constructor.
const
bool running() constReturns true if the timer is currently running.
true if start() has been called and stop() has not.
void start()Starts (or restarts) the timer, recording the current time as the start point.
void stop()Stops the timer without resetting it. expired() will return false after this call.
void reset()Restarts the timer from now, equivalent to calling start().
const
long remaining() constReturns the number of milliseconds remaining before expiry. Returns 0 if already expired, or the full delay if not running.
Milliseconds until expiry.
const
bool expired() constReturns true if the timer is running and the delay has fully elapsed.
true if expired, false if stopped or not yet elapsed.
inline
inline void setDelay(long delay)Sets the expiry delay without restarting the timer.
delay New delay in milliseconds.const inline
inline long delay() constReturns the configured delay in milliseconds.
Delay in milliseconds.
Timeout & operator=(const Timeout & src)Copy assignment operator.
src Source Timeout to copy state from.std::chrono::steady_clock::time_point _startAtlong _delaybool _running