Skip to content

Commit

Permalink
Merge pull request #7 from ug-cp/mohr
Browse files Browse the repository at this point in the history
fixes infinite loop in force_update (close #6)
  • Loading branch information
daniel-mohr authored Aug 2, 2023
2 parents 8045432 + 2d4880c commit 3d80786
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
author: Daniel Mohr
date: 2023-01-18
date: 2023-08-02
url: https://github.com/ug-cp/precise_sntp
license: BSD 3-Clause License
---
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=precise_sntp
version=0.2.4
version=0.2.5
author=Daniel Mohr <[email protected]>
maintainer=Daniel Mohr <[email protected]>
sentence=This library is an implementation of the Simple Network Time Protocol (SNTPv4) for the arduino platform providing sub-second precision.
Expand Down
7 changes: 5 additions & 2 deletions src/precise_sntp.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Author: Daniel Mohr
Date: 2022-12-15
Date: 2023-08-02
For more information look at the README.md.
Expand Down Expand Up @@ -196,7 +196,10 @@ uint8_t precise_sntp::force_update(bool use_transmit_timestamp) {
unsigned long start_waiting = millis();
int packetSize;
while (((packetSize = _udp->parsePacket()) != NTP_PACKET_SIZE) &&
(start_waiting + 1000)) {
(millis() - start_waiting < 1000)) {
// Wait until all data received. But wait maximal 1000 milliseconds.
// If millis overflows it is less 1000 milliseconds and
// otherwise it waits up to 1000 milliseconds for an answer.
}
if (packetSize != NTP_PACKET_SIZE) {
#ifdef PRECISE_SNTP_DEBUG
Expand Down

0 comments on commit 3d80786

Please sign in to comment.