From 5b7ec71fb7cc81ea0f98f019cb0dac0b6bcb2fa2 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 15 Feb 2019 13:15:28 -0400 Subject: Correct CNTPCT to use Clock Cycles instead of Cpu Cycles. --- src/core/core_timing_util.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/core_timing_util.h') diff --git a/src/core/core_timing_util.h b/src/core/core_timing_util.h index 513cfac1b..545d3a260 100644 --- a/src/core/core_timing_util.h +++ b/src/core/core_timing_util.h @@ -11,6 +11,7 @@ namespace Core::Timing { // The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz // The exact value used is of course unverified. constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked +constexpr u64 CNTFREQ = 19200000; // Value from fusee. inline s64 msToCycles(int ms) { // since ms is int there is no way to overflow @@ -61,4 +62,6 @@ inline u64 cyclesToMs(s64 cycles) { return cycles * 1000 / BASE_CLOCK_RATE; } +u64 CpuCyclesToClockCycles(u64 ticks); + } // namespace Core::Timing -- cgit v1.2.3 From ecccfe033777d6ae7d29bcf0cfc30412f7d3be24 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 15 Feb 2019 20:04:11 -0400 Subject: Use u128 on Clock Cycles calculation. --- src/core/core_timing_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/core_timing_util.h') diff --git a/src/core/core_timing_util.h b/src/core/core_timing_util.h index 545d3a260..679aa3123 100644 --- a/src/core/core_timing_util.h +++ b/src/core/core_timing_util.h @@ -11,7 +11,7 @@ namespace Core::Timing { // The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz // The exact value used is of course unverified. constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked -constexpr u64 CNTFREQ = 19200000; // Value from fusee. +constexpr u64 CNTFREQ = 19200000; // Value from fusee. inline s64 msToCycles(int ms) { // since ms is int there is no way to overflow -- cgit v1.2.3