PR #51 attempted to fix an issue where the local cache was not cleared after a device reboot, but it overlooked another edge case.
If the user calls syncInBackground before getCurrentTime, the SntpService.state variable will be set to State.SYNCING. As a result, the isCachedFromPreviousBoot check always evaluates to false while the sync is in progress. This creates a short window (a few seconds) during which getCurrentTime may return an incorrectly computed time based on a stale local cache.
Additionally, PR #51 removes State.INIT, which introduces another issue described in #61, where the local cache is cleared every time the user manually changes the system time.
PR #51 attempted to fix an issue where the local cache was not cleared after a device reboot, but it overlooked another edge case.
If the user calls
syncInBackgroundbeforegetCurrentTime, theSntpService.statevariable will be set toState.SYNCING. As a result, theisCachedFromPreviousBootcheck always evaluates to false while the sync is in progress. This creates a short window (a few seconds) during whichgetCurrentTimemay return an incorrectly computed time based on a stale local cache.Additionally, PR #51 removes
State.INIT, which introduces another issue described in #61, where the local cache is cleared every time the user manually changes the system time.