57 public:
Time(
const struct timeval &_tv);
61 public:
Time(
const struct timespec &_tv);
66 public:
Time(int32_t _sec, int32_t _nsec);
70 public:
Time(
double _time);
73 public:
virtual ~
Time();
77 public:
static const Time &GetWallTime();
81 public:
static const std::string &GetWallTimeAsISOString();
84 public:
void SetToWallTime();
89 public:
void Set(int32_t _sec, int32_t _nsec);
93 public:
void Set(
double _seconds);
97 public:
double Double()
const;
101 public:
float Float()
const;
111 public:
static Time MSleep(
unsigned int _ms);
116 public:
static Time NSleep(
unsigned int _ns);
121 public:
Time &operator =(
const struct timeval &_tv);
126 public:
Time &operator =(
const struct timespec &_tv);
131 public:
Time &operator =(
const Time &_time);
136 public:
Time operator +(
const struct timeval &_tv)
const;
141 public:
Time operator +(
const struct timespec &_tv)
const;
146 public:
const Time &operator +=(
const struct timeval &_tv);
151 public:
const Time &operator +=(
const struct timespec &_tv);
156 public:
Time operator +(
const Time &_time)
const;
161 public:
const Time &operator +=(
const Time &_time);
166 public:
Time operator -(
const struct timeval &_tv)
const;
171 public:
const Time &operator -=(
const struct timeval &_tv);
176 public:
Time operator -(
const struct timespec &_tv)
const;
181 public:
const Time &operator -=(
const struct timespec &_tv);
186 public:
Time operator -(
const Time &_time)
const;
191 public:
const Time &operator -=(
const Time &_time);
196 public:
Time operator *(
const struct timeval &_tv)
const;
201 public:
const Time &operator *=(
const struct timeval &_tv);
206 public:
Time operator *(
const struct timespec &_tv)
const;
211 public:
const Time &operator *=(
const struct timespec &_tv);
216 public:
Time operator *(
const Time &_time)
const;
221 public:
const Time &operator *=(
const Time &_time);
226 public:
Time operator /(
const struct timeval &_tv)
const;
231 public:
const Time &operator /=(
const struct timeval &_tv);
236 public:
Time operator /(
const struct timespec &_tv)
const;
241 public:
const Time &operator /=(
const struct timespec &_tv);
246 public:
Time operator /(
const Time &_time)
const;
251 public:
const Time &operator /=(
const Time &time);
256 public:
bool operator ==(
const struct timeval &_tv)
const;
261 public:
bool operator ==(
const struct timespec &_tv)
const;
266 public:
bool operator ==(
const Time &_time)
const;
271 public:
bool operator ==(
double _time)
const;
276 public:
bool operator!=(
const struct timeval &_tv)
const;
281 public:
bool operator!=(
const struct timespec &_tv)
const;
286 public:
bool operator!=(
const Time &_time)
const;
291 public:
bool operator!=(
double _time)
const;
296 public:
bool operator<(
const struct timeval &_tv)
const;
301 public:
bool operator<(
const struct timespec &_tv)
const;
306 public:
bool operator<(
const Time &_time)
const;
311 public:
bool operator<(
double _time)
const;
316 public:
bool operator<=(
const struct timeval &_tv)
const;
321 public:
bool operator<=(
const struct timespec &_tv)
const;
326 public:
bool operator<=(
const Time &_time)
const;
331 public:
bool operator<=(
double _time)
const;
336 public:
bool operator>(
const struct timeval &_tv)
const;
341 public:
bool operator>(
const struct timespec &_tv)
const;
346 public:
bool operator>(
const Time &_time)
const;
351 public:
bool operator>(
double _time)
const;
356 public:
bool operator>=(
const struct timeval &_tv)
const;
361 public:
bool operator>=(
const struct timespec &_tv)
const;
366 public:
bool operator>=(
const Time &_time)
const;
371 public:
bool operator>=(
double _time)
const;
377 {
return _sec * 1e9;}
398 _out << _time.
sec <<
" " << _time.
nsec;
410 _in.setf(std::ios_base::skipws);
411 _in >> _time.
sec >> _time.
nsec;
422 private:
static Time wallTime;
425 private:
static std::string wallTimeISO;
429 private:
inline void Correct()
432 if (this->sec > 0 && this->nsec < 0)
434 int32_t n = abs(this->nsec / 1e9) + 1;
436 this->nsec += n * 1e9;
438 if (this->sec < 0 && this->nsec > 0)
440 int32_t n = abs(this->nsec / 1e9) + 1;
442 this->nsec -= n * 1e9;
446 this->sec += this->nsec /
static_cast<int32_t
>(1e9);
447 this->nsec = this->nsec %
static_cast<int32_t
>(1e9);
449 private:
static struct timespec clockResolution;