blob: 4e17952ff6182b484cbbe50bb3c6d6c3327a4d27 [file] [log] [blame]
Krzysztof Grobelny80697712021-03-04 09:49:27 +00001#pragma once
2
3#include "interfaces/clock.hpp"
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +01004#include "types/duration_types.hpp"
Krzysztof Grobelny80697712021-03-04 09:49:27 +00005
6#include <chrono>
7
8class Clock : public interfaces::Clock
9{
10 public:
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +010011 Milliseconds steadyTimestamp() const noexcept override
Krzysztof Grobelny80697712021-03-04 09:49:27 +000012 {
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +010013 return std::chrono::time_point_cast<Milliseconds>(
14 std::chrono::steady_clock::now())
15 .time_since_epoch();
Krzysztof Grobelny80697712021-03-04 09:49:27 +000016 }
17
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +010018 Milliseconds systemTimestamp() const noexcept override
Krzysztof Grobelny80697712021-03-04 09:49:27 +000019 {
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +010020 return std::chrono::time_point_cast<Milliseconds>(
21 std::chrono::system_clock::now())
22 .time_since_epoch();
Krzysztof Grobelny80697712021-03-04 09:49:27 +000023 }
24};