Skip to content

KronosClock returns stale cached time after device reboot if syncInBackground is called before getCurrentTime #67

@varahash

Description

@varahash

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions