Skip to content

Commit 2c97da8

Browse files
committed
bench: correct time calculation in url.js
1 parent 1bcf29e commit 2c97da8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

benchmark/url.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ function benchmark(name, fun) {
3333
timestamp = process.hrtime(timestamp);
3434

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

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

0 commit comments

Comments
 (0)