summaryrefslogtreecommitdiffstats
path: root/src/common/steady_clock.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/steady_clock.h')
-rw-r--r--src/common/steady_clock.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/common/steady_clock.h b/src/common/steady_clock.h
new file mode 100644
index 000000000..dbd0e2513
--- /dev/null
+++ b/src/common/steady_clock.h
@@ -0,0 +1,34 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <chrono>
+
+#include "common/common_types.h"
+
+namespace Common {
+
+struct SteadyClock {
+ using rep = s64;
+ using period = std::nano;
+ using duration = std::chrono::nanoseconds;
+ using time_point = std::chrono::time_point<SteadyClock>;
+
+ static constexpr bool is_steady = true;
+
+ [[nodiscard]] static time_point Now() noexcept;
+};
+
+struct RealTimeClock {
+ using rep = s64;
+ using period = std::nano;
+ using duration = std::chrono::nanoseconds;
+ using time_point = std::chrono::time_point<RealTimeClock>;
+
+ static constexpr bool is_steady = false;
+
+ [[nodiscard]] static time_point Now() noexcept;
+};
+
+} // namespace Common