From 52bb7efa97932417f9a3f030cb6ae741b978a9be Mon Sep 17 00:00:00 2001 From: Eladash Date: Mon, 5 Jun 2023 15:10:14 +0300 Subject: [PATCH] LV2/Timers: Include notification time --- rpcs3/Emu/Cell/lv2/sys_timer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.cpp b/rpcs3/Emu/Cell/lv2/sys_timer.cpp index 0a8de120aa26..e09a25d1cf91 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_timer.cpp @@ -114,6 +114,7 @@ lv2_timer_thread::lv2_timer_thread() void lv2_timer_thread::operator()() { u64 sleep_time = 0; + u64 old_now = umax; while (true) { @@ -123,7 +124,7 @@ void lv2_timer_thread::operator()() sleep_time = std::min(sleep_time, u64{umax} / 100) * 100 / g_cfg.core.clocks_scale; } - thread_ctrl::wait_for_accurate(sleep_time); + thread_ctrl::wait_for_accurate(utils::sub_saturate(sleep_time, get_guest_system_time() - old_now)); if (thread_ctrl::state() == thread_state::aborting) { @@ -138,7 +139,7 @@ void lv2_timer_thread::operator()() continue; } - const u64 _now = get_guest_system_time(); + old_now = get_guest_system_time(); reader_lock lock(mutex);