diff --git a/ChangeLog b/ChangeLog index 0cfef774..0d8a47b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-03-06 Tatsuhiro Tsujikawa + + Replaced Time::reset() call with assigning of global::wallclock. + * src/BtLeecherStateChoke.cc + * src/BtSeederStateChoke.cc + * src/PeerSessionResource.cc + * src/RequestSlot.cc + * src/ServerStat.cc + * src/SpeedCalc.cc + 2010-03-06 Tatsuhiro Tsujikawa Added changeUri XML-RPC method. This method removes/adds URIs diff --git a/src/BtLeecherStateChoke.cc b/src/BtLeecherStateChoke.cc index bad3deaa..7fd6ca8c 100644 --- a/src/BtLeecherStateChoke.cc +++ b/src/BtLeecherStateChoke.cc @@ -191,7 +191,7 @@ BtLeecherStateChoke::executeChoke (const std::vector >& peerSet) { _logger->info("Leecher state, %d choke round started", _round); - _lastRound.reset(); + _lastRound = global::wallclock; std::vector peerEntries; std::transform(peerSet.begin(), peerSet.end(), diff --git a/src/BtSeederStateChoke.cc b/src/BtSeederStateChoke.cc index a2debb68..4d12fd37 100644 --- a/src/BtSeederStateChoke.cc +++ b/src/BtSeederStateChoke.cc @@ -139,7 +139,7 @@ BtSeederStateChoke::executeChoke (const std::vector >& peerSet) { _logger->info("Seeder state, %d choke round started", _round); - _lastRound.reset(); + _lastRound = global::wallclock; std::vector peerEntries; diff --git a/src/PeerSessionResource.cc b/src/PeerSessionResource.cc index f10a28fc..7c8355f0 100644 --- a/src/PeerSessionResource.cc +++ b/src/PeerSessionResource.cc @@ -40,6 +40,7 @@ #include "BitfieldMan.h" #include "A2STR.h" #include "BtMessageDispatcher.h" +#include "wallclock.h" namespace aria2 { @@ -68,7 +69,7 @@ void PeerSessionResource::amChoking(bool b) { _amChoking = b; if(!b) { - _lastAmUnchoking.reset(); + _lastAmUnchoking = global::wallclock; } } @@ -252,7 +253,7 @@ void PeerSessionResource::updateDownloadLength(size_t bytes) { _peerStat.updateDownloadLength(bytes); - _lastDownloadUpdate.reset(); + _lastDownloadUpdate = global::wallclock; } uint64_t PeerSessionResource::getCompletedLength() const diff --git a/src/RequestSlot.cc b/src/RequestSlot.cc index 1f7fc1a2..d10f15cc 100644 --- a/src/RequestSlot.cc +++ b/src/RequestSlot.cc @@ -40,7 +40,7 @@ namespace aria2 { RequestSlot RequestSlot::nullSlot = RequestSlot(); void RequestSlot::setDispatchedTime() { - dispatchedTime.reset(); + dispatchedTime = global::wallclock; } void RequestSlot::setDispatchedTime(time_t secFromEpoch) { diff --git a/src/ServerStat.cc b/src/ServerStat.cc index 24de817a..034ff34a 100644 --- a/src/ServerStat.cc +++ b/src/ServerStat.cc @@ -39,6 +39,7 @@ #include "array_fun.h" #include "LogFactory.h" +#include "wallclock.h" namespace aria2 { @@ -77,7 +78,7 @@ void ServerStat::updateDownloadSpeed(unsigned int downloadSpeed) if(downloadSpeed > 0) { _status = OK; } - _lastUpdated.reset(); + _lastUpdated = global::wallclock; } void ServerStat::setSingleConnectionAvgSpeed @@ -184,7 +185,7 @@ void ServerStat::setStatusInternal(STATUS status) _hostname.c_str(), _protocol.c_str()); } _status = status; - _lastUpdated.reset(); + _lastUpdated = global::wallclock; } void ServerStat::setOK() diff --git a/src/SpeedCalc.cc b/src/SpeedCalc.cc index 59c4fe66..4fcad661 100644 --- a/src/SpeedCalc.cc +++ b/src/SpeedCalc.cc @@ -51,11 +51,11 @@ SpeedCalc::SpeedCalc():sw(0), maxSpeed(0), prevSpeed(0), accumulatedLength(0), void SpeedCalc::reset() { std::fill(&lengthArray[0], &lengthArray[2], 0); - std::for_each(&cpArray[0], &cpArray[2], std::mem_fun_ref(&Time::reset)); + std::fill(&cpArray[0], &cpArray[2], global::wallclock); sw = 0; maxSpeed = 0; prevSpeed = 0; - start.reset(); + start = global::wallclock; accumulatedLength = 0; nextInterval = CHANGE_INTERVAL_SEC; } @@ -95,7 +95,7 @@ bool SpeedCalc::isIntervalOver(int64_t milliElapsed) const void SpeedCalc::changeSw() { lengthArray[sw] = 0; - cpArray[sw].reset(); + cpArray[sw] = global::wallclock; sw ^= 0x01; nextInterval = cpArray[sw].difference(global::wallclock)+CHANGE_INTERVAL_SEC; }