Repository navigation
fix(sensors_plus): refresh iOS sensor timestamp conversion - #4014
Open
kristofferkarlsson93 wants to merge 2 commits into
Open
kristofferkarlsson93 wants to merge 2 commits into
kristofferkarlsson93 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The iOS implementation caches the offset between wall time and
systemUptimefor converting Core Motion timestamps to Unix microseconds. Uptime excludes system sleep, so this offset can become stale while the process remains alive. Subsequent timestamps can fall behind wall time, including after cancelling and restarting a subscription.This PR converts timestamps using the current clock pair at each native callback, preserving the measurement's age. The shared helper is used by motion sensors and the barometer before dispatch to the main queue. It also adds five deterministic Swift tests to the existing
RunnerTeststarget and runs them in iOS CI. The Dart API is unchanged.Validation
git diff --checkpassed.Environment: Flutter 3.47.7, Dart 3.13.5, Xcode 27.1.
Verification limits
Physical iPhone sleep/wake behavior has not been verified for this patch; the unit tests simulate sleep. Device verification should compare fresh samples before and after locking/resuming the same process, checking that
currentUptime - sensorTimestampremains a plausible sample age. This change does not reconstruct historical samples' original wall time across sleep.Related Issues
No existing issue linked.
Checklist
CHANGELOG.mdnor the plugin version inpubspec.yamlfiles.flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
!in the title as explained in Conventional Commits).