Skip to content

Commit

Permalink
Replace microtime with hrtime
Browse files Browse the repository at this point in the history
  • Loading branch information
João Barbosa committed Feb 20, 2017
1 parent de96ce5 commit 2f32b27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

var assert = require('assert');
var microtime = require('microtime');
var microtime = require('./microtime');

/**
* Expose `Limiter`.
Expand Down
13 changes: 13 additions & 0 deletions microtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

var time = Date.now() * 1e3;
var start = process.hrtime();

/**
* Expose `now`.
*/

module.exports.now = function() {
var diff = process.hrtime(start);

return time + diff[0] * 1e6 + Math.round(diff[1] * 1e-3);
}
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"limiter",
"limit"
],
"dependencies": {
"microtime": "^2.1.2"
},
"dependencies": {},
"devDependencies": {
"ioredis": "1.15.1",
"mocha": "*",
Expand Down

0 comments on commit 2f32b27

Please sign in to comment.