![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include "tinyformat.h"
#include "utiltime.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
Go to the source code of this file.
Functions | |
int64_t | GetTime () |
For unit testing. More... | |
void | SetMockTime (int64_t nMockTimeIn) |
int64_t | GetTimeMillis () |
int64_t | GetTimeMicros () |
int64_t | GetSystemTimeInSeconds () |
int64_t | GetLogTimeMicros () |
void | MilliSleep (int64_t n) |
std::string | DateTimeStrFormat (const char *pszFormat, int64_t nTime) |
std::string | DurationToDHMS (int64_t nDurationTime) |
Variables | |
static int64_t | nMockTime = 0 |
std::string DateTimeStrFormat | ( | const char * | pszFormat, |
int64_t | nTime | ||
) |
Definition at line 81 of file utiltime.cpp.
Referenced by AppInit2(), CNode::AskFor(), AutoBackupWallet(), EncodeDumpTime(), InvalidChainFound(), LoadBlockIndexDB(), LogTimestampStr(), CBlockFileInfo::ToString(), MasternodeList::updateMyMasternodeInfo(), MasternodeList::updateNodeList(), UpdateTip(), and PaymentServer::verifyExpired().
std::string DurationToDHMS | ( | int64_t | nDurationTime | ) |
Definition at line 91 of file utiltime.cpp.
Referenced by MasternodeList::updateMyMasternodeInfo(), and MasternodeList::updateNodeList().
int64_t GetLogTimeMicros | ( | ) |
Return a time useful for the debug log
Definition at line 56 of file utiltime.cpp.
Referenced by LogTimestampStr().
int64_t GetSystemTimeInSeconds | ( | ) |
Definition at line 50 of file utiltime.cpp.
Referenced by CNode::CNode(), CConnman::ConnectNode(), CConnman::SocketSendData(), CConnman::ThreadSocketHandler(), and RPCConsole::updateNodeDetail().
int64_t GetTime | ( | ) |
For unit testing.
GetTimeMicros() and GetTimeMillis() both return the system time, but in different units. GetTime() returns the sytem time in seconds, but also supports mocktime, where the time can be specified by the user, eg for testing (eg with the setmocktime rpc, or -mocktime argument).
TODO: Rework these functions to be type-safe (so that we don't inadvertently compare numbers with different units, or compare a mocktime to system time).
Definition at line 20 of file utiltime.cpp.
Referenced by CTxMemPool::_clear(), AcceptToMemoryPoolWorker(), CNetFulfilledRequestManager::AddFulfilledRequest(), AppInit2(), CNode::AskFor(), CMasternodeMan::AskForMN(), AutoBackupWallet(), CConnman::Ban(), BitcoinMiner(), CMasternodeSync::BumpAssetLastTime(), CMasternode::Check(), CNetFulfilledRequestManager::CheckAndRemove(), CInstantSend::CheckAndRemove(), CMasternodeMan::CheckAndRemove(), CheckBlock(), CMasternodeMan::CheckMnbAndUpdateMasternodeList(), CKeyPool::CKeyPool(), ConnectBlock(), convertSeed6(), CWalletKey::CWalletKey(), CMasternodeMan::DsegUpdate(), dumpwallet(), CSporkManager::ExecuteSpork(), CMasternodeSync::Fail(), CWallet::GenerateNewKey(), GetAdjustedTime(), getblocktemplate(), CConnman::GetMaxOutboundTimeLeftInCycle(), CTxMemPool::GetMinFee(), CWallet::GetOldestKeyPoolTime(), gobject(), CNetFulfilledRequestManager::HasFulfilledRequest(), CConnman::IsBanned(), CTxLockVote::IsFailed(), IsInitialBlockDownload(), CTxLockVote::IsTimedOut(), CTxLockCandidate::IsTimedOut(), CMasternodeMan::IsWatchdogActive(), LimitMempoolSize(), MasternodeList::MasternodeList(), CGovernanceManager::MasternodeRateUpdate(), CPrivateSendClient::NewBlock(), MasternodeList::on_filterLineEdit_textChanged(), CMasternodeMan::ProcessMessage(), ProcessMessage(), CMasternodeSync::ProcessTick(), CInstantSend::ProcessTxLockVote(), RandAddSeedPerfmon(), CConnman::RecordBytesSent(), CWalletDB::Recover(), RelayAddress(), CConnman::RelayTransaction(), CTxMemPool::removeForBlock(), ReprocessBlocks(), CGovernanceManager::RequestGovernanceObjectVotes(), CWallet::ResendWalletTransactions(), resendwallettransactions(), CMasternodeSync::Reset(), CWallet::ScanForWalletTransactions(), CConnman::SetMaxOutboundTimeframe(), CConnman::SweepBanned(), CMasternodeSync::SwitchToNextAsset(), CConnman::ThreadDNSAddressSeed(), ThreadFlushWalletDB(), CConnman::ThreadOpenConnections(), BitcoinGUI::updateHeadersSyncProgressLabel(), CMasternodeMan::UpdateMasternodeList(), MasternodeList::updateMyNodeList(), MasternodeList::updateNodeList(), CMasternodeMan::UpdateWatchdogVoteTime(), CWallet::Verify(), PaymentServer::verifyExpired(), and walletpassphrase().
int64_t GetTimeMicros | ( | ) |
Definition at line 42 of file utiltime.cpp.
Referenced by CNode::AskFor(), ConnectBlock(), ConnectTip(), CNode::copyStats(), DisconnectTip(), FlushStateToDisk(), GetLogTimeMicros(), GetSystemTimeInSeconds(), CNode::ReceiveMsgBytes(), SendMessages(), CConnman::ThreadOpenConnections(), and CConnman::ThreadSocketHandler().
int64_t GetTimeMillis | ( | ) |
Definition at line 34 of file utiltime.cpp.
Referenced by CPrivateSendServer::AddEntry(), CPrivateSendServer::AddUserToExistingSession(), AppInit2(), BlockTipChanged(), CWallet::ChangeWalletPassphrase(), CPrivateSendServer::CheckPool(), CPrivateSendClient::CheckPool(), CPrivateSendClient::CheckPoolStateUpdate(), CPrivateSendServer::CheckTimeout(), CPrivateSendClient::CheckTimeout(), CPrivateSendServer::CreateNewSession(), CFlatDB< T >::Dump(), CConnman::DumpAddresses(), CConnman::DumpBanlist(), CWallet::EncryptWallet(), CDBEnv::Flush(), getnettotals(), CGovernanceManager::InitOnLoad(), InterruptibleRecv(), CPrivateSendClient::JoinExistingQueue(), LoadExternalBlockFile(), OverviewPage::privateSendStatus(), CFlatDB< T >::Read(), CPrivateSendClient::SendDenominate(), CPrivateSendBase::SetNull(), CPrivateSendClient::SignFinalTransaction(), CConnman::Start(), CPrivateSendClient::StartNewQueue(), ThreadFlushWalletDB(), and CFlatDB< T >::Write().
void MilliSleep | ( | int64_t | n | ) |
Boost's sleep_for was uninterruptable 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
Definition at line 63 of file utiltime.cpp.
Referenced by AppInit2(), BackupWallet(), BitcoinMiner(), CommandLineRPC(), HTTPReq_JSONRPC(), CDB::Rewrite(), Sleep100ms(), ThreadCheckPrivateSend(), ThreadCheckPrivateSendClient(), ThreadCheckPrivateSendServer(), ThreadFlushWalletDB(), ThreadSendAlert(), CPrivateSendClient::UnlockCoins(), and WaitForShutdown().
void SetMockTime | ( | int64_t | nMockTimeIn | ) |
Definition at line 29 of file utiltime.cpp.
Referenced by AppInit2(), and setmocktime().
|
static |
Definition at line 18 of file utiltime.cpp.
Referenced by GetLogTimeMicros(), GetTime(), and SetMockTime().