Skip to content

Commit 3d80786

Browse files
authored
Merge pull request #7 from ug-cp/mohr
fixes infinite loop in force_update (close #6)
2 parents 8045432 + 2d4880c commit 3d80786

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
author: Daniel Mohr
3-
date: 2023-01-18
3+
date: 2023-08-02
44
url: https://github.com/ug-cp/precise_sntp
55
license: BSD 3-Clause License
66
---

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=precise_sntp
2-
version=0.2.4
2+
version=0.2.5
33
author=Daniel Mohr <daniel.mohr@uni-greifswald.de>
44
maintainer=Daniel Mohr <daniel.mohr@uni-greifswald.de>
55
sentence=This library is an implementation of the Simple Network Time Protocol (SNTPv4) for the arduino platform providing sub-second precision.

src/precise_sntp.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Author: Daniel Mohr
3-
Date: 2022-12-15
3+
Date: 2023-08-02
44
55
For more information look at the README.md.
66
@@ -196,7 +196,10 @@ uint8_t precise_sntp::force_update(bool use_transmit_timestamp) {
196196
unsigned long start_waiting = millis();
197197
int packetSize;
198198
while (((packetSize = _udp->parsePacket()) != NTP_PACKET_SIZE) &&
199-
(start_waiting + 1000)) {
199+
(millis() - start_waiting < 1000)) {
200+
// Wait until all data received. But wait maximal 1000 milliseconds.
201+
// If millis overflows it is less 1000 milliseconds and
202+
// otherwise it waits up to 1000 milliseconds for an answer.
200203
}
201204
if (packetSize != NTP_PACKET_SIZE) {
202205
#ifdef PRECISE_SNTP_DEBUG

0 commit comments

Comments
 (0)