Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

doc: improve example of process.hrtime()

The example clarifies now that diff[0] * 1000000000 + diff[1] equals
the result in nanoseconds.
  • Loading branch information...
commit 872cb0d7fabdb23ad3378d28103228bc58218235 1 parent 50e88d0
@jhnns jhnns authored bnoordhuis committed
Showing with 4 additions and 5 deletions.
  1. +4 −5 doc/api/process.markdown
View
9 doc/api/process.markdown
@@ -418,15 +418,14 @@ You may pass in the result of a previous call to `process.hrtime()` to get
a diff reading, useful for benchmarks and measuring intervals:
var time = process.hrtime();
- // [ 1800216, 927643717 ]
+ // [ 1800216, 25 ]
setTimeout(function () {
var diff = process.hrtime(time);
- // [ 1, 6962306 ]
+ // [ 1, 552 ]
- console.log('benchmark took %d seconds and %d nanoseconds',
- diff[0], diff[1]);
- // benchmark took 1 seconds and 6962306 nanoseconds
+ console.log('benchmark took %d nanoseconds', diff[0] * 1e9 + diff[1]);
+ // benchmark took 1000000527 nanoseconds
}, 1000);
[EventEmitter]: events.html#events_class_events_eventemitter
Please sign in to comment.
Something went wrong with that request. Please try again.