w3c / hr-time

High Resolution Time
https://w3c.github.io/hr-time/
Other
52 stars 24 forks source link

"safe" time in milliseconds since epoch without settings object #165

Open annevk opened 2 months ago

annevk commented 2 months ago

I need this concept in Declarative Web Push, but I'm having a hard time figuring out the necessary wording.

yoavweiss commented 1 month ago

If I understand what you need correctly, I think we can define it in a similar way to the current wall time definition, only with the monotonic clock. Would that work?

annevk commented 1 month ago

Well, "current wall time" requires a settings object.

I guess maybe what I need is this:

  1. Let unsafeMonotonicTime be the monotonic clock's unsafe current time.
  2. Return the result of calling coarsen time with unsafeMonotonicTime.

(Because coarsen time takes an optional boolean as second argument that defaults to safe.)

Although maybe the monotonic clock is wrong as it never decreases? I don't know enough about whether I need the wall clock or the monotonic clock. We used to write "time in milliseconds since epoch" but I guess that was never precise enough?

yoavweiss commented 1 month ago

Oh, I think I see the source of confusion here. We seem to have two different "current wall time" definitions.

A generic one defined as the "result of calling coarsen time with the wall clock's unsafe current time.", which is what I think you want for "time in milliseconds since epoch".

The other one, is attached to a settings object and relies on it.

We should probably rename one of them.