mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +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:
parent
4c1e27ec65
commit
12cf6f8650
9 changed files with 182 additions and 97 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue