Skip to content

Commit

Permalink
Add duration in microseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
svyandun committed Mar 30, 2017
1 parent b9d9fc6 commit e32260b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Limiter.prototype.get = function (fn) {
var oldest = parseInt(Array.isArray(res[0]) ? res[3][1] : res[3]);
fn(null, {
remaining: count < max ? max - count : 0,
reset: Math.floor((oldest + duration) / 1000000),
reset: Math.floor((oldest + duration * 1000) / 1000000),
total: max
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var Limiter = require('..'),
});
limit.get(function(err, res) {
var left = res.reset - (Date.now() / 1000);
left.should.be.below(60);
left.should.be.below(60).and.be.greaterThan(0);
done();
});
});
Expand Down

0 comments on commit e32260b

Please sign in to comment.