Skip to content

Commit

Permalink
LV2/Timers: Include notification time
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 5, 2023
1 parent ee5525f commit 6afd7e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rpcs3/Emu/Cell/lv2/sys_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ lv2_timer_thread::lv2_timer_thread()
void lv2_timer_thread::operator()()
{
u64 sleep_time = 0;
u64 old_now = 0;

while (true)
{
Expand All @@ -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<u64>(sleep_time, get_guest_system_time() - old_now));

if (thread_ctrl::state() == thread_state::aborting)
{
Expand All @@ -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);

Expand Down

0 comments on commit 6afd7e8

Please sign in to comment.