diff --git a/lib/timers.js b/lib/timers.js index d6fede1fa04..86738047a72 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -148,6 +148,7 @@ exports.active = function(item) { exports.setTimeout = function(callback, after) { var timer; + after = Math.floor(after); if (after <= 0) { // Use the slow case for after == 0 timer = new Timer(); @@ -201,7 +202,7 @@ exports.clearTimeout = function(timer) { exports.setInterval = function(callback, repeat) { var timer = new Timer(); - + repeat = Math.floor(repeat); if (arguments.length > 2) { var args = Array.prototype.slice.call(arguments, 2); timer.callback = function() {