PIVX Core  5.6.99
P2P Digital Currency
utiltime.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin developers
3 // Copyright (c) 2016-2021 The PIVX Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #ifndef PIVX_UTILTIME_H
8 #define PIVX_UTILTIME_H
9 
10 #include <stdint.h>
11 #include <string>
12 #include <chrono>
13 
14 void UninterruptibleSleep(const std::chrono::microseconds& n);
15 
20 int64_t GetTime();
22 int64_t GetTimeMillis();
24 int64_t GetTimeMicros();
26 int64_t GetSystemTimeInSeconds(); // Like GetTime(), but not mockable
28 void SetMockTime(int64_t nMockTimeIn);
30 int64_t GetMockTime();
31 
32 void MilliSleep(int64_t n);
33 
34 std::string DurationToDHMS(int64_t nDurationTime);
35 
37 template <typename T>
38 T GetTime();
39 
44 std::string FormatISO8601DateTime(int64_t nTime);
45 std::string FormatISO8601DateTimeForBackup(int64_t nTime);
46 std::string FormatISO8601Date(int64_t nTime);
47 std::string FormatISO8601Time(int64_t nTime);
48 
49 #endif // PIVX_UTILTIME_H
#define T(expected, seed, data)
int64_t GetTimeMicros()
Returns the system time (not mockable)
Definition: utiltime.cpp:74
int64_t GetTimeMillis()
Returns the system time (not mockable)
Definition: utiltime.cpp:61
int64_t GetSystemTimeInSeconds()
Returns the system time (not mockable)
Definition: utiltime.cpp:69
void UninterruptibleSleep(const std::chrono::microseconds &n)
Definition: utiltime.cpp:22
int64_t GetTime()
DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
Definition: utiltime.cpp:27
std::string FormatISO8601Date(int64_t nTime)
Definition: utiltime.cpp:128
std::string DurationToDHMS(int64_t nDurationTime)
Definition: utiltime.cpp:87
void SetMockTime(int64_t nMockTimeIn)
For testing.
Definition: utiltime.cpp:51
std::string FormatISO8601Time(int64_t nTime)
Definition: utiltime.cpp:141
int64_t GetMockTime()
For testing.
Definition: utiltime.cpp:56
std::string FormatISO8601DateTimeForBackup(int64_t nTime)
Definition: utiltime.cpp:115
void MilliSleep(int64_t n)
Definition: utiltime.cpp:82
std::string FormatISO8601DateTime(int64_t nTime)
ISO 8601 formatting is preferred.
Definition: utiltime.cpp:102