Skip to content

Conversation

@jbrown123
Copy link
Contributor

@jbrown123 jbrown123 commented Jan 12, 2019

This fixes issue #49 where the clock is randomly delayed.

The bug is that a response that comes back after the timeout delay is held in the receive buffer until the next update request. That update sends a new request, but processes the OLD response sitting in the buffer. This cycle repeats indefinitely as each new request places a response in the buffer that will be consumed on the NEXT update cycle.

This can easily be verified / recreated by making the sendNTPPacket method public and calling it immediately after a call to update. Then wait for some time (a few seconds or several minutes, depending on the update interval) and then make another request to update (or forceUpdate). The newly updated time will be the OLD time from the response to the extra sendNTPPacket. All subsequent requests will be off by one update interval unless and until a response packet is actually not sent.

The fix is to flush any queued responses before sending the new request. This is what the pull request accomplishes.

@aentinger aentinger merged commit 18d4ac7 into arduino-libraries:master Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants