Skip to content

New Return Value to Distinguish "Non-update" from Successful Update #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bitsy
Copy link
Contributor

@bitsy bitsy commented Sep 17, 2019

Currently, update() returns false only when an update fails during the call to forceUpdate(). This behavior is potentially useful for debugging. However, two other things can happen during update(): a successful update and a "non-update" (when update() does not call forceUpdate() because the _updateInterval requirement has not been met). However, no distinction exists between a successful update and a non-update—both situations return true. Users have expressed interest in knowing whether are not a successful update has actually occurred (see Issue #55).

That being the case, I propose revising update() and forceUpdate() to return an 8-bit unsigned integer value rather than a boolean so that a failed update returns 0, a “non-update” returns 1, and a successful update returns 2. It maintains the current boolean behavior to avoid breaking other people’s implementations of the library yet also returns distinct values for both successful updates and non-updates.

The NTPClient method update() has been changed to only return "TRUE" after a successful update. The following conditions return "FALSE":
- Interval duration requirement not met
- forceUpdate() times out
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants