From b559f9625aafb30941b67c6c6b204f8dff6bb6c4 Mon Sep 17 00:00:00 2001 From: llmII Date: Sat, 4 Sep 2021 08:02:50 -0500 Subject: [PATCH] Timeout is an absolute time, not an interval. Fixes the wrong assumption, passing all tests at that point. --- src/core/ev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/ev.c b/src/core/ev.c index 4f2d2c38..20bc43a7 100644 --- a/src/core/ev.c +++ b/src/core/ev.c @@ -1679,7 +1679,11 @@ void janet_loop1_impl(int has_timeout, JanetTimestamp timeout) { struct kevent timer; if (janet_vm.timer_enabled || has_timeout) { - EV_SET(&timer, JANET_KQUEUE_TIMER_IDENT, EVFILT_TIMER, EV_ADD | EV_ENABLE | EV_CLEAR, NOTE_MSECONDS, timeout, &janet_vm.timer); + EV_SET(&timer, + JANET_KQUEUE_TIMER_IDENT, + EVFILT_TIMER, + EV_ADD | EV_ENABLE | EV_CLEAR, + NOTE_MSECONDS | NOTE_ABSTIME, timeout, &janet_vm.timer); add_kqueue_events(&timer, 1); } janet_vm.timer_enabled = has_timeout;