This commit is contained in:
Wolfgang Hottgenroth 2021-02-16 11:06:45 +01:00
parent b3b1908480
commit 12626941ce
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -134,7 +134,6 @@ bool wizDnsQuery(char *name, uint8_t *ip) {
uint64_t wizSntpQuery() {
bool success = false;
uint64_t seconds = 0;
if (networkAvailable) {
@ -143,20 +142,17 @@ uint64_t wizSntpQuery() {
uint8_t ntpServer[4];
if (wizDnsQuery(config->ntpServer, ntpServer)) {
SNTP_init(SNTP_SOCK, ntpServer, 0, sntpBuffer);
bool updated = false;
for (uint8_t i = 0; i < 16; i++) {
datetime curTime;
int8_t res = SNTP_run(&curTime);
if (res == 1) {
seconds = curTime.seconds - UNIX_NTP_EPOCH_DIFF;
updated = true;
success = true;
coloredMsg(LOG_BLUE, "wizsq, curTime: %lu", seconds);
break;
}
}
if (! updated) {
if (seconds == 0) {
coloredMsg(LOG_BLUE, "wizsq, time update failed");
}
} else {