From f220e15afec39a647ac024bf337cf65b16de92d6 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Wed, 24 Feb 2021 19:35:53 +0100 Subject: [PATCH] sntp problem --- cube/User/Src/wizHelper.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cube/User/Src/wizHelper.c b/cube/User/Src/wizHelper.c index 2e9cd52..642bab0 100644 --- a/cube/User/Src/wizHelper.c +++ b/cube/User/Src/wizHelper.c @@ -142,12 +142,13 @@ uint64_t wizSntpQuery() { uint8_t ntpServer[4]; if (wizDnsQuery(config->ntpServer, ntpServer)) { SNTP_init(SNTP_SOCK, ntpServer, 0, sntpBuffer); - for (uint8_t i = 0; i < 16; i++) { + uint32_t cycles = 0; + while (1) { + cycles++; datetime curTime; - int8_t res = SNTP_run(&curTime); - if (res == 1) { + if (1 == SNTP_run(&curTime)) { seconds = curTime.seconds - UNIX_NTP_EPOCH_DIFF; - coloredMsg(LOG_BLUE, "wizsq, curTime: %lu", seconds); + coloredMsg(LOG_BLUE, "wizsq, curTime: %lu, cycles: %lu", seconds, cycles); break; } }