userver: userver/utils/datetime/steady_coarse_clock.hpp Source File
Loading...
Searching...
No Matches
steady_coarse_clock.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/datetime/steady_coarse_clock.hpp
4/// @brief @copybrief utils::datetime::SteadyCoarseClock
5
6#include <chrono>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace utils::datetime {
11
12/// @ingroup userver_universal
13///
14/// @brief Steady clock with up to a few millisecond resolution that is slightly
15/// faster than the std::chrono::steady_clock
16struct SteadyCoarseClock final {
17 // Duration matches steady clock, but it is updated once in a few milliseconds
18 using duration = std::chrono::steady_clock::duration;
19 using rep = duration::rep;
20 using period = duration::period;
21 using time_point = std::chrono::time_point<SteadyCoarseClock, duration>;
22
23 static constexpr bool is_steady = true;
24
25 static time_point now() noexcept;
26 static duration resolution() noexcept;
27};
28
29} // namespace utils::datetime
30
31USERVER_NAMESPACE_END