#include <timers.h>
Public Member Functions | |
Timer () | |
Construct an untriggered timer set to the time of creation. | |
Timer (timeout_t offset) | |
Construct a triggered timer that expires at specified offset. | |
Timer (time_t offset) | |
Construct a triggered timer that expires at specified offset. | |
bool | isExpired (void) |
Check if timer expired. | |
bool | isUpdated (void) |
Check if timer has been updated since last check. | |
void | set (timeout_t expire) |
Set the timer to expire. | |
void | set (time_t expire) |
Set the timer to expire. | |
void | set (void) |
Set (update) the timer with current time. | |
void | clear (void) |
Clear pending timer, has no value. | |
timeout_t | get (void) |
Get remaining time until the timer expires. | |
timeout_t | operator* () |
Get remaining time until timer expires by reference. | |
bool | operator! () |
Check if timer has expired. | |
void | operator= (time_t expire) |
Set timer expiration. | |
void | operator= (timeout_t expire) |
Set timer expiration. | |
void | operator+= (time_t expire) |
Adjust timer expiration. | |
void | operator+= (timeout_t expire) |
Adjust timer expiration. | |
void | operator-= (time_t expire) |
Adjust timer expiration. | |
void | operator-= (timeout_t expire) |
Adjust timer expiration. | |
Static Public Member Functions | |
static void | sync (Timer &timer) |
Sleep current thread until the specified timer expires. | |
Static Public Attributes | |
static const timeout_t | inf |
A value to use for infinite time. | |
static const time_t | reset |
A value to use when resetting. | |
Friends | |
class | Conditional |
class | Semaphore |
class | Event |
The timer generally uses millisecond values but has a microsecond accuracy. On platforms that support it, the timer uses posix realtime monotonic clock extensions, otherwise lower accuracy timer systems might be used.
Definition at line 49 of file timers.h.
ucc::Timer::Timer | ( | timeout_t | offset | ) |
Construct a triggered timer that expires at specified offset.
offset | to expire in milliseconds. |
ucc::Timer::Timer | ( | time_t | offset | ) |
Construct a triggered timer that expires at specified offset.
offset | to expire in seconds. |
timeout_t ucc::Timer::get | ( | void | ) |
Get remaining time until the timer expires.
Reimplemented in ucc::TimerQueue::event.
bool ucc::Timer::isExpired | ( | void | ) |
bool ucc::Timer::isUpdated | ( | void | ) |
Check if timer has been updated since last check.
bool ucc::Timer::operator! | ( | ) |
Check if timer has expired.
timeout_t ucc::Timer::operator* | ( | ) | [inline] |
void ucc::Timer::operator+= | ( | timeout_t | expire | ) |
Adjust timer expiration.
expire | time to add in milliseconds. |
void ucc::Timer::operator+= | ( | time_t | expire | ) |
Adjust timer expiration.
expire | time to add in seconds. |
void ucc::Timer::operator-= | ( | timeout_t | expire | ) |
Adjust timer expiration.
expire | time to subtract in milliseconds. |
void ucc::Timer::operator-= | ( | time_t | expire | ) |
Adjust timer expiration.
expire | time to subtract in seconds. |
void ucc::Timer::operator= | ( | timeout_t | expire | ) |
Set timer expiration.
expire | timer in milliseconds. |
void ucc::Timer::operator= | ( | time_t | expire | ) |
Set timer expiration.
expire | timer in specified seconds. |
void ucc::Timer::set | ( | time_t | expire | ) |
Set the timer to expire.
expire | time in seconds. |
void ucc::Timer::set | ( | timeout_t | expire | ) |
Set the timer to expire.
expire | time in milliseconds. |
static void ucc::Timer::sync | ( | Timer & | timer | ) | [static] |
Sleep current thread until the specified timer expires.
timer | to reference for sleep. |