mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:02:06 +00:00
Kernel: Make TimeManagement use AK::Time internally
I don't dare touch the multi-threading logic and locking mechanism, so it stays timespec for now. However, this could and should be changed to AK::Time, and I bet it will simplify the "increment_time_since_boot()" code.
This commit is contained in:
parent
91c72faa3c
commit
c040e64b7d
8 changed files with 39 additions and 38 deletions
|
@ -64,8 +64,7 @@ Time Timer::now(bool is_firing) const
|
|||
break;
|
||||
}
|
||||
}
|
||||
// FIXME: Should use AK::Time internally
|
||||
return Time::from_timespec(TimeManagement::the().current_time(clock_id).value());
|
||||
return TimeManagement::the().current_time(clock_id).value();
|
||||
}
|
||||
|
||||
TimerQueue& TimerQueue::the()
|
||||
|
@ -80,8 +79,7 @@ UNMAP_AFTER_INIT TimerQueue::TimerQueue()
|
|||
|
||||
RefPtr<Timer> TimerQueue::add_timer_without_id(clockid_t clock_id, const Time& deadline, Function<void()>&& callback)
|
||||
{
|
||||
// FIXME: Should use AK::Time internally
|
||||
if (deadline <= Time::from_timespec(TimeManagement::the().current_time(clock_id).value()))
|
||||
if (deadline <= TimeManagement::the().current_time(clock_id).value())
|
||||
return {};
|
||||
|
||||
// Because timer handlers can execute on any processor and there is
|
||||
|
@ -139,8 +137,7 @@ void TimerQueue::add_timer_locked(NonnullRefPtr<Timer> timer)
|
|||
|
||||
TimerId TimerQueue::add_timer(clockid_t clock_id, const Time& deadline, Function<void()>&& callback)
|
||||
{
|
||||
// FIXME: Should use AK::Time internally
|
||||
auto expires = Time::from_timespec(TimeManagement::the().current_time(clock_id).value());
|
||||
auto expires = TimeManagement::the().current_time(clock_id).value();
|
||||
expires = expires + deadline;
|
||||
return add_timer(adopt(*new Timer(clock_id, expires, move(callback))));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue