summaryrefslogtreecommitdiffstats
path: root/src/common/windows/timer_resolution.h
blob: e1e50a62dc29e7fc0b6551af60be8c41c046055d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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