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

Consider using DOMHighResTimestamp instead of DOMTimeStamp #2674

Closed
yoavweiss opened this issue Aug 31, 2021 · 5 comments · Fixed by #2686 or #2700
Closed

Consider using DOMHighResTimestamp instead of DOMTimeStamp #2674

yoavweiss opened this issue Aug 31, 2021 · 5 comments · Fixed by #2686 or #2700
Assignees

Comments

@yoavweiss
Copy link

We're considering our options RE DOMTimeStamp, and wondering what it's used for. It seems less well-defined than DOMHighResTimestamp. Would y'all consider switching over?

See whatwg/webidl#2 for discussion.

@alvestrand
Copy link
Contributor

The WebRTC spec mentions DOMTimeStamp five times, all in the context of the "expires" timestamp on the RTCCertificate.

It also mentions DOMHighResTimestamp five times, covering RTCStats and RTCRtpContributingSource.

WebCrypto does not specify how the expiration date of an attribute should be specified, so its interpretation is clearly a WebRTC only matter, and the text clearly indicates that it was taken to be a time offset relative to "now" (it says that the value 2592000000 represents an expiry time of 30 days in the future).

I would not at all mind using DOMHighResTimestamp instead if that's a compatible spec change (meaning that users wouldn't have to modify their code).

@yoavweiss
Copy link
Author

Thanks! Given that it's used as a relative timestamp, it sounds like this may be a web compatible change.

@jan-ivar
Copy link
Member

jan-ivar commented Nov 4, 2021

To unblock tooling, we've temporarily merged a change of s/DOMTimeStamp/EpochTimeStamp/ which means that resolving this issue has become urgent, to not leave the spec in a wrong state. I suggest resolving this soon either here on github or at next meeting.

@alvestrand
Copy link
Contributor

When looking more carefully at the code, I found that EpochTimeStamp (old DOMTimeStamp) was used in 2 places, one as a relative time (when setting cert expiry) and one as an absolute time (when showing a certificate). So one needs to be EpochTimeStamp and the other needs to be DOMHighResTimeStamp.
DOMHighResTimeStamp do have a defined origin (the page load time, roughly), but the difference between page load time and "now" (our previous interpretation) should be small enough not to matter in most cases.

A compatibility note may be nice.

@alvestrand
Copy link
Contributor

When writing the PR, I noted that DOMHighResTimeStamp does have a defined meaning (relative to the current page load).
This changes the interpretation.
If this is important, we should just change the argument type to "long long".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants