doc: better example for process.hrtime()
authorAlex Kocharin <alex@kocharin.ru>
Wed, 3 Oct 2012 19:02:14 +0000 (23:02 +0400)
committerBen Noordhuis <info@bnoordhuis.nl>
Wed, 3 Oct 2012 20:18:33 +0000 (22:18 +0200)
Fixes #3984.

doc/api/process.markdown

index 8d7bb48..fba7f12 100644 (file)
@@ -417,14 +417,15 @@ primary use is for measuring performance between intervals.
 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 t = process.hrtime();
+    var time = process.hrtime();
     // [ 1800216, 927643717 ]
 
     setTimeout(function () {
-      t = process.hrtime(t);
+      var diff = process.hrtime(time);
       // [ 1, 6962306 ]
 
-      console.log('benchmark took %d seconds and %d nanoseconds', t[0], t[1]);
+      console.log('benchmark took %d seconds and %d nanoseconds',
+                  diff[0], diff[1]);
       // benchmark took 1 seconds and 6962306 nanoseconds
     }, 1000);