From 910129ef37b786e0485042502e04ed4f0d0d70e6 Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Thu, 20 Feb 2020 16:01:29 +0100 Subject: [PATCH] [C] SetWaitableTimer expects a duration in 100-nanosecond intervals (#868) --- aeron-driver/src/main/c/concurrent/aeron_thread.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aeron-driver/src/main/c/concurrent/aeron_thread.c b/aeron-driver/src/main/c/concurrent/aeron_thread.c index 05c588d874..18dea3a28c 100644 --- a/aeron-driver/src/main/c/concurrent/aeron_thread.c +++ b/aeron-driver/src/main/c/concurrent/aeron_thread.c @@ -19,15 +19,15 @@ void aeron_nano_sleep(uint64_t nanoseconds) { #ifdef AERON_COMPILER_MSVC - HANDLE timer; - LARGE_INTEGER li; - - if (!(timer = CreateWaitableTimer(NULL, TRUE, NULL))) + HANDLE timer = CreateWaitableTimer(NULL, TRUE, NULL); + if (!timer) { return; } - li.QuadPart = -nanoseconds; + LARGE_INTEGER li; + li.QuadPart = -(int64_t)(nanoseconds / 100); + if (!SetWaitableTimer(timer, &li, 0, NULL, NULL, FALSE)) { CloseHandle(timer);