diff options
Diffstat (limited to 'src/common/timer.t.hpp')
-rw-r--r-- | src/common/timer.t.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/common/timer.t.hpp b/src/common/timer.t.hpp new file mode 100644 index 0000000..67d7450 --- /dev/null +++ b/src/common/timer.t.hpp @@ -0,0 +1,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 |