From 76c5e35363a673c5214ffd0aaa5f61d10e1155e6 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Fri, 1 Sep 2017 18:06:15 +0200 Subject: [PATCH] epoll.c: use GetTickCount64() to avoid clock wrapping issues --- src/epoll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/epoll.c b/src/epoll.c index c106e52..604cb76 100644 --- a/src/epoll.c +++ b/src/epoll.c @@ -296,7 +296,7 @@ int epoll_wait(epoll_t port_handle, int maxevents, int timeout) { epoll_port_data_t* port_data; - DWORD due; + ULONGLONG due = 0; DWORD gqcs_timeout; port_data = (epoll_port_data_t*) port_handle; @@ -304,7 +304,7 @@ int epoll_wait(epoll_t port_handle, /* Compute the timeout for GetQueuedCompletionStatus, and the wait end */ /* time, if the user specified a timeout other than zero or infinite. */ if (timeout > 0) { - due = GetTickCount() + timeout; + due = GetTickCount64() + timeout; gqcs_timeout = (DWORD) timeout; } else if (timeout == 0) { gqcs_timeout = 0; @@ -482,7 +482,7 @@ int epoll_wait(epoll_t port_handle, /* Events were dequeued, but none were relevant. Recompute timeout. */ if (timeout > 0) { - gqcs_timeout = due - GetTickCount(); + gqcs_timeout = due - GetTickCount64(); } } while (timeout > 0);