Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
bench: correct time calculation in url.js
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Sep 13, 2012
1 parent 1bcf29e commit 2c97da8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions benchmark/url.js
Expand Up @@ -33,9 +33,8 @@ function benchmark(name, fun) {
timestamp = process.hrtime(timestamp);

var seconds = timestamp[0];
var millis = timestamp[1]; // actually nanoseconds
while (millis > 1000) millis /= 10;
var time = (seconds * 1000 + millis) / 1000;
var nanos = timestamp[1];
var time = seconds + nanos / 1e9;

process.stdout.write(util.format('%s sec\n', time.toFixed(3)));
}

0 comments on commit 2c97da8

Please sign in to comment.