removed workaround for sntp, not needed any more becuase init is done properly
This commit is contained in:
parent
7f8966203f
commit
3324e61d9f
1 changed files with 2 additions and 7 deletions
|
@ -65,7 +65,7 @@ void sntp_initialize(const struct timezone *tz) {
|
||||||
}
|
}
|
||||||
sntp_base = 0;
|
sntp_base = 0;
|
||||||
// To avoid div by 0 exceptions if requesting time before SNTP config
|
// To avoid div by 0 exceptions if requesting time before SNTP config
|
||||||
cal = 1;
|
cal = sdk_system_rtc_clock_cali_proc();
|
||||||
tim_ref = TIMER_COUNT;
|
tim_ref = TIMER_COUNT;
|
||||||
sntp_sem = xSemaphoreCreateMutex();
|
sntp_sem = xSemaphoreCreateMutex();
|
||||||
assert(sntp_sem != NULL);
|
assert(sntp_sem != NULL);
|
||||||
|
@ -96,12 +96,7 @@ int _gettimeofday_r(struct _reent *r, struct timeval *tp, void *tzp) {
|
||||||
// So it looks like it is not used. Also check tp is not NULL
|
// So it looks like it is not used. Also check tp is not NULL
|
||||||
if (tzp || !tp) return EINVAL;
|
if (tzp || !tp) return EINVAL;
|
||||||
|
|
||||||
if (sntp_base == 0) {
|
uint64_t base = sntp_get_rtc_time();
|
||||||
printf("Time not valid yet\n");
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t base = sntp_get_rtc_time();
|
|
||||||
|
|
||||||
tp->tv_sec = base / 1000000U;
|
tp->tv_sec = base / 1000000U;
|
||||||
tp->tv_usec = base % 1000000U;
|
tp->tv_usec = base % 1000000U;
|
||||||
|
|
Loading…
Reference in a new issue