Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "retimer", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Reschedulable Timer for your node needs", | ||
@@ -34,5 +34,5 @@ "main": "retimer.js", | ||
"pre-commit": "^1.0.10", | ||
"standard": "^4.5.2", | ||
"standard": "^10.0.0", | ||
"tape": "^4.0.0" | ||
} | ||
} |
@@ -8,3 +8,3 @@ 'use strict' | ||
this._started = Date.now() | ||
this._started = getTime() | ||
this._rescheduled = 0 | ||
@@ -18,3 +18,3 @@ this._scheduled = timeout | ||
if (that._rescheduled > 0) { | ||
that._scheduled = that._rescheduled - (Date.now() - that._started) | ||
that._scheduled = that._rescheduled - (getTime() - that._started) | ||
that._timer = setTimeout(timerWrapper, that._scheduled) | ||
@@ -29,3 +29,3 @@ that._rescheduled = 0 | ||
Retimer.prototype.reschedule = function (timeout) { | ||
var now = Date.now() | ||
var now = getTime() | ||
if ((now + timeout) - (this._started + this._scheduled) < 0) { | ||
@@ -61,2 +61,7 @@ return false | ||
function getTime () { | ||
var t = process.hrtime() | ||
return Math.floor(t[0] * 1000 + t[1] / 1000000) | ||
} | ||
module.exports = retimer |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177
7698
7