summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-03-06 14:30:05 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-03-06 14:30:05 +0000
commite3b5d608939b2226bffb4c54fba1902c7d01e5c5 (patch)
treed57a71429edc4944f423983c1402ba1ead83c8dc /src
parentb1713e63738839e861f0b10ef6ad58f0e93aef3e (diff)
2010-03-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
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
Diffstat (limited to 'src')
-rw-r--r--src/BtLeecherStateChoke.cc2
-rw-r--r--src/BtSeederStateChoke.cc2
-rw-r--r--src/PeerSessionResource.cc5
-rw-r--r--src/RequestSlot.cc2
-rw-r--r--src/ServerStat.cc5
-rw-r--r--src/SpeedCalc.cc6
6 files changed, 12 insertions, 10 deletions
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<SharedHandle<Peer> >& peerSet)
{
_logger->info("Leecher state, %d choke round started", _round);
- _lastRound.reset();
+ _lastRound = global::wallclock;
std::vector<PeerEntry> 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<SharedHandle<Peer> >& peerSet)
{
_logger->info("Seeder state, %d choke round started", _round);
- _lastRound.reset();
+ _lastRound = global::wallclock;
std::vector<PeerEntry> 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;
}