Other Parts Discussed in Thread: CC2650, SYSBIOS
I am reading the TI-RTOS Kernel v6.46 User's Guide. The default OS clock (on which you can schedule tasks, or get kernel time using kernel.Clock_getTicks()) seems to wrap (counter rolls over to 0) every 5 days (since it is 32-bit with a resolution of say 1mSec). Is there a longer running os clock with the same resolution that wraps less often? Say hundreds of years, for all practical purposes, never.
Is there a callback from the OS when the kernel clock wraps?
This example in the User's Guide seems flawed:
UInt32 time1, time2;
. . .
System_printf("task going to sleep for 10 ticks... \n");
time1 = Clock_getTicks();
Task_sleep(10);
time2 = Clock_getTicks();
System_printf("...awake! Delta time is: %lu\n", (ULong) (time2 - time1));
If the os clock wraps between time1 and time2, the difference is wrong: very large instead of small.
It seems simple enough to do. It should be similar to an example in TI literature that implements a long-running (64-bit?) wall-clock using a 32khz xtal timer. So my question is not HOW to do it, but whether it exists already. Or, whether there is a correct example for differencing os times that are asserted near in sidereal time, handling possible os clock wrap. Or using a combination of the seconds clock and the os clock?