TiROS operates with high-resolution time. Sleep and timeouts are specified in absolute or relative time (using the O_RELATIVE_TIME option). Time is represented using the trtime_t structure. This structure consists of two elements:
Functions | |
void | os_time_get (trtime_t *curr_time) |
int8_t | os_time_set (const trtime_t *new_time) |
int8_t | os_wake_at (const trtime_t *wake_time, uint8_t options) |
void os_time_get | ( | trtime_t * | curr_time | ) |
Get the current time.
Calling Context:
[out] | curr_time | Pointer to structure where the time should be stored. |
Set the current time.
This sets the current time. This has to be used with care. This can affect tasks that have been sleeping or waiting for a lock. Such tasks will be woken up if the new time set is beyond their wakeup deadline. This system call may not be possible on some hardware ports.
Calling Context:
To set the time before the os has started use the hal_time_set function directly, which is supplied by the hardware port.
new_time | Pointer to structure with the new time. |
Wake the invoking task at a specific time.
The task can be woken up earlier by an explicit resume. The task is not allowed to sleep if it holds a mutex lock. This call is not allowed from an ISR.
Calling Context:
[in] | wake_time | Time at which to be woken up. |
options | Default is absolute time. For relative time, set O_RELATIVE_TIME. |