OSTimeGet
Description
Returns the current value of the system clock. Specifically, it returns a snapshot of the variable OSTickCtr
. The system clock is a counter of type OS_TICK
that counts the number of clock ticks since power was applied, or since OSTickCtr
was last set by OSTimeSet()
.
Files
os.h/os_time.c
Prototype
OS_TICK OSTimeGet (OS_ERR *p_err)
Arguments
p_err
is a pointer to a variable that contains an error code returned by this function.
OS_ERR_NONE
If the call was successful.
Returned Value
The current value of OSTickCtr
(in number of ticks).
Required Configuration
None
Callers
Application and ISRs.
Notes/Warnings
None
Example Usage
OSTimeGet() example usage
void TaskX (void *p_arg) { OS_TICK clk; OS_ERR err; while (DEF_ON) { : : clk = OSTimeGet(&err); /* Get current value of system clock */ /* Check "err" */ : : } }