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

process.hrtime([time]) do not return diffs while time is given #55

Closed
legendecas opened this issue Feb 26, 2018 · 0 comments
Closed

process.hrtime([time]) do not return diffs while time is given #55

legendecas opened this issue Feb 26, 2018 · 0 comments

Comments

@legendecas
Copy link
Contributor

legendecas commented Feb 26, 2018

time is an optional parameter that must be the result of a previous process.hrtime() call to diff with the current time.

demo script:

var NS_PER_SEC = 1e9;
var time = process.hrtime();
// [ 16264, 282919475 ]

setTimeout(() => {
  var diff = process.hrtime(time);
  // expecting [ 1, 2476940 ]
  // actual [ 16265, 285396415 ]

  console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants