Bitcoin Core  27.99.0
P2P Digital Currency
Functions | Variables
time.cpp File Reference
#include <util/time.h>
#include <compat/compat.h>
#include <tinyformat.h>
#include <util/check.h>
#include <atomic>
#include <chrono>
#include <string>
#include <thread>
Include dependency graph for time.cpp:

Go to the source code of this file.

Functions

void UninterruptibleSleep (const std::chrono::microseconds &n)
 
void SetMockTime (int64_t nMockTimeIn)
 DEPRECATED Use SetMockTime with chrono type. More...
 
void SetMockTime (std::chrono::seconds mock_time_in)
 For testing. More...
 
std::chrono::seconds GetMockTime ()
 For testing. More...
 
int64_t GetTime ()
 
std::string FormatISO8601DateTime (int64_t nTime)
 ISO 8601 formatting is preferred. More...
 
std::string FormatISO8601Date (int64_t nTime)
 
struct timeval MillisToTimeval (int64_t nTimeout)
 Convert milliseconds to a struct timeval for e.g. More...
 
struct timeval MillisToTimeval (std::chrono::milliseconds ms)
 Convert milliseconds to a struct timeval for e.g. More...
 

Variables

static std::atomic< std::chrono::seconds > g_mock_time {}
 For testing. More...
 

Function Documentation

◆ FormatISO8601Date()

std::string FormatISO8601Date ( int64_t  nTime)

Definition at line 55 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 46 of file time.cpp.

Here is the caller graph for this function:

◆ GetMockTime()

std::chrono::seconds GetMockTime ( )

For testing.

Definition at line 39 of file time.cpp.

Here is the caller graph for this function:

◆ GetTime()

int64_t GetTime ( )

Definition at line 44 of file time.cpp.

Here is the caller graph for this function:

◆ MillisToTimeval() [1/2]

struct timeval MillisToTimeval ( int64_t  nTimeout)

Convert milliseconds to a struct timeval for e.g.

select.

Definition at line 55 of file time.cpp.

Here is the caller graph for this function:

◆ MillisToTimeval() [2/2]

struct timeval MillisToTimeval ( std::chrono::milliseconds  ms)

Convert milliseconds to a struct timeval for e.g.

select.

Definition at line 55 of file time.cpp.

◆ SetMockTime() [1/2]

void SetMockTime ( int64_t  nMockTimeIn)

DEPRECATED Use SetMockTime with chrono type.

Parameters
[in]nMockTimeInTime in seconds.

Definition at line 32 of file time.cpp.

Here is the caller graph for this function:

◆ SetMockTime() [2/2]

void SetMockTime ( std::chrono::seconds  mock_time_in)

For testing.

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

Definition at line 33 of file time.cpp.

◆ UninterruptibleSleep()

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

Definition at line 17 of file time.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ g_mock_time

std::atomic<std::chrono::seconds> g_mock_time {}
static

For testing.

Definition at line 19 of file time.cpp.