summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ewald <mail@johannesewald.de>2013-01-04 19:07:40 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-01-04 23:06:40 +0100
commit872cb0d7fabdb23ad3378d28103228bc58218235 (patch)
treee77abbdc36930334c036c7d6b9b01f0636915168
parent50e88d0b66adda159739c6f1a875c255924e108d (diff)
downloadnode-new-872cb0d7fabdb23ad3378d28103228bc58218235.tar.gz
doc: improve example of process.hrtime()
The example clarifies now that diff[0] * 1000000000 + diff[1] equals the result in nanoseconds.
-rw-r--r--doc/api/process.markdown9
1 files changed, 4 insertions, 5 deletions
diff --git a/doc/api/process.markdown b/doc/api/process.markdown
index fba7f12ce3..7938133530 100644
--- a/doc/api/process.markdown
+++ b/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