From 841c965c20c2d55b961ea3a38cf8a1c6b9e68979 Mon Sep 17 00:00:00 2001 From: Der-Schubi Date: Sun, 23 Jun 2024 14:20:39 +0200 Subject: [PATCH] Add handling for NTP server returning 0 Fixes #193, fixes 84, fixes Credits to @frankB415 for the Code in Issue #193! --- NTPClient.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NTPClient.cpp b/NTPClient.cpp index b435855..f73dca0 100755 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -112,6 +112,10 @@ bool NTPClient::forceUpdate() { // this is NTP time (seconds since Jan 1 1900): unsigned long secsSince1900 = highWord << 16 | lowWord; + if (secsSince1900 == 0 ) { + return false; + } + this->_currentEpoc = secsSince1900 - SEVENZYYEARS; return true; // return true after successful update