mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel: Support more clocks in sys$clock_getres()
Support all the available clocks in clock_getres(). Also, fix this function to use the actual ticks per second value, not the constant `_SC_CLK_TCK` (which is always equal to 8) and move the resolution computation logic to TimeManagement.
This commit is contained in:
committed by
Andreas Kling
parent
3c7a0ef1ac
commit
f6eb155167
@@ -237,6 +237,12 @@ Time TimeManagement::boot_time()
|
||||
#endif
|
||||
}
|
||||
|
||||
Time TimeManagement::clock_resolution() const
|
||||
{
|
||||
long nanoseconds_per_tick = 1'000'000'000 / m_time_keeper_timer->ticks_per_second();
|
||||
return Time::from_nanoseconds(nanoseconds_per_tick);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT TimeManagement::TimeManagement()
|
||||
: m_time_page_region(MM.allocate_kernel_region(PAGE_SIZE, "Time page"sv, Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow).release_value_but_fixme_should_propagate_errors())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user