summaryrefslogtreecommitdiffstats
path: root/src/common/arm64/native_clock.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2024-01-25 20:19:01 +0100
committerGitHub <noreply@github.com>2024-01-25 20:19:01 +0100
commitd45561ace069024f47ed710d1165b607644d1ec3 (patch)
treea316f59c5a722dc15fe5c49b3641d9801c264970 /src/common/arm64/native_clock.cpp
parentMerge pull request #12781 from goldenx86/dozen (diff)
parentRework time service to fix time passing offline. (diff)
downloadyuzu-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/native_clock.cpp')
-rw-r--r--src/common/arm64/native_clock.cpp24
1 files changed, 10 insertions, 14 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