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
17
19{
20public:
21 using rep = int;
25 static constexpr bool is_steady = // NOLINT(readability-identifier-naming)
26 std::chrono::system_clock::is_steady;
27
28 explicit UptimeClock() = default;
29
30 static time_point
31 now(); // seconds since xrpld program start
32
33private:
36
37 struct UpdateThread : private std::thread
38 {
41
43 };
44
45 static UpdateThread
46 startClock();
47};
48
49} // namespace xrpl
std::chrono::time_point< UptimeClock > time_point
Definition UptimeClock.h:24
static constexpr bool is_steady
Definition UptimeClock.h:25
static std::atomic< bool > kStop
Definition UptimeClock.h:35
static time_point now()
static UpdateThread startClock()
std::ratio< 1 > period
Definition UptimeClock.h:22
static std::atomic< rep > kNow
Definition UptimeClock.h:34
std::chrono::duration< rep, period > duration
Definition UptimeClock.h:23
UptimeClock()=default
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
UpdateThread(UpdateThread &&)=default