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