6#ifndef BITCOIN_UTIL_TIME_H
7#define BITCOIN_UTIL_TIME_H
15using namespace std::chrono_literals;
29constexpr int64_t
count_seconds(std::chrono::seconds t) {
return t.count(); }
33using SecondsDouble = std::chrono::duration<double, std::chrono::seconds::period>;
#define T(expected, seed, data)
constexpr int64_t count_milliseconds(std::chrono::milliseconds t)
struct timeval MillisToTimeval(int64_t nTimeout)
Convert milliseconds to a struct timeval for e.g.
int64_t GetTimeMicros()
Returns the system time (not mockable)
int64_t GetTimeMillis()
Returns the system time (not mockable)
std::chrono::duration< double, std::chrono::seconds::period > SecondsDouble
void UninterruptibleSleep(const std::chrono::microseconds &n)
std::chrono::seconds GetMockTime()
For testing.
int64_t GetTime()
DEPRECATED Use either GetTimeSeconds (not mockable) or GetTime<T> (mockable)
int64_t GetTimeSeconds()
Returns the system time (not mockable)
std::string FormatISO8601Date(int64_t nTime)
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
constexpr int64_t count_microseconds(std::chrono::microseconds t)
constexpr int64_t count_seconds(std::chrono::seconds t)
Helper to count the seconds of a duration.
int64_t ParseISO8601DateTime(const std::string &str)
double CountSecondsDouble(SecondsDouble t)
Helper to count the seconds in any std::chrono::duration type.
bool ChronoSanityCheck()
Sanity check epoch match normal Unix epoch.
std::string FormatISO8601DateTime(int64_t nTime)
ISO 8601 formatting is preferred.