mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
Kernel: Fix HPET::update_time to set ticks within the valid range
ticks_this_second must be less than the ticks per second (frequency).
This commit is contained in:
parent
675bfb934b
commit
c2332780ee
Notes:
sideshowbarker
2024-07-19 00:25:19 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/c2332780eea Pull-request: https://github.com/SerenityOS/serenity/pull/4643
|
@ -257,7 +257,7 @@ u64 HPET::update_time(u64& seconds_since_boot, u32& ticks_this_second, bool quer
|
|||
delta_ticks += m_main_counter_last_read - current_value; // the counter wrapped around
|
||||
u64 ticks_since_last_second = (u64)ticks_this_second + delta_ticks;
|
||||
auto ticks_per_second = frequency();
|
||||
if (ticks_since_last_second > ticks_per_second) {
|
||||
if (ticks_since_last_second >= ticks_per_second) {
|
||||
seconds_since_boot += ticks_since_last_second / ticks_per_second;
|
||||
ticks_this_second = ticks_since_last_second % ticks_per_second;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue