Skip to content
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

Tighten the Sensor.timestamp and latest reading["timestamp"] definitions #469

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

rakuco
Copy link
Member

@rakuco rakuco commented Aug 9, 2023

latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to #463.


Preview | Diff

@rakuco rakuco requested a review from reillyeon August 9, 2023 16:38
index.bs Outdated Show resolved Hide resolved
latest reading["timestamp"] was not defined strictly enough: the definition
mentioned "the time origin", which is a concept that only exists related to
a given environment settings object.

We now have it be an "unsafe current time" as defined by the High
Resolution Time specification, and its value is always set using the same
monotonic clock -- if we get a timestamp directly from a device sensor (e.g.
a WinRT timestamp relative to the Windows epoch) it needs to be translated
into a timestamp that makes sense with the monotonic clock.

Finally, Sensor.timestamp no longer just returns latest reading["timestamp"]
and instead ensures that whatever "unsafe current time" the latter returns
is coarsened and converted to a value relative to its relevant time origin.

Related to #463.
@rakuco rakuco merged commit c3cc3f5 into main Aug 10, 2023
1 check passed
@rakuco rakuco deleted the fix-timestamp-handling branch August 10, 2023 08:45
github-actions bot added a commit that referenced this pull request Aug 10, 2023
…ons (#469)

SHA: c3cc3f5
Reason: push, by rakuco

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
rakuco added a commit that referenced this pull request Feb 16, 2024
…ng null

This addresses a regression introduced by #469. The current algorithm
assumes that "get value from latest reading" never returns null, which is
not the case.

Return null when it does instead of passing an invalid value to "relative
high resolution time".
rakuco added a commit that referenced this pull request Feb 17, 2024
…ng null (#480)

This addresses a regression introduced by #469. The current algorithm
assumes that "get value from latest reading" never returns null, which is
not the case.

Return null when it does instead of passing an invalid value to "relative
high resolution time".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants