[BUG] ev_kqueue was forgotten during the switch to timeval
diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c
index 55419f6..8740217 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -98,16 +98,23 @@
/*
* kqueue() poller
*/
-REGPRM2 static void _do_poll(struct poller *p, int wait_time)
+REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp)
{
int status;
int count, fd;
struct timespec timeout, *to_ptr;
to_ptr = NULL; // no timeout
- if (wait_time >= 0) {
- timeout.tv_sec = wait_time / 1000;
- timeout.tv_nsec = (wait_time % 1000) * 1000000;
+ if (tv_isset(exp)) {
+ struct timeval delta;
+
+ if (tv_isge(&now, exp))
+ delta.tv_sec = delta.tv_usec = 0;
+ else
+ tv_remain(&now, exp, &delta);
+
+ timeout.tv_sec = delta.tv_sec;
+ timeout.tv_nsec = delta.tv_usec * 1000;
to_ptr = &timeout;
}