summaryrefslogtreecommitdiffstats
path: root/src/core/core_timing_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core_timing_util.cpp')
-rw-r--r--src/core/core_timing_util.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/core_timing_util.cpp b/src/core/core_timing_util.cpp
index f42666b4d..be34b26fe 100644
--- a/src/core/core_timing_util.cpp
+++ b/src/core/core_timing_util.cpp
@@ -49,9 +49,19 @@ s64 nsToCycles(std::chrono::nanoseconds ns) {
return (Hardware::BASE_CLOCK_RATE * ns.count()) / 1000000000;
}
+u64 msToClockCycles(std::chrono::milliseconds ns) {
+ const u128 temp = Common::Multiply64Into128(ns.count(), Hardware::CNTFREQ);
+ return Common::Divide128On32(temp, 1000).first;
+}
+
+u64 usToClockCycles(std::chrono::microseconds ns) {
+ const u128 temp = Common::Multiply64Into128(ns.count(), Hardware::CNTFREQ);
+ return Common::Divide128On32(temp, 1000000).first;
+}
+
u64 nsToClockCycles(std::chrono::nanoseconds ns) {
- const u128 temporal = Common::Multiply64Into128(ns.count(), CNTFREQ);
- return Common::Divide128On32(temporal, 1000000000).first;
+ const u128 temp = Common::Multiply64Into128(ns.count(), Hardware::CNTFREQ);
+ return Common::Divide128On32(temp, 1000000000).first;
}
u64 CpuCyclesToClockCycles(u64 ticks) {