summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/thread_win32.c b/thread_win32.c
index af9d3517fa..83896d81ff 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -276,11 +276,16 @@ rb_w32_Sleep(unsigned long msec)
return ret;
}
+static DWORD
+hrtime2msec(rb_hrtime_t hrt)
+{
+ return (DWORD)hrt / (DWORD)RB_HRTIME_PER_MSEC;
+}
+
static void
-native_sleep(rb_thread_t *th, struct timespec *ts)
+native_sleep(rb_thread_t *th, rb_hrtime_t *rel)
{
- const volatile DWORD msec = (ts) ?
- (DWORD)(ts->tv_sec * 1000 + ts->tv_nsec / 1000000) : INFINITE;
+ const volatile DWORD msec = rel ? hrtime2msec(*rel) : INFINITE;
GVL_UNLOCK_BEGIN(th);
{