diff options
author | Tom <tomut@yahoo.com> | 2020-12-29 16:45:01 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-30 02:11:06 +0100 |
commit | c2332780eea2b1332cf410ae32e977dd4522f234 (patch) | |
tree | 8fa8976a1d085736af1b0cfd3f90d590356d9178 /Kernel | |
parent | 675bfb934bcd5a00999a566bb4a080184912c0e4 (diff) | |
download | serenity-c2332780eea2b1332cf410ae32e977dd4522f234.zip |
Kernel: Fix HPET::update_time to set ticks within the valid range
ticks_this_second must be less than the ticks per second (frequency).
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Time/HPET.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Time/HPET.cpp b/Kernel/Time/HPET.cpp index 12014476bd..5c8474f657 100644 --- a/Kernel/Time/HPET.cpp +++ b/Kernel/Time/HPET.cpp @@ -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 { |