Browse Source

doc: improve example of process.hrtime()

The example clarifies now that diff[0] * 1000000000 + diff[1] equals
the result in nanoseconds.
v0.8.17-release
Johannes Ewald 12 years ago
committed by Ben Noordhuis
parent
commit
872cb0d7fa
  1. 9
      doc/api/process.markdown

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

Loading…
Cancel
Save