From 3324e61d9fcf463092346efce52676ad957bdb1a Mon Sep 17 00:00:00 2001 From: Rutger Huijgen Date: Sat, 25 Apr 2020 20:03:04 +0200 Subject: [PATCH] removed workaround for sntp, not needed any more becuase init is done properly --- extras/sntp/sntp_fun.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/extras/sntp/sntp_fun.c b/extras/sntp/sntp_fun.c index d677c07..60a749b 100644 --- a/extras/sntp/sntp_fun.c +++ b/extras/sntp/sntp_fun.c @@ -65,7 +65,7 @@ void sntp_initialize(const struct timezone *tz) { } sntp_base = 0; // 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; sntp_sem = xSemaphoreCreateMutex(); 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 if (tzp || !tp) return EINVAL; - if (sntp_base == 0) { - printf("Time not valid yet\n"); - return EINVAL; - } - - uint64_t base = sntp_get_rtc_time(); + uint64_t base = sntp_get_rtc_time(); tp->tv_sec = base / 1000000U; tp->tv_usec = base % 1000000U;