Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <tinyformat.h>#include <utiltime.h>#include <atomic>#include <boost/date_time/posix_time/posix_time.hpp>#include <boost/thread.hpp>#include <chrono>
Include dependency graph for utiltime.cpp:Go to the source code of this file.
Functions | |
| static std::atomic< int64_t > | nMockTime (0) |
| For unit testing. More... | |
| int64_t | GetTime () |
| Return system time (or mocked time, if set) More... | |
| void | SetMockTime (int64_t nMockTimeIn) |
| For testing. More... | |
| int64_t | GetMockTime () |
| For testing. More... | |
| int64_t | GetTimeMillis () |
| Returns the system time (not mockable) More... | |
| int64_t | GetTimeMicros () |
| Returns the system time (not mockable) More... | |
| int64_t | GetSystemTimeInSeconds () |
| Returns the system time (not mockable) More... | |
| void | MilliSleep (int64_t n) |
| std::string | DateTimeStrFormat (const char *pszFormat, int64_t nTime) |
Function Documentation
◆ DateTimeStrFormat()
| std::string DateTimeStrFormat | ( | const char * | pszFormat, |
| int64_t | nTime | ||
| ) |
Definition at line 93 of file utiltime.cpp.
Referenced by AppInitMain(), CWallet::AutoBackupWallet(), EncodeDumpTime(), InvalidChainFound(), LoadChainTip(), LogTimestampStr(), llmq::CDKGDebugStatus::ToJson(), CBlockFileInfo::ToString(), UpdateTip(), and PaymentServer::verifyExpired().
◆ GetMockTime()
| int64_t GetMockTime | ( | ) |
For testing.
Definition at line 51 of file utiltime.cpp.
References nMockTime().
Referenced by LogTimestampStr().
◆ GetSystemTimeInSeconds()
| int64_t GetSystemTimeInSeconds | ( | ) |
Returns the system time (not mockable)
Definition at line 70 of file utiltime.cpp.
References GetTimeMicros().
Referenced by CConnman::AttemptToEvictConnection(), CConnman::InactivityCheck(), CMasternodeUtils::ProcessMasternodeConnections(), CConnman::SocketSendData(), and RPCConsole::updateNodeDetail().
◆ GetTime()
| T GetTime | ( | ) |
Return system time (or mocked time, if set)
DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
Definition at line 22 of file utiltime.cpp.
References nMockTime().
Referenced by CTxMemPool::_clear(), AcceptToMemoryPool(), CNetFulfilledRequestManager::AddFulfilledRequest(), AddOrphanTx(), AppInitMain(), CWallet::AutoBackupWallet(), CConnman::Ban(), BenchTimeDeprecated(), PeerLogicValidation::BlockConnected(), CMasternodeSync::BumpAssetLastTime(), CNetFulfilledRequestManager::CheckAndRemove(), PeerLogicValidation::CheckForStaleTipAndEvictPeers(), CPrivateSendClientSession::CheckTimeout(), CKeyPool::CKeyPool(), convertSeed6(), CWalletKey::CWalletKey(), dumpwallet(), CWallet::GenerateNewKey(), GetAdjustedTime(), getblocktemplate(), CConnman::GetMaxOutboundTimeLeftInCycle(), CTxMemPool::GetMinFee(), CWallet::GetOldestKeyPoolTime(), CNetFulfilledRequestManager::HasFulfilledRequest(), CPrivateSendServer::HasTimedOut(), PeerLogicValidation::InitializeNode(), CConnman::IsBanned(), IsCurrentForFeeEstimation(), CPendingDsaRequest::IsExpired(), IsInitialBlockDownload(), CPrivateSendClientSession::JoinExistingQueue(), LimitMempoolSize(), LimitOrphanTxSize(), ListObjects(), LoadMempool(), CGovernanceManager::MasternodeRateUpdate(), MaybeCompactWalletDB(), MasternodeList::on_checkBoxMyMasternodesOnly_stateChanged(), MasternodeList::on_filterLineEditDIP3_textChanged(), BerkeleyEnvironment::Open(), OverviewPage::privateSendStatus(), ProcessHeadersMessage(), ProcessMessage(), CPrivateSendClientSession::ProcessPendingDsaRequest(), CPrivateSendClientSession::ProcessPoolStateUpdate(), CMasternodeSync::ProcessTick(), RandAddSeedPerfmon(), CConnman::RecordBytesSent(), BerkeleyBatch::Recover(), RelayAddress(), CTxMemPool::removeForBlock(), CGovernanceManager::RequestGovernanceObjectVotes(), CWallet::ResendWalletTransactions(), resendwallettransactions(), CMasternodeSync::Reset(), CWallet::ScanForWalletTransactions(), CPrivateSendClientSession::SendDenominate(), PeerLogicValidation::SendMessages(), CConnman::SetMaxOutboundTimeframe(), CPrivateSendBaseSession::SetNull(), CPrivateSendServer::SetState(), CPrivateSendClientSession::SignFinalTransaction(), CPrivateSendClientSession::StartNewQueue(), CConnman::SweepBanned(), CMasternodeSync::SwitchToNextAsset(), CConnman::ThreadDNSAddressSeed(), CConnman::ThreadOpenConnections(), MasternodeList::updateDIP3List(), MasternodeList::updateDIP3ListScheduled(), BitcoinGUI::updateHeadersSyncProgressLabel(), uptime(), PaymentServer::verifyExpired(), and walletpassphrase().
◆ GetTimeMicros()
| int64_t GetTimeMicros | ( | ) |
Returns the system time (not mockable)
Definition at line 63 of file utiltime.cpp.
Referenced by CalcCbTxMerkleRootMNList(), CalcCbTxMerkleRootQuorums(), CheckCbTxMerkleRoots(), CChainState::ConnectBlock(), CChainState::ConnectTip(), CNode::copyStats(), BlockAssembler::CreateNewBlock(), CChainState::DisconnectTip(), DumpMempool(), FlushStateToDisk(), CBlockPolicyEstimator::FlushUnconfirmed(), GetSystemTimeInSeconds(), CConnman::InactivityCheck(), LogTimestampStr(), ProcessMessage(), ProcessSpecialTxsInBlock(), CNode::ReceiveMsgBytes(), PeerLogicValidation::SendMessages(), and CConnman::ThreadOpenConnections().
◆ GetTimeMillis()
| int64_t GetTimeMillis | ( | ) |
Returns the system time (not mockable)
Definition at line 56 of file utiltime.cpp.
Referenced by AppInitMain(), BenchTimeMillisSys(), BlockTipChanged(), CWallet::ChangeWalletPassphrase(), llmq::CChainLocksHandler::Cleanup(), llmq::CSigningManager::Cleanup(), llmq::CDKGSessionManager::CleanupCache(), CWallet::CreateWalletFromFile(), CConnman::DisconnectNodes(), CFlatDB< T >::Dump(), CConnman::DumpAddresses(), CConnman::DumpBanlist(), CWallet::EncryptWallet(), BerkeleyEnvironment::Flush(), getnettotals(), llmq::CDKGSessionManager::GetVerifiedContribution(), CGovernanceManager::InitOnLoad(), InterruptibleRecv(), LoadExternalBlockFile(), BerkeleyBatch::PeriodicFlush(), llmq::CChainLocksHandler::ProcessNewChainLock(), CMasternodeSync::ProcessTick(), CFlatDB< T >::Read(), llmq::CDKGSessionHandler::SleepBeforePhase(), CConnman::Start(), ThreadImport(), CConnman::ThreadMessageHandler(), CConnman::ThreadSocketHandler(), llmq::CSigSharesManager::WorkThreadMain(), CFlatDB< T >::Write(), and llmq::CRecoveredSigsDb::WriteRecoveredSig().
◆ MilliSleep()
| 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
Definition at line 75 of file utiltime.cpp.
Referenced by BerkeleyDatabase::Backup(), BLSVerify_BatchedParallel(), CommandLineRPC(), HTTPReq_JSONRPC(), RenameThreadPool(), BerkeleyBatch::Rewrite(), Sleep100ms(), llmq::CDKGSessionHandler::SleepBeforePhase(), stop(), CPrivateSendClientSession::UnlockCoins(), llmq::CDKGSessionHandler::WaitForNewQuorum(), llmq::CDKGSessionHandler::WaitForNextPhase(), and WaitForShutdown().
◆ nMockTime()
|
static |
For unit testing.
Referenced by GetMockTime(), GetTime(), and SetMockTime().
◆ SetMockTime()
| void SetMockTime | ( | int64_t | nMockTimeIn | ) |
For testing.
Set e.g. with the setmocktime rpc, or -mocktime argument
Definition at line 46 of file utiltime.cpp.
References nMockTime().
Referenced by AddTx(), AppInitParameterInteraction(), BenchTimeMock(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and setmocktime().

