0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

doc: improve example of process.hrtime()

The example clarifies now that diff[0] * 1000000000 + diff[1] equals
the result in nanoseconds.
This commit is contained in:
Johannes Ewald 2013-01-04 19:07:40 +01:00 committed by Ben Noordhuis
parent 50e88d0b66
commit 872cb0d7fa

View File

@ -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