summaryrefslogtreecommitdiffstats
path: root/src/common/x64/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/x64/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/x64/native_clock.cpp')
-rw-r--r--src/common/x64/native_clock.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 7d2a26bd9..d2d27fafe 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -8,39 +8,35 @@
namespace Common::X64 {
NativeClock::NativeClock(u64 rdtsc_frequency_)
- : start_ticks{FencedRDTSC()}, rdtsc_frequency{rdtsc_frequency_},
- ns_rdtsc_factor{GetFixedPoint64Factor(NsRatio::den, rdtsc_frequency)},
+ : rdtsc_frequency{rdtsc_frequency_}, ns_rdtsc_factor{GetFixedPoint64Factor(NsRatio::den,
+ rdtsc_frequency)},
us_rdtsc_factor{GetFixedPoint64Factor(UsRatio::den, rdtsc_frequency)},
ms_rdtsc_factor{GetFixedPoint64Factor(MsRatio::den, rdtsc_frequency)},
cntpct_rdtsc_factor{GetFixedPoint64Factor(CNTFRQ, rdtsc_frequency)},
gputick_rdtsc_factor{GetFixedPoint64Factor(GPUTickFreq, rdtsc_frequency)} {}
std::chrono::nanoseconds NativeClock::GetTimeNS() const {
- return std::chrono::nanoseconds{MultiplyHigh(GetHostTicksElapsed(), ns_rdtsc_factor)};
+ return std::chrono::nanoseconds{MultiplyHigh(GetUptime(), ns_rdtsc_factor)};
}
std::chrono::microseconds NativeClock::GetTimeUS() const {
- return std::chrono::microseconds{MultiplyHigh(GetHostTicksElapsed(), us_rdtsc_factor)};
+ return std::chrono::microseconds{MultiplyHigh(GetUptime(), us_rdtsc_factor)};
}
std::chrono::milliseconds NativeClock::GetTimeMS() const {
- return std::chrono::milliseconds{MultiplyHigh(GetHostTicksElapsed(), ms_rdtsc_factor)};
+ return std::chrono::milliseconds{MultiplyHigh(GetUptime(), ms_rdtsc_factor)};
}
-u64 NativeClock::GetCNTPCT() const {
- return MultiplyHigh(GetHostTicksElapsed(), cntpct_rdtsc_factor);
+s64 NativeClock::GetCNTPCT() const {
+ return MultiplyHigh(GetUptime(), cntpct_rdtsc_factor);
}
-u64 NativeClock::GetGPUTick() const {
- return MultiplyHigh(GetHostTicksElapsed(), gputick_rdtsc_factor);
+s64 NativeClock::GetGPUTick() const {
+ return MultiplyHigh(GetUptime(), gputick_rdtsc_factor);
}
-u64 NativeClock::GetHostTicksNow() const {
- return FencedRDTSC();
-}
-
-u64 NativeClock::GetHostTicksElapsed() const {
- return FencedRDTSC() - start_ticks;
+s64 NativeClock::GetUptime() const {
+ return static_cast<s64>(FencedRDTSC());
}
bool NativeClock::IsNative() const {