Permalink
Browse files

bench: correct time calculation in url.js

  • Loading branch information...
1 parent 1bcf29e commit 2c97da82f5e23beb3f78258bb1340e63895e5125 @bnoordhuis bnoordhuis committed Sep 13, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 benchmark/url.js
View
@@ -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.