Bitcoin
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>

Functions

static std::atomic< int64_tnMockTime (0)
 For unit testing. More...
 
int64_t GetTime ()
 
void SetMockTime (int64_t nMockTimeIn)
 
int64_t GetMockTime ()
 
int64_t GetTimeMillis ()
 
int64_t GetTimeMicros ()
 
int64_t GetSystemTimeInSeconds ()
 
void MilliSleep (int64_t n)
 
std::string FormatISO8601DateTime (int64_t nTime)
 
std::string FormatISO8601Date (int64_t nTime)
 

Function Documentation

◆ FormatISO8601Date()

std::string FormatISO8601Date ( int64_t  nTime)

◆ FormatISO8601DateTime()

std::string FormatISO8601DateTime ( int64_t  nTime)

ISO 8601 formatting is preferred. Use the FormatISO8601{DateTime,Date} helper functions if possible.

◆ GetMockTime()

int64_t GetMockTime ( )

For testing

◆ GetSystemTimeInSeconds()

int64_t GetSystemTimeInSeconds ( )

Returns the system time (not mockable)

◆ GetTime()

T GetTime ( )

Return system time (or mocked time, if set)

◆ GetTimeMicros()

int64_t GetTimeMicros ( )

Returns the system time (not mockable)

◆ GetTimeMillis()

int64_t GetTimeMillis ( )

Returns the system time (not mockable)

◆ 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

◆ nMockTime()

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

For unit testing.

◆ SetMockTime()

void SetMockTime ( int64_t  nMockTimeIn)

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