Skip to content

Commit

Permalink
Handle calling stop more than once.
Browse files Browse the repository at this point in the history
on older versions of node, hrtime gets upset if you call it with undefined.
  • Loading branch information
chriseppstein authored Mar 22, 2017
1 parent 3d508a8 commit 9817bd2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Metric.prototype.start = function() {
};

Metric.prototype.stop = function() {
if (!this.startTime) return;
var change = process.hrtime(this.startTime);

this.time += change[0] * 1e9 + change[1];
Expand Down

0 comments on commit 9817bd2

Please sign in to comment.