/* */ #include "TimeBasedCommand.h" #include "DownloadEngine.h" namespace aria2 { TimeBasedCommand::TimeBasedCommand(int32_t cuid, DownloadEngine* e, time_t interval, bool routineCommand): Command(cuid), _e(e),_exit(false), _interval(interval), _routineCommand(routineCommand) {} TimeBasedCommand::~TimeBasedCommand() {} bool TimeBasedCommand::execute() { preProcess(); if(_exit) { return true; } if(_checkPoint.elapsed(_interval)) { _checkPoint.reset(); process(); if(_exit) { return true; } } postProcess(); if(_exit) { return true; } if(_routineCommand) { _e->addRoutineCommand(this); } else { _e->commands.push_back(this); } return false; } } // namespace aria2