Skip to content

Commit 7ca5a69

Browse files
author
João Barbosa
committed
Replace microtime with hrtime
1 parent de96ce5 commit 7ca5a69

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
var assert = require('assert');
6-
var microtime = require('microtime');
76

87
/**
98
* Expose `Limiter`.
@@ -61,7 +60,7 @@ Limiter.prototype.get = function (fn) {
6160
var duration = this.duration;
6261
var max = this.max;
6362
var db = this.db;
64-
var now = microtime.now();
63+
var now = Date.now() * 1000 + Math.floor((process.hrtime()[1] / 1000) % 1000);
6564
var start = now - duration * 1000;
6665

6766
db.multi()

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
"limiter",
1010
"limit"
1111
],
12-
"dependencies": {
13-
"microtime": "^2.1.2"
14-
},
12+
"dependencies": {},
1513
"devDependencies": {
1614
"ioredis": "1.15.1",
1715
"mocha": "*",

0 commit comments

Comments
 (0)