summaryrefslogtreecommitdiffstats
path: root/src/common/steady_clock.h
blob: dbd0e251313936e08ef060ffadaced0065c2405e (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
// 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