Skip to content

Commit 841c965

Browse files
committed
Add handling for NTP server returning 0
Fixes #193, fixes 84, fixes Credits to @frankB415 for the Code in Issue #193!
1 parent 0d7162f commit 841c965

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: NTPClient.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ bool NTPClient::forceUpdate() {
112112
// this is NTP time (seconds since Jan 1 1900):
113113
unsigned long secsSince1900 = highWord << 16 | lowWord;
114114

115+
if (secsSince1900 == 0 ) {
116+
return false;
117+
}
118+
115119
this->_currentEpoc = secsSince1900 - SEVENZYYEARS;
116120

117121
return true; // return true after successful update

0 commit comments

Comments
 (0)