Bitcoin Core  0.21.1
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
Functions
time.h File Reference
#include <stdint.h>
#include <string>
#include <chrono>
Include dependency graph for time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void UninterruptibleSleep (const std::chrono::microseconds &n)
 
int64_t count_seconds (std::chrono::seconds t)
 Helper to count the seconds of a duration. More...
 
int64_t count_microseconds (std::chrono::microseconds t)
 
int64_t GetTime ()
 DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable) More...
 
int64_t GetTimeMillis ()
 Returns the system time (not mockable) More...
 
int64_t GetTimeMicros ()
 Returns the system time (not mockable) More...
 
int64_t GetSystemTimeInSeconds ()
 Returns the system time (not mockable) More...
 
void SetMockTime (int64_t nMockTimeIn)
 For testing. More...
 
int64_t GetMockTime ()
 For testing. More...
 
std::string FormatISO8601DateTime (int64_t nTime)
 ISO 8601 formatting is preferred. More...
 
std::string FormatISO8601Date (int64_t nTime)
 
int64_t ParseISO8601DateTime (const std::string &str)
 

Function Documentation

int64_t count_microseconds ( std::chrono::microseconds  t)
inline

Definition at line 26 of file time.h.

int64_t count_seconds ( std::chrono::seconds  t)
inline

Helper to count the seconds of a duration.

All durations should be using std::chrono and calling this should generally be avoided in code. Though, it is still preferred to an inline t.count() to protect against a reliance on the exact type of t.

This helper is used to convert durations before passing them over an interface that doesn't support std::chrono (e.g. RPC, debug log, or the GUI)

Definition at line 25 of file time.h.

Here is the caller graph for this function:

std::string FormatISO8601Date ( int64_t  nTime)

Definition at line 94 of file time.cpp.

Here is the caller graph for this function:

std::string FormatISO8601DateTime ( int64_t  nTime)

ISO 8601 formatting is preferred.

Use the FormatISO8601{DateTime,Date} helper functions if possible.

Definition at line 81 of file time.cpp.

Here is the caller graph for this function:

int64_t GetMockTime ( )

For testing.

Definition at line 55 of file time.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t GetSystemTimeInSeconds ( )

Returns the system time (not mockable)

Definition at line 76 of file time.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t GetTime ( )

DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)

Return system time (or mocked time, if set)

DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)

Definition at line 25 of file time.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t GetTimeMicros ( )

Returns the system time (not mockable)

Definition at line 68 of file time.cpp.

Here is the caller graph for this function:

int64_t GetTimeMillis ( )

Returns the system time (not mockable)

Definition at line 60 of file time.cpp.

Here is the caller graph for this function:

int64_t ParseISO8601DateTime ( const std::string &  str)

Definition at line 107 of file time.cpp.

Here is the caller graph for this function:

void SetMockTime ( int64_t  nMockTimeIn)

For testing.

Set e.g. with the setmocktime rpc, or -mocktime argument

Definition at line 49 of file time.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void UninterruptibleSleep ( const std::chrono::microseconds &  n)

Definition at line 21 of file time.cpp.

Here is the caller graph for this function: