diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-06-08 02:03:31 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-06-09 02:05:34 +0900 |
| commit | 99cd73c0926f0c07d27777fde2f15816e8040030 (patch) | |
| tree | 7c6a077b0590c49029c76686afb9c2ab1d00bb6d /src/AbstractCommand.cc | |
| parent | 2874f6ab095a30a4d297cdc85fa3730bec41b1c2 (diff) | |
Replace timer facility with chrono lib
Diffstat (limited to 'src/AbstractCommand.cc')
| -rw-r--r-- | src/AbstractCommand.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index ba1297bc..ae7f5b2f 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -237,7 +237,8 @@ bool AbstractCommand::execute() if (req_ && fileEntry_->getLength() > 0 && e_->getRequestGroupMan()->getMaxOverallDownloadSpeedLimit() == 0 && requestGroup_->getMaxDownloadSpeedLimit() == 0 && - serverStatTimer_.difference(global::wallclock()) >= 10) { + serverStatTimer_.difference(global::wallclock()) >= + std::chrono::seconds(10)) { serverStatTimer_ = global::wallclock(); std::vector<std::pair<size_t, std::string>> usedHosts; if (getOption()->getAsBool(PREF_SELECT_LEAST_USED_HOST)) { @@ -284,7 +285,7 @@ bool AbstractCommand::execute() A2_LOG_DEBUG("All segments are ignored."); // This will execute other idle Commands and let them // finish quickly. - e_->setRefreshInterval(0); + e_->setRefreshInterval(std::chrono::milliseconds(0)); return true; } @@ -386,7 +387,8 @@ bool AbstractCommand::execute() } Timer wakeTime(global::wallclock()); - wakeTime.advance(getOption()->getAsInt(PREF_RETRY_WAIT)); + wakeTime.advance( + std::chrono::seconds(getOption()->getAsInt(PREF_RETRY_WAIT))); req_->setWakeTime(wakeTime); return prepareForRetry(0); } @@ -401,7 +403,7 @@ bool AbstractCommand::execute() A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, err); } requestGroup_->setHaltRequested(true); - getDownloadEngine()->setRefreshInterval(0); + getDownloadEngine()->setRefreshInterval(std::chrono::milliseconds(0)); return true; } } @@ -457,7 +459,7 @@ bool AbstractCommand::prepareForRetry(time_t wait) } else { // We don't use wait so that Command can be executed by - // DownloadEngine::setRefreshInterval(0). + // DownloadEngine::setRefreshInterval(std::chrono::milliseconds(0)). command->setStatus(Command::STATUS_INACTIVE); } e_->addCommand(std::move(command)); |
