Merge pull request #62 from jbrown123/master

Added packet flush before request in forceUpdate(). Fixes issue #49 - random clock delay
This commit is contained in:
Alexander Entinger 2019-09-19 08:38:46 +02:00 committed by GitHub
commit 18d4ac7eb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,6 +65,10 @@ bool NTPClient::forceUpdate() {
Serial.println("Update from NTP Server"); Serial.println("Update from NTP Server");
#endif #endif
// flush any existing packets
while(this->_udp->parsePacket() != 0)
this->_udp->flush();
this->sendNTPPacket(); this->sendNTPPacket();
// Wait till data is there or timeout... // Wait till data is there or timeout...