Kernel: Fix timer early wake message

When printing early return message, current time was read twice. This
could lead to early return check failing, but when printing and reading
the time again subtraction overflow would happen.
This commit is contained in:
Bananymous 2024-05-28 16:04:18 +03:00
parent 598a09c13d
commit 87d52e5ebe
1 changed files with 3 additions and 2 deletions

View File

@ -75,8 +75,9 @@ namespace Kernel
return;
uint64_t wake_time = ms_since_boot() + ms;
Scheduler::get().set_current_thread_sleeping(wake_time);
if (ms_since_boot() < wake_time)
dwarnln("sleep woke {} ms too soon", wake_time - ms_since_boot());
uint64_t current_time = ms_since_boot();
if (current_time < wake_time)
dwarnln("sleep woke {} ms too soon", wake_time - current_time);
}
timespec SystemTimer::real_time() const