lwip: Fix sntp custom options if sntp_get_system_time used

This commit is contained in:
David Cermak
2021-07-28 17:03:50 +02:00
committed by David Čermák
parent 0e956b5977
commit bb0eecee0e
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);
}