summaryrefslogtreecommitdiffstats
path: root/src/core/core_timing_util.h
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-06-05 01:52:42 +0200
committerLioncash <mathew1800@gmail.com>2019-06-05 02:31:24 +0200
commit42f5fd0ab32b117901d0cae228103811719606ff (patch)
tree66fed7f7c35ba2448006f1393a9b868ed29632d5 /src/core/core_timing_util.h
parentcore/core_timing_utils: Simplify overload set (diff)
downloadyuzu-42f5fd0ab32b117901d0cae228103811719606ff.tar
yuzu-42f5fd0ab32b117901d0cae228103811719606ff.tar.gz
yuzu-42f5fd0ab32b117901d0cae228103811719606ff.tar.bz2
yuzu-42f5fd0ab32b117901d0cae228103811719606ff.tar.lz
yuzu-42f5fd0ab32b117901d0cae228103811719606ff.tar.xz
yuzu-42f5fd0ab32b117901d0cae228103811719606ff.tar.zst
yuzu-42f5fd0ab32b117901d0cae228103811719606ff.zip
Diffstat (limited to 'src/core/core_timing_util.h')
-rw-r--r--src/core/core_timing_util.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/core/core_timing_util.h b/src/core/core_timing_util.h
index c8749ff12..1dcd38dd1 100644
--- a/src/core/core_timing_util.h
+++ b/src/core/core_timing_util.h
@@ -4,6 +4,7 @@
#pragma once
+#include <chrono>
#include "common/common_types.h"
namespace Core::Timing {
@@ -13,22 +14,20 @@ namespace Core::Timing {
constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked
constexpr u64 CNTFREQ = 19200000; // Value from fusee.
-s64 usToCycles(s64 us);
-s64 usToCycles(u64 us);
+s64 msToCycles(std::chrono::milliseconds ms);
+s64 usToCycles(std::chrono::microseconds us);
+s64 nsToCycles(std::chrono::nanoseconds ns);
-s64 nsToCycles(s64 ns);
-s64 nsToCycles(u64 ns);
-
-inline u64 cyclesToNs(s64 cycles) {
- return cycles * 1000000000 / BASE_CLOCK_RATE;
+inline std::chrono::milliseconds cyclesToMs(s64 cycles) {
+ return std::chrono::milliseconds(cycles * 1000 / BASE_CLOCK_RATE);
}
-inline s64 cyclesToUs(s64 cycles) {
- return cycles * 1000000 / BASE_CLOCK_RATE;
+inline std::chrono::nanoseconds cyclesToNs(s64 cycles) {
+ return std::chrono::nanoseconds(cycles * 1000000000 / BASE_CLOCK_RATE);
}
-inline u64 cyclesToMs(s64 cycles) {
- return cycles * 1000 / BASE_CLOCK_RATE;
+inline std::chrono::microseconds cyclesToUs(s64 cycles) {
+ return std::chrono::microseconds(cycles * 1000000 / BASE_CLOCK_RATE);
}
u64 CpuCyclesToClockCycles(u64 ticks);