NTPClient
NTPClient copied to clipboard
New Return Value to Distinguish "Non-update" from Successful Update
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.