cvedia::rt::IdleTimer¶
#include <idle_timer.h>
Public Functions¶
| Name | |
|---|---|
| IdleTimer(int timeoutSeconds =30) Construct with a timeout in seconds. Records the current time immediately. |
|
| void | touch() Record activity at the current wall-clock time. |
| void | touchAt(int64_t epochMs) Record activity at an explicit epoch-millisecond timestamp (for testing). |
| bool | isExpired() const Check whether the timeout has elapsed since the last touch (wall-clock). |
| bool | isExpiredAt(int64_t epochMs) const Check expiry against an explicit epoch-millisecond timestamp (for testing). |
| void | setTimeoutSeconds(int seconds) |
| int | getTimeoutSeconds() const |
| int64_t | getLastActivityMs() const Return the last recorded activity as epoch milliseconds. |
Detailed Description¶
class cvedia::rt::IdleTimer;
Lightweight, thread-safe idle timer. Tracks time since last touch() and reports expiry via isExpired(). A timeout of 0 (or negative) disables expiry detection.
Public Functions Documentation¶
function IdleTimer¶
inline explicit IdleTimer(
int timeoutSeconds =30
)
Construct with a timeout in seconds. Records the current time immediately.
function touch¶
inline void touch()
Record activity at the current wall-clock time.
function touchAt¶
inline void touchAt(
int64_t epochMs
)
Record activity at an explicit epoch-millisecond timestamp (for testing).
function isExpired¶
inline bool isExpired() const
Check whether the timeout has elapsed since the last touch (wall-clock).
function isExpiredAt¶
inline bool isExpiredAt(
int64_t epochMs
) const
Check expiry against an explicit epoch-millisecond timestamp (for testing).
function setTimeoutSeconds¶
inline void setTimeoutSeconds(
int seconds
)
function getTimeoutSeconds¶
inline int getTimeoutSeconds() const
function getLastActivityMs¶
inline int64_t getLastActivityMs() const
Return the last recorded activity as epoch milliseconds.