diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.cpp b/rpcs3/Emu/Cell/lv2/sys_timer.cpp index 68d29ea82c4a..4816a4ef3f1c 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_timer.cpp @@ -95,7 +95,7 @@ u64 lv2_timer::check_unlocked(u64 _now) noexcept // Set next expiration time and check again const u64 expire0 = utils::add_saturate(next, period); expire.release(expire0); - return expire0 - _now; + return utils::sub_saturate(expire0, _now); } // Stop after oneshot @@ -144,13 +144,16 @@ void lv2_timer_thread::operator()() for (const auto& timer : timers) { - if (lv2_obj::check(timer)) + while (lv2_obj::check(timer)) { - const u64 advised_sleep_time = timer->check(_now); - - if (sleep_time > advised_sleep_time) + if (const u64 advised_sleep_time = timer->check(_now)) { - sleep_time = advised_sleep_time; + if (sleep_time > advised_sleep_time) + { + sleep_time = advised_sleep_time; + } + + break; } } }