Bitcoin Core  0.19.99
P2P Digital Currency
Functions
time.cpp File Reference
#include <util/time.h>
#include <atomic>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
#include <ctime>
#include <tinyformat.h>
Include dependency graph for time.cpp:

Go to the source code of this file.

Functions

static std::atomic< int64_t > nMockTime (0)
 For unit testing. More...
 
int64_t GetTime ()
 Return system time (or mocked time, if set) More...
 
void SetMockTime (int64_t nMockTimeIn)
 For testing. More...
 
int64_t GetMockTime ()
 For testing. 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 MilliSleep (int64_t n)
 
std::string FormatISO8601DateTime (int64_t nTime)
 ISO 8601 formatting is preferred. More...
 
std::string FormatISO8601Date (int64_t nTime)
 

Function Documentation

◆ FormatISO8601Date()

std::string FormatISO8601Date ( int64_t  nTime)

Definition at line 104 of file time.cpp.

Here is the caller graph for this function:

◆ FormatISO8601DateTime()

std::string FormatISO8601DateTime ( int64_t  nTime)

ISO 8601 formatting is preferred.

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

Definition at line 93 of file time.cpp.

Here is the caller graph for this function:

◆ GetMockTime()

int64_t GetMockTime ( )

For testing.

Definition at line 49 of file time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSystemTimeInSeconds()

int64_t GetSystemTimeInSeconds ( )

Returns the system time (not mockable)

Definition at line 70 of file time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTime()

T GetTime ( )

Return system time (or mocked time, if set)

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

Definition at line 20 of file time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTimeMicros()

int64_t GetTimeMicros ( )

Returns the system time (not mockable)

Definition at line 62 of file time.cpp.

Here is the caller graph for this function:

◆ GetTimeMillis()

int64_t GetTimeMillis ( )

Returns the system time (not mockable)

Definition at line 54 of file time.cpp.

Here is the caller graph for this function:

◆ MilliSleep()

void MilliSleep ( int64_t  n)

Boost's sleep_for was uninterruptible when backed by nanosleep from 1.50 until fixed in 1.52. Use the deprecated sleep method for the broken case. See: https://svn.boost.org/trac/boost/ticket/7238

Definition at line 75 of file time.cpp.

Here is the caller graph for this function:

◆ nMockTime()

static std::atomic<int64_t> nMockTime ( )
static

For unit testing.

Here is the caller graph for this function:

◆ SetMockTime()

void SetMockTime ( int64_t  nMockTimeIn)

For testing.

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

Definition at line 44 of file time.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: