sntp: fix the handling of the rtc counter wrapping
This reworks the accounting of the time to address the wrapping of the rtc counter. It currently assumes that the time is accessed more frequently than the counter would wrap. It also adds a semaphore to synchronize access to the time storage.
This commit is contained in:
parent
15964efc0f
commit
59ee3d5975
2 changed files with 63 additions and 62 deletions
|
|
@ -61,10 +61,9 @@ int sntp_set_servers(char *server_url[], int num_servers);
|
|||
void sntp_set_update_delay(uint32_t ms);
|
||||
|
||||
/*
|
||||
* Returns the time read from RTC counter, in seconds from Epoch. If
|
||||
* us is not null, it will be filled with the microseconds.
|
||||
* Returns the time read from RTC counter, in micro seconds from Epoch.
|
||||
*/
|
||||
time_t sntp_get_rtc_time(int32_t *us);
|
||||
uint64_t sntp_get_rtc_time();
|
||||
|
||||
/*
|
||||
* Update RTC timer. This function is called by the SNTP module each time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue