20#ifndef RIPPLE_CORE_TIMEKEEPER_H_INCLUDED
21#define RIPPLE_CORE_TIMEKEEPER_H_INCLUDED
23#include <xrpl/basics/chrono.h>
24#include <xrpl/beast/clock/abstract_clock.h>
38 adjust(std::chrono::system_clock::time_point when)
40 return time_point(std::chrono::duration_cast<duration>(
92 using namespace std::chrono_literals;
96 if (by == 0s && offset == 0s)
107 return offset + ((by + 3s) / 4);
110 return offset + ((by - 3s) / 4);
112 return (offset * 3) / 4;
Abstract interface to a clock.
typename Clock::time_point time_point
Manages various times used by the server.
std::atomic< std::chrono::seconds > closeOffset_
static constexpr time_point adjust(std::chrono::system_clock::time_point when)
time_point now() const override
Returns the current time, using the server's clock.
std::chrono::seconds closeOffset() const
virtual ~TimeKeeper()=default
std::chrono::seconds adjustCloseTime(std::chrono::seconds by)
Adjust the close time, based on the network's view of time.
time_point closeTime() const
Returns the predicted close time, in network time.
T compare_exchange_strong(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static constexpr std::chrono::seconds epoch_offset
Clock for measuring the network time.