Skip to content

Commit

Permalink
timestamp: Redefine timestamp in Data delivery (#274)
Browse files Browse the repository at this point in the history
Use more precise terms from the HR-TIME spec to define what
`PressureRecord.time` is relative to:
- Any timestamp value obtained from the platform is converted
  to an unsafe moment from the monotonic clock.
- PressureRecord.[[Time]] converts it into a coarsened time relative
  to its global's origin.

Fixes #257
  • Loading branch information
arskama authored Jun 7, 2024
1 parent bb6a3d7 commit 1b8a56c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1129,17 +1129,27 @@ <h3>Data delivery</h3>
</li>
<li>
Let |state:PressureState| be an [=adjusted pressure state=] given |data| and |source|.
</li>
<li>
Let |timestamp:DOMHighResTimeStamp| be a timestamp representing the time the |data| was
obtained from the |relevantGlobal|'s [=platform collector=].
<aside class="note">
The |data| sample and mapping between |data| sample, and [=pressure states=],
is [=implementation-defined=] and may use many different metrics. For instance,
for CPU, it might consider processor frequency and utilization, as well
as thermal conditions.
</aside>
</li>
<li>
Let |timestamp| be a platform-specific timestamp converted in an [=implementation-defined=]
way to an [=monotonic clock/unsafe current time=] using the same [=monotonic clock=]
that is shared by [=environment settings object/time origins=].
<aside class="note">
The goal of this step is to ensure that a timestamp that may have been relative to
a different time origin is converted to a value that can be used in computations with
the same [=monotonic clock=] used by the operations described in [[HR-TIME]].
</aside>
</li>
<li>
Let |timeValue| be the [=relative high resolution time=] based on |timestamp| and
|relevantGlobal|.
</li>
<li>
[=list/For each=] |observer:PressureObserver| in |relevantGlobal|'s
[=registered observer list=] for |source|:
Expand All @@ -1160,7 +1170,7 @@ <h3>Data delivery</h3>
Let |record:PressureRecord| be a new {{PressureRecord}} object with its
{{PressureRecord/[[Source]]}} set to |source|,
{{PressureRecord/[[State]]}} set to |state|
and {{PressureRecord/[[Time]]}} set to |timestamp|.
and {{PressureRecord/[[Time]]}} set to |timeValue|.
</li>
<li>
If |observer|.{{PressureObserver/[[AfterPenaltyRecordMap]]}}[source] [=map/exists=]:
Expand Down

0 comments on commit 1b8a56c

Please sign in to comment.