1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:57:42 +00:00

Kernel: Add CLOCK_REALTIME support to the TimerQueue

This allows us to use blocking timeouts with either monotonic or
real time for all blockers. Which means that clock_nanosleep()
now also supports CLOCK_REALTIME.

Also, switch alarm() to use CLOCK_REALTIME as per specification.
This commit is contained in:
Tom 2020-12-01 16:53:47 -07:00 committed by Andreas Kling
parent 4c1e27ec65
commit 12cf6f8650
9 changed files with 182 additions and 97 deletions

View file

@ -52,6 +52,18 @@ TimeManagement& TimeManagement::the()
return *s_the;
}
KResultOr<timespec> TimeManagement::current_time(clockid_t clock_id) const
{
switch (clock_id) {
case CLOCK_MONOTONIC:
return monotonic_time();
case CLOCK_REALTIME:
return epoch_time();
default:
return KResult(EINVAL);
}
}
bool TimeManagement::is_system_timer(const HardwareTimerBase& timer) const
{
return &timer == m_system_timer.ptr();