From ce7c302933be69e5937f9cac5cf79385d5434a02 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 13 Mar 2019 03:25:18 +0100 Subject: [PATCH] Kernel: Oops, gettimeofday()'s tv_usec should be micro, not milliseconds. --- Kernel/Process.cpp | 2 +- LibGUI/GEventLoop.cpp | 2 +- WindowServer/WSMessageLoop.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 7b50ca2750..f13d17505e 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1595,7 +1595,7 @@ int Process::sys$gettimeofday(timeval* tv) return -EFAULT; auto now = RTC::now(); tv->tv_sec = now; - tv->tv_usec = PIT::ticks_since_boot() % 1000; + tv->tv_usec = (PIT::ticks_since_boot() % 1000) * 1000; return 0; } diff --git a/LibGUI/GEventLoop.cpp b/LibGUI/GEventLoop.cpp index 76c7aa3303..aa4428c11e 100644 --- a/LibGUI/GEventLoop.cpp +++ b/LibGUI/GEventLoop.cpp @@ -373,7 +373,7 @@ void GEventLoop::EventLoopTimer::reload() { gettimeofday(&fire_time, nullptr); fire_time.tv_sec += interval / 1000; - fire_time.tv_usec += interval % 1000; + fire_time.tv_usec += (interval % 1000) * 1000; } void GEventLoop::get_next_timer_expiration(timeval& soonest) diff --git a/WindowServer/WSMessageLoop.cpp b/WindowServer/WSMessageLoop.cpp index a3fe8df808..0101d6d1b8 100644 --- a/WindowServer/WSMessageLoop.cpp +++ b/WindowServer/WSMessageLoop.cpp @@ -86,7 +86,7 @@ void WSMessageLoop::Timer::reload() gettimeofday(&now, nullptr); next_fire_time = { now.tv_sec + (interval / 1000), - now.tv_usec + (interval % 1000) + now.tv_usec + (interval % 1000) * 1000 }; }