#include <util/time.h>
#include <compat.h>
#include <util/check.h>
#include <util/strencodings.h>
#include <tinyformat.h>
#include <atomic>
#include <chrono>
#include <optional>
#include <string>
#include <string_view>
#include <thread>
Go to the source code of this file.
◆ 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.
Definition at line 78 of file time.cpp.
◆ GetMockTime()
| std::chrono::seconds GetMockTime |
( |
| ) |
|
For testing.
Definition at line 54 of file time.cpp.
◆ GetSystemTime()
template<typename T >
| static T GetSystemTime |
( |
| ) |
|
|
static |
◆ GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
ClockType is
- SteadyClock/std::chrono::steady_clock for steady time
- SystemClock/std::chrono::system_clock for system time
- NodeClock for mockable system time
Definition at line 62 of file time.cpp.
◆ GetTimeMillis()
| int64_t GetTimeMillis |
( |
| ) |
|
Returns the system time (not mockable)
Definition at line 58 of file time.cpp.
◆ IsInvalidTimestamp()
| static bool IsInvalidTimestamp |
( |
int64_t |
nTime | ) |
|
|
static |
◆ MillisToTimeval() [1/2]
| struct timeval MillisToTimeval |
( |
int64_t |
nTimeout | ) |
|
Convert milliseconds to a struct timeval for e.g.
select.
Definition at line 130 of file time.cpp.
◆ MillisToTimeval() [2/2]
| struct timeval MillisToTimeval |
( |
std::chrono::milliseconds |
ms | ) |
|
Convert milliseconds to a struct timeval for e.g.
select.
Definition at line 137 of file time.cpp.
◆ nMockTime()
| static std::atomic< int64_t > nMockTime |
( |
0 |
| ) |
|
|
static |
◆ ParseISO8601DateTime()
| std::optional< int64_t > ParseISO8601DateTime |
( |
std::string_view |
str | ) |
|
◆ SetMockTime() [1/2]
| void SetMockTime |
( |
int64_t |
nMockTimeIn | ) |
|
DEPRECATED Use SetMockTime with chrono type.
- Parameters
-
| [in] | nMockTimeIn | Time in seconds. |
Definition at line 46 of file time.cpp.
◆ 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 51 of file time.cpp.
◆ UninterruptibleSleep()
| void UninterruptibleSleep |
( |
const std::chrono::microseconds & |
n | ) |
|