1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +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:
Ben Wiederhake 2021-02-27 23:56:16 +01:00 committed by Andreas Kling
parent 91c72faa3c
commit c040e64b7d
8 changed files with 39 additions and 38 deletions

View file

@ -42,8 +42,7 @@ Thread::BlockTimeout::BlockTimeout(bool is_absolute, const Time* time, const Tim
m_time = *time;
m_should_block = true;
}
// FIXME: Should use AK::Time internally
m_start_time = start_time ? *start_time : Time::from_timespec(TimeManagement::the().current_time(clock_id).value());
m_start_time = start_time ? *start_time : TimeManagement::the().current_time(clock_id).value();
if (!is_absolute)
m_time = m_time + m_start_time;
}
@ -349,8 +348,7 @@ void Thread::SleepBlocker::calculate_remaining()
{
if (!m_remaining)
return;
// FIXME: Should use AK::Time internally
auto time_now = Time::from_timespec(TimeManagement::the().current_time(m_deadline.clock_id()).value());
auto time_now = TimeManagement::the().current_time(m_deadline.clock_id()).value();
if (time_now < m_deadline.absolute_time())
*m_remaining = m_deadline.absolute_time() - time_now;
else