Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

The timers' ms arg should be an integer #897

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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() {
Expand Down