From 348058b00ea7f022e8f7833ee76553d2a5ada7f4 Mon Sep 17 00:00:00 2001 From: Tomas Jakstas Date: Sun, 22 Mar 2020 12:27:38 +0200 Subject: [PATCH] check return value before timeout --- NTPClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NTPClient.cpp b/NTPClient.cpp index 61a4115..23d9aa1 100755 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -99,7 +99,7 @@ bool NTPClient::forceUpdate(uint16_t timeout) { do { delay ( 10 ); cb = this->_udp->parsePacket(); - if (millis() - current > timeout) return false; // timeout after 1000 ms + if (cb == 0 && millis() - current > timeout) return false; } while (cb == 0); this->_lastUpdate = millis() - (10 * (timeout + 1)); // Account for delay in reading the time