From bf0bc3565b21d857afc53a2d9c2fd773d973cdf5 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Wed, 3 Oct 2012 23:02:14 +0400 Subject: [PATCH] doc: better example for process.hrtime() Fixes #3984. --- doc/api/process.markdown | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/process.markdown b/doc/api/process.markdown index 8d7bb48..fba7f12 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -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); -- 2.7.4