{"action":"closed","issue":{"url":"https://api.github.com/repos/sinonjs/lolex/issues/134","repository_url":"https://api.github.com/repos/sinonjs/lolex","labels_url":"https://api.github.com/repos/sinonjs/lolex/issues/134/labels{/name}","comments_url":"https://api.github.com/repos/sinonjs/lolex/issues/134/comments","events_url":"https://api.github.com/repos/sinonjs/lolex/issues/134/events","html_url":"https://github.com/sinonjs/lolex/issues/134","id":261362579,"number":134,"title":"Unexpected behavior with negative delays","user":{"login":"novemberborn","id":33538,"avatar_url":"https://avatars0.githubusercontent.com/u/33538?v=4","gravatar_id":"","url":"https://api.github.com/users/novemberborn","html_url":"https://github.com/novemberborn","followers_url":"https://api.github.com/users/novemberborn/followers","following_url":"https://api.github.com/users/novemberborn/following{/other_user}","gists_url":"https://api.github.com/users/novemberborn/gists{/gist_id}","starred_url":"https://api.github.com/users/novemberborn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novemberborn/subscriptions","organizations_url":"https://api.github.com/users/novemberborn/orgs","repos_url":"https://api.github.com/users/novemberborn/repos","events_url":"https://api.github.com/users/novemberborn/events{/privacy}","received_events_url":"https://api.github.com/users/novemberborn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-28T15:29:17Z","updated_at":"2017-10-06T07:56:10Z","closed_at":"2017-10-06T07:56:10Z","author_association":"CONTRIBUTOR","body":"```js\r\nconst clock = require('lolex').createClock(0)\r\nclock.setTimeout(() => console.log('tick'), -10)\r\nclock.runAll()\r\nconsole.log(clock.now)\r\n```\r\n\r\nThis gives:\r\n\r\n```\r\ntick\r\n-10\r\n```\r\n\r\nI think https://github.com/sinonjs/lolex/blob/4e1fdcf24f0adfca3b121dd51ff7505bb705a61b/src/lolex-src.js#L208 should use `Math.max(0, parseInt(timer.delay))`.\r\n\r\nCurrently these negatively delayed timers aren't triggered by `clock.tick()` either, though `clock.next()` works."}}
{"actor":{"display_login":"fatso83"}}