diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-25 20:19:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-25 20:19:01 +0100 |
commit | d45561ace069024f47ed710d1165b607644d1ec3 (patch) | |
tree | a316f59c5a722dc15fe5c49b3641d9801c264970 /src/common/arm64 | |
parent | Merge pull request #12781 from goldenx86/dozen (diff) | |
parent | Rework time service to fix time passing offline. (diff) | |
download | yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.gz yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.bz2 yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.lz yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.xz yuzu-d45561ace069024f47ed710d1165b607644d1ec3.tar.zst yuzu-d45561ace069024f47ed710d1165b607644d1ec3.zip |
Diffstat (limited to 'src/common/arm64')
-rw-r--r-- | src/common/arm64/native_clock.cpp | 24 | ||||
-rw-r--r-- | src/common/arm64/native_clock.h | 10 |
2 files changed, 14 insertions, 20 deletions
diff --git a/src/common/arm64/native_clock.cpp b/src/common/arm64/native_clock.cpp index f437d7187..76ffb74ba 100644 --- a/src/common/arm64/native_clock.cpp +++ b/src/common/arm64/native_clock.cpp @@ -30,27 +30,27 @@ NativeClock::NativeClock() { } std::chrono::nanoseconds NativeClock::GetTimeNS() const { - return std::chrono::nanoseconds{MultiplyHigh(GetHostTicksElapsed(), ns_cntfrq_factor)}; + return std::chrono::nanoseconds{MultiplyHigh(GetUptime(), ns_cntfrq_factor)}; } std::chrono::microseconds NativeClock::GetTimeUS() const { - return std::chrono::microseconds{MultiplyHigh(GetHostTicksElapsed(), us_cntfrq_factor)}; + return std::chrono::microseconds{MultiplyHigh(GetUptime(), us_cntfrq_factor)}; } std::chrono::milliseconds NativeClock::GetTimeMS() const { - return std::chrono::milliseconds{MultiplyHigh(GetHostTicksElapsed(), ms_cntfrq_factor)}; + return std::chrono::milliseconds{MultiplyHigh(GetUptime(), ms_cntfrq_factor)}; } -u64 NativeClock::GetCNTPCT() const { - return MultiplyHigh(GetHostTicksElapsed(), guest_cntfrq_factor); +s64 NativeClock::GetCNTPCT() const { + return MultiplyHigh(GetUptime(), guest_cntfrq_factor); } -u64 NativeClock::GetGPUTick() const { - return MultiplyHigh(GetHostTicksElapsed(), gputick_cntfrq_factor); +s64 NativeClock::GetGPUTick() const { + return MultiplyHigh(GetUptime(), gputick_cntfrq_factor); } -u64 NativeClock::GetHostTicksNow() const { - u64 cntvct_el0 = 0; +s64 NativeClock::GetUptime() const { + s64 cntvct_el0 = 0; asm volatile("dsb ish\n\t" "mrs %[cntvct_el0], cntvct_el0\n\t" "dsb ish\n\t" @@ -58,15 +58,11 @@ u64 NativeClock::GetHostTicksNow() const { return cntvct_el0; } -u64 NativeClock::GetHostTicksElapsed() const { - return GetHostTicksNow(); -} - bool NativeClock::IsNative() const { return true; } -u64 NativeClock::GetHostCNTFRQ() { +s64 NativeClock::GetHostCNTFRQ() { u64 cntfrq_el0 = 0; std::string_view board{""}; #ifdef ANDROID diff --git a/src/common/arm64/native_clock.h b/src/common/arm64/native_clock.h index a28b419f2..94bc1882e 100644 --- a/src/common/arm64/native_clock.h +++ b/src/common/arm64/native_clock.h @@ -17,17 +17,15 @@ public: std::chrono::milliseconds GetTimeMS() const override; - u64 GetCNTPCT() const override; + s64 GetCNTPCT() const override; - u64 GetGPUTick() const override; + s64 GetGPUTick() const override; - u64 GetHostTicksNow() const override; - - u64 GetHostTicksElapsed() const override; + s64 GetUptime() const override; bool IsNative() const override; - static u64 GetHostCNTFRQ(); + static s64 GetHostCNTFRQ(); public: using FactorType = unsigned __int128; |