1#ifndef XRPL_APP_LEDGER_LEDGERTIMING_H_INCLUDED
2#define XRPL_APP_LEDGER_LEDGERTIMING_H_INCLUDED
4#include <xrpl/basics/chrono.h>
5#include <xrpl/beast/utility/Journal.h>
59template <
class Rep,
class Period,
class Seq>
68 "ripple:getNextLedgerTimeResolution : valid ledger sequence");
78 "ripple:getNextLedgerTimeResolution : found time resolution");
82 return previousResolution;
102 return previousResolution;
112template <
class Clock,
class Duration,
class Rep,
class Period>
122 closeTime += (closeResolution / 2);
135template <
class Clock,
class Duration,
class Rep,
class Period>
142 using namespace std::chrono_literals;
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::chrono::time_point< Clock, Duration > effCloseTime(std::chrono::time_point< Clock, Duration > closeTime, std::chrono::duration< Rep, Period > resolution, std::chrono::time_point< Clock, Duration > priorCloseTime)
Calculate the effective ledger close time.
auto constexpr decreaseLedgerTimeResolutionEvery
How often we decrease the close time resolution (in numbers of ledgers)
std::chrono::time_point< Clock, Duration > roundCloseTime(std::chrono::time_point< Clock, Duration > closeTime, std::chrono::duration< Rep, Period > closeResolution)
Calculates the close time for a ledger, given a close time resolution.
auto constexpr ledgerDefaultTimeResolution
Initial resolution of ledger close time.
auto constexpr ledgerGenesisTimeResolution
Close time resolution in genesis ledger.
std::chrono::seconds constexpr ledgerPossibleTimeResolutions[]
Possible ledger close time resolutions.
auto constexpr increaseLedgerTimeResolutionEvery
How often we increase the close time resolution (in numbers of ledgers)
std::chrono::duration< Rep, Period > getNextLedgerTimeResolution(std::chrono::duration< Rep, Period > previousResolution, bool previousAgree, Seq ledgerSeq)
Calculates the close time resolution for the specified ledger.
T time_since_epoch(T... args)