xrpld
Loading...
Searching...
No Matches
UptimeClock.h
1#pragma once
2
3#include <atomic>
4#include <chrono>
5#include <ratio>
6#include <thread>
7
8namespace xrpl {
9
16
18{
19public:
20 using rep = int;
24 static constexpr bool is_steady = // NOLINT(readability-identifier-naming)
25 std::chrono::system_clock::is_steady;
26
27 explicit UptimeClock() = default;
28
29 static time_point
30 now(); // seconds since xrpld program start
31
32private:
35
36 struct UpdateThread : private std::thread
37 {
40
42 };
43
44 static UpdateThread
45 startClock();
46};
47
48} // namespace xrpl
std::chrono::time_point< UptimeClock > time_point
Definition UptimeClock.h:23
static constexpr bool is_steady
Definition UptimeClock.h:24
static std::atomic< bool > kStop
Definition UptimeClock.h:34
static time_point now()
static UpdateThread startClock()
std::ratio< 1 > period
Definition UptimeClock.h:21
static std::atomic< rep > kNow
Definition UptimeClock.h:33
std::chrono::duration< rep, period > duration
Definition UptimeClock.h:22
UptimeClock()=default
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
UpdateThread(UpdateThread &&)=default