Closed devinivy closed 2 years ago
@Marsup process.hrtime()
has been marked as "legacy", and node encourages folks to switch to process.hrtime.bigint()
. It's also a bit easier to use since BigInt is a more standard type than the tuple that process.hrtime()
returns.
My bad, it was even written in the description, sorry 🙁 Good to merge 👍🏻
@Marsup
process.hrtime()
has been marked as "legacy", and node encourages folks to switch toprocess.hrtime.bigint()
. It's also a bit easier to use since BigInt is a more standard type than the tuple thatprocess.hrtime()
returns.
performance.now()
would probably be an even better replacement. It's web-compatible and avoids the use of BigInt.
h2o2 is very unlikely to be used anywhere else though.
For sure, but if you are updating it, you might as well use that. hrtime()
should only be used if you need to accurately know the current time (ie. not only used to compute a delta).
I thought that too until recently—I think it's a common misconception! Here's what the docs say about hrtime:
These times are relative to an arbitrary time in the past, and not related to the time of day and therefore not subject to clock drift. The primary use is for measuring performance between intervals
Oh, right! – it is not even useful for getting the exact time. Guess it is just completely redundant then.
FYI, the node performance.now()
implementation uses hrtime()
, but uses the start of of the current process as a reference, rather than the start of the system.
hrtime.bigint()
rather than legacyhrtime()
.If this looks good, this will go out as bounce v10 (including #128).