Line data Source code
1 : #pragma once
2 :
3 : #include <jage/engine/time/durations.hpp>
4 :
5 : #include <chrono>
6 :
7 : namespace jage::engine::time::internal {
8 : template <class TDuration> struct steady_clock {
9 : using rep = typename TDuration::rep;
10 : using period = typename TDuration::period;
11 : using duration = TDuration;
12 : using time_point = std::chrono::time_point<steady_clock>;
13 : static constexpr auto is_steady = true;
14 :
15 1 : [[nodiscard]] static auto now() -> time_point {
16 : return time_point{
17 1 : std::chrono::time_point_cast<duration>(std::chrono::steady_clock::now())
18 1 : .time_since_epoch()};
19 : }
20 : };
21 :
22 : static_assert(std::chrono::is_clock_v<steady_clock<nanoseconds>>);
23 : } // namespace jage::engine::time::internal
|