summaryrefslogtreecommitdiffstats
path: root/src/common/windows/timer_resolution.h
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2023-03-02 01:27:10 +0100
committerMorph <39850852+Morph1984@users.noreply.github.com>2023-03-05 07:41:28 +0100
commit1ed49f92dd56289e6e31a967e602c65ccedd4ff1 (patch)
treea151df116022445b7606614e31e9b3a3b8225152 /src/common/windows/timer_resolution.h
parentcommon: Implement a high resolution steady clock (diff)
downloadyuzu-1ed49f92dd56289e6e31a967e602c65ccedd4ff1.tar
yuzu-1ed49f92dd56289e6e31a967e602c65ccedd4ff1.tar.gz
yuzu-1ed49f92dd56289e6e31a967e602c65ccedd4ff1.tar.bz2
yuzu-1ed49f92dd56289e6e31a967e602c65ccedd4ff1.tar.lz
yuzu-1ed49f92dd56289e6e31a967e602c65ccedd4ff1.tar.xz
yuzu-1ed49f92dd56289e6e31a967e602c65ccedd4ff1.tar.zst
yuzu-1ed49f92dd56289e6e31a967e602c65ccedd4ff1.zip
Diffstat (limited to '')
-rw-r--r--src/common/windows/timer_resolution.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/common/windows/timer_resolution.h b/src/common/windows/timer_resolution.h
new file mode 100644
index 000000000..e1e50a62d
--- /dev/null
+++ b/src/common/windows/timer_resolution.h
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <chrono>
+
+namespace Common::Windows {
+
+/// Returns the minimum (least precise) supported timer resolution in nanoseconds.
+std::chrono::nanoseconds GetMinimumTimerResolution();
+
+/// Returns the maximum (most precise) supported timer resolution in nanoseconds.
+std::chrono::nanoseconds GetMaximumTimerResolution();
+
+/// Returns the current timer resolution in nanoseconds.
+std::chrono::nanoseconds GetCurrentTimerResolution();
+
+/**
+ * Sets the current timer resolution.
+ *
+ * @param timer_resolution Timer resolution in nanoseconds.
+ *
+ * @returns The current timer resolution.
+ */
+std::chrono::nanoseconds SetCurrentTimerResolution(std::chrono::nanoseconds timer_resolution);
+
+/**
+ * Sets the current timer resolution to the maximum supported timer resolution.
+ *
+ * @returns The current timer resolution.
+ */
+std::chrono::nanoseconds SetCurrentTimerResolutionToMaximum();
+
+/// Sleep for one tick of the current timer resolution.
+void SleepForOneTick();
+
+} // namespace Common::Windows