diff options
| author | 2023-03-05 02:42:48 -0500 | |
|---|---|---|
| committer | 2023-03-07 21:17:46 -0500 | |
| commit | c27a626b5bc1aa2ae593f44b0a7c10ae3c979291 (patch) | |
| tree | 6b56bc52947c36073406870e786f54d452835a2a /src/common/x64/native_clock.cpp | |
| parent | steady_clock: Introduce a real time clock (diff) | |
| download | yuzu-c27a626b5bc1aa2ae593f44b0a7c10ae3c979291.tar.gz yuzu-c27a626b5bc1aa2ae593f44b0a7c10ae3c979291.tar.xz yuzu-c27a626b5bc1aa2ae593f44b0a7c10ae3c979291.zip | |
native_clock: Use RealTimeClock instead of SteadyClock
We want to synchronize RDTSC to real time.
Diffstat (limited to 'src/common/x64/native_clock.cpp')
| -rw-r--r-- | src/common/x64/native_clock.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp index c11590291..3f90343a5 100644 --- a/src/common/x64/native_clock.cpp +++ b/src/common/x64/native_clock.cpp | |||
| @@ -53,11 +53,11 @@ u64 EstimateRDTSCFrequency() { | |||
| 53 | FencedRDTSC(); | 53 | FencedRDTSC(); |
| 54 | 54 | ||
| 55 | // Get the current time. | 55 | // Get the current time. |
| 56 | const auto start_time = Common::SteadyClock::Now(); | 56 | const auto start_time = Common::RealTimeClock::Now(); |
| 57 | const u64 tsc_start = FencedRDTSC(); | 57 | const u64 tsc_start = FencedRDTSC(); |
| 58 | // Wait for 250 milliseconds. | 58 | // Wait for 250 milliseconds. |
| 59 | std::this_thread::sleep_for(std::chrono::milliseconds{250}); | 59 | std::this_thread::sleep_for(std::chrono::milliseconds{250}); |
| 60 | const auto end_time = Common::SteadyClock::Now(); | 60 | const auto end_time = Common::RealTimeClock::Now(); |
| 61 | const u64 tsc_end = FencedRDTSC(); | 61 | const u64 tsc_end = FencedRDTSC(); |
| 62 | // Calculate differences. | 62 | // Calculate differences. |
| 63 | const u64 timer_diff = static_cast<u64>( | 63 | const u64 timer_diff = static_cast<u64>( |
| @@ -75,13 +75,13 @@ NativeClock::NativeClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequen | |||
| 75 | // Thread to re-adjust the RDTSC frequency after 30 seconds has elapsed. | 75 | // Thread to re-adjust the RDTSC frequency after 30 seconds has elapsed. |
| 76 | time_sync_thread = std::jthread{[this](std::stop_token token) { | 76 | time_sync_thread = std::jthread{[this](std::stop_token token) { |
| 77 | // Get the current time. | 77 | // Get the current time. |
| 78 | const auto start_time = Common::SteadyClock::Now(); | 78 | const auto start_time = Common::RealTimeClock::Now(); |
| 79 | const u64 tsc_start = FencedRDTSC(); | 79 | const u64 tsc_start = FencedRDTSC(); |
| 80 | // Wait for 30 seconds. | 80 | // Wait for 30 seconds. |
| 81 | if (!Common::StoppableTimedWait(token, std::chrono::seconds{30})) { | 81 | if (!Common::StoppableTimedWait(token, std::chrono::seconds{30})) { |
| 82 | return; | 82 | return; |
| 83 | } | 83 | } |
| 84 | const auto end_time = Common::SteadyClock::Now(); | 84 | const auto end_time = Common::RealTimeClock::Now(); |
| 85 | const u64 tsc_end = FencedRDTSC(); | 85 | const u64 tsc_end = FencedRDTSC(); |
| 86 | // Calculate differences. | 86 | // Calculate differences. |
| 87 | const u64 timer_diff = static_cast<u64>( | 87 | const u64 timer_diff = static_cast<u64>( |