Bitcoin
|
#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_t > | nMockTime (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) |
std::string FormatISO8601Date | ( | int64_t | nTime | ) |
std::string FormatISO8601DateTime | ( | int64_t | nTime | ) |
ISO 8601 formatting is preferred. Use the FormatISO8601{DateTime,Date} helper functions if possible.
int64_t GetMockTime | ( | ) |
For testing
int64_t GetSystemTimeInSeconds | ( | ) |
Returns the system time (not mockable)
T GetTime | ( | ) |
Return system time (or mocked time, if set)
int64_t GetTimeMicros | ( | ) |
Returns the system time (not mockable)
int64_t GetTimeMillis | ( | ) |
Returns the system time (not mockable)
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
|
static |
For unit testing.
void SetMockTime | ( | int64_t | nMockTimeIn | ) |
For testing. Set e.g. with the setmocktime rpc, or -mocktime argument