Merge #11221: Refactor: simpler read
[bitcoinplatinum.git] / src / utiltime.h
blob8ae8540b89c7090ccae8b3db516e67530cc765e8
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #ifndef BITCOIN_UTILTIME_H
7 #define BITCOIN_UTILTIME_H
9 #include <stdint.h>
10 #include <string>
12 /**
13 * GetTimeMicros() and GetTimeMillis() both return the system time, but in
14 * different units. GetTime() returns the system time in seconds, but also
15 * supports mocktime, where the time can be specified by the user, eg for
16 * testing (eg with the setmocktime rpc, or -mocktime argument).
18 * TODO: Rework these functions to be type-safe (so that we don't inadvertently
19 * compare numbers with different units, or compare a mocktime to system time).
22 int64_t GetTime();
23 int64_t GetTimeMillis();
24 int64_t GetTimeMicros();
25 int64_t GetSystemTimeInSeconds(); // Like GetTime(), but not mockable
26 void SetMockTime(int64_t nMockTimeIn);
27 int64_t GetMockTime();
28 void MilliSleep(int64_t n);
30 std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime);
32 #endif // BITCOIN_UTILTIME_H