Kernel: Make usleep aware of dynamic tick length

On my system, ticks_per_second() returns 1280.
So Serenity was always 20% too fast when sleeping!
This commit is contained in:
Ben Wiederhake 2020-05-11 03:05:22 +02:00 committed by Andreas Kling
parent 782db88e82
commit 4a5a7b68eb
Notes: sideshowbarker 2024-07-19 04:37:44 +09:00

View file

@ -2436,7 +2436,7 @@ int Process::sys$usleep(useconds_t usec)
REQUIRE_PROMISE(stdio); REQUIRE_PROMISE(stdio);
if (!usec) if (!usec)
return 0; return 0;
u64 wakeup_time = Thread::current()->sleep(usec / 1000); u64 wakeup_time = Thread::current()->sleep(usec * TimeManagement::the().ticks_per_second() / 1000000);
if (wakeup_time > g_uptime) if (wakeup_time > g_uptime)
return -EINTR; return -EINTR;
return 0; return 0;