-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
performance.now() returns incorrect value #17892
Comments
AFAIK W3C isn't a spec for Node, but we try to match browser behavior as much as possible. Would we break anything in Node if we change time origin? How badly are we breaking the module ecosystems by introducing this change? |
The Browsers all perform the way as described in the spec, but the recent Meltdown/Spectre mitigations include reducing
Not that I am aware.
I expect near-zero breakage since this is a relatively new API. |
Fixes: nodejs#17892 Fixes: nodejs#17893 Fixes: nodejs#18992
Fixes: nodejs#17892 Fixes: nodejs#17893 Fixes: nodejs#18992 PR-URL: nodejs#18993 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Fixes: nodejs#17892 Fixes: nodejs#17893 Fixes: nodejs#18992 PR-URL: nodejs#18993 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
The spec (1 which leads to 2) describes the return value of
performance.now()
as:where time origin is defined as the point at which the "browsing context is first created", which translates to Node.js as the time Node.js is launched.
In other words, I would expect
performance.now()
to return a value close to 0 as it is executed as soon as Node.js is launched, rather thanprocess.hrtime()
converted to milliseconds as it currently does./cc @jasnell
The text was updated successfully, but these errors were encountered: