summaryrefslogtreecommitdiff
path: root/src/common/timer.t.hpp
blob: 67d7450292a6465f90fa9ddcc463a3239d7d2ae8 (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
#ifndef TIMER_T_HPP
#define TIMER_T_HPP

# include <chrono>

/// An implementation of the C++ "clock" concept, exposing
/// durations in milliseconds.
class milli_clock
{
public:
    typedef std::chrono::milliseconds duration;
    typedef duration::rep rep;
    typedef duration::period period;
    typedef std::chrono::time_point<milli_clock, duration> time_point;
    static const bool is_steady = true; // assumed - not necessarily true

    static time_point now() noexcept;
};

/// A point in time.
typedef milli_clock::time_point tick_t;
/// The difference between two points in time.
typedef milli_clock::duration interval_t;

/// Opaque type representing an active timer.
struct TimerData;

#endif // TIMER_T_HPP