Your statement is not clear. Can you please explain with detail how the timer is overflown?
1 of 2 people found this helpful
We do not see any problem of timer overflow in time.c. You can use wiced_time_set_utc_time_ms() to set UTC time in milliseconds, which uses data type of uint64_t. You can use wiced_time_get_iso8601_time() to get the UTC time in iso 8601 format.
The bug is real, unfortunately you don't see the problem.
Try create 2 threads and make them just print the timestamp in a endless loop.
Make the device run several hours (or days) then you will be surprised by the timestamp output.
Would be really helpful for me when you upload a complete project here. Is the problem related to "two threads"? Anything not quite Thread-safe???
The functions wiced_time_get_* are not thread safe. You'll need to synchronize it or just avoid using it across threads... The root of the problem is that the function wiced_time_get_utc_time_ms is not immutable. If two threads call that function at the same time the results can be very unpredictable.
2 of 2 people found this helpful
The problem with the overflow is simple - review the source. The UTC time is set by adding a delta based on the tick timer difference from the last time the UTC get time was called. If the tick timer overflows (47.2 Days) then the results will be wrong.
Regarding non-thread safe, we see the same issue and will be making a patch.