- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
All the functions in WICED/internal/time.c doesn't handle the case when the timer is overflown. Be careful. I'd suggest writing your own time functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your statement is not clear. Can you please explain with detail how the timer is overflown?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Axel
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???
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
-Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.