Use the new uptime code. Replace slow, non-monotonic 'time(NULL)' calls

with fast, almost-always-monotonic 'upTime()' calls.
This commit is contained in:
JoelKatz
2013-02-05 22:31:26 -08:00
parent 8c36646b8c
commit 1808454983
10 changed files with 44 additions and 35 deletions

View File

@@ -22,7 +22,7 @@ DECLARE_INSTANCE(LedgerAcquire);
PeerSet::PeerSet(const uint256& hash, int interval) : mHash(hash), mTimerInterval(interval), mTimeouts(0),
mComplete(false), mFailed(false), mProgress(true), mAggressive(true), mTimer(theApp->getIOService())
{
mLastAction = time(NULL);
mLastAction = upTime();
assert((mTimerInterval > 10) && (mTimerInterval < 30000));
}
@@ -890,7 +890,7 @@ void LedgerAcquireMaster::sweep()
{
mRecentFailures.sweep();
time_t now = time(NULL);
int now = upTime();
boost::mutex::scoped_lock sl(mLock);
std::map<uint256, LedgerAcquire::pointer>::iterator it = mLedgers.begin();