mirror of https://github.com/nodejs/node.git
bench: correct time calculation in url.js
parent
1bcf29ef33
commit
2c97da82f5
|
@ -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)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue