rippled
Loading...
Searching...
No Matches
UptimeClock.h
1#ifndef XRPL_BASICS_UPTIMETIMER_H_INCLUDED
2#define XRPL_BASICS_UPTIMETIMER_H_INCLUDED
3
4#include <atomic>
5#include <chrono>
6#include <ratio>
7#include <thread>
8
9namespace ripple {
10
19{
20public:
21 using rep = int;
25 static constexpr bool is_steady = std::chrono::system_clock::is_steady;
26
27 explicit UptimeClock() = default;
28
29 static time_point
30 now(); // seconds since rippled program start
31
32private:
35
36 struct update_thread : private std::thread
37 {
40
42 };
43
44 static update_thread
46};
47
48} // namespace ripple
49
50#endif
Tracks program uptime to seconds precision.
Definition UptimeClock.h:19
static constexpr bool is_steady
Definition UptimeClock.h:25
static update_thread start_clock()
static std::atomic< rep > now_
Definition UptimeClock.h:33
static time_point now()
static std::atomic< bool > stop_
Definition UptimeClock.h:34
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
update_thread(update_thread &&)=default