Merge branch 'bugfix/esp_sntp_declare' into 'master'

lw-ip: Fix sntp custom options if sntp_get_system_time used

Closes FCS-710

See merge request espressif/esp-idf!14556
This commit is contained in:
David Čermák
2021-08-23 15:11:26 +00:00
3 changed files with 74 additions and 34 deletions

View File

@@ -117,3 +117,18 @@ bool sntp_restart(void)
}
return false;
}
void sntp_set_system_time(uint32_t sec, uint32_t us)
{
struct timeval tv = { .tv_sec = sec, .tv_usec = us };
sntp_sync_time(&tv);
}
void sntp_get_system_time(uint32_t *sec, uint32_t *us)
{
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
gettimeofday(&tv, NULL);
*(sec) = tv.tv_sec;
*(us) = tv.tv_usec;
sntp_set_sync_status(SNTP_SYNC_STATUS_RESET);
}