/* */ #ifndef _D_TIME_H_ #define _D_TIME_H_ #include "common.h" #include "a2time.h" #include namespace aria2 { class Time { private: struct timeval tv; struct timeval getCurrentTime() const; public: // The time value is initialized so that it represents the time at which // this object was created. Time(); Time(const Time& time); Time(int32_t sec); Time& operator=(const Time& time); ~Time(); // Makes this object's time value up to date. void reset(); bool elapsed(int32_t sec) const; bool elapsedInMillis(int32_t millis) const; int32_t difference() const; int64_t differenceInMillis() const; int64_t differenceInMillis(const struct timeval& now) const; // Returns true if this object's time value is zero. bool isZero() const; int64_t getTimeInMicros() const; int64_t getTimeInMillis() const; // Returns this object's time value in seconds. int32_t getTime() const; void setTimeInSec(int32_t sec); bool isNewer(const Time& time) const; }; } // namespace aria2 #endif // _D_TIME_H_