#include <timing.h>
Public Attributes | |
Timer *(* | start )(uint64_t start, uint16_t interval, void(*function)(void *), void *arg) |
Start a timer which executes the given function at the given interval. | |
void(* | update )(Timer *timer, uint16_t interval) |
Update a timer interval. | |
void(* | cancel )(Timer *timer) |
Cancel (stop) a timer. | |
int64_t(* | now )(void) |
Return the current time in milliseconds since the epoch. |
Definition at line 22 of file timing.h.
void(* timing::cancel)(Timer *timer) |
Cancel (stop) a timer.
Will cause function invocation to immediately cease, and may result in the immediate deallocation of any resources associated with the given timer handle. Thus, a timer handle is unsafe to use after cancelling.
timer | Opaque timer handle. |
int64_t(* timing::now)(void) |
Return the current time in milliseconds since the epoch.
Timer*(* timing::start)(uint64_t start, uint16_t interval, void(*function)(void *), void *arg) |
Start a timer which executes the given function at the given interval.
Timers execute a given function periodically at a given interval, with an optional start delay for the first invocation. Will continue indefinitely until cancelled. The interval (period) can be modified at any time during timer execution.
start | Absolute start time in milliseconds since the epoch. If greater than "now", timer start will be delayed until this time. | |
interval | Interval in milliseconds between periodic invocations of the given function. | |
function | Function to execute whenever the timer interval is reached. | |
arg | Opaque pointer which will be given to the function as an argument whenever it is executed. |
void(* timing::update)(Timer *timer, uint16_t interval) |
Update a timer interval.
While a timer is running, its interval can be changed at any time. Such a request will be realized either in the current or next period, depending on implementation and feasibility (i.e. the current period may be shortened or lengthened, or it may proceed for the length of the old interval. The next period is guaranteed to last the newly specified interval in all cases).
timer | Opaque timer handle. | |
interval | Requested new interval in milliseconds. |