summary refs log tree commit diff
path: root/src/Time.hpp
blob: 83c41c070505b6e7c218058ab6e8a6f0fc714b9c (plain)
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
#pragma once

#include "Common/Sizes.hpp"

namespace MC {

class Time {
public:
    using Timestamp = U64;

    Time() = default;

    void start_frame();
    void end_frame();

    U64 total_frames() const;
    Real delta() const;

    static Timestamp now();

private:
    static constexpr Real delta_max = 1.0 / 10.0;
    static constexpr Real delta_min = 1.0 / 1000.0;

    U64 m_total_frames = 0;

    Timestamp m_current_frame_start = 0;
    Real m_delta = 0;
};

}