Go to the documentation of this file.
2 #ifndef CNOID_UTIL_TIMEVAL_H
3 #define CNOID_UTIL_TIMEVAL_H
34 if (usec < 0 || usec >= 1000000) {
35 sec += usec / 1000000;
43 usec =
static_cast<long>(usec % 1000000);
44 sec =
static_cast<long>(usec / 1000000);
49 operator long long()
const {
return static_cast<long long>(sec) * 1000000 + usec; }
54 if (usec >= 1000000) {
69 long long t = sec * 1000000 + usec;
70 long long r = rhs.sec * 1000000 + rhs.usec;
72 sec =
static_cast<long>(t / 1000000);
73 usec =
static_cast<long>(t % 1000000);
83 return (x.sec == y.sec && x.usec == y.usec);
88 return (x.usec < y.usec);
89 return (x.sec < y.sec);
98 return os <<
'{' << x.sec <<
',' << x.usec <<
'}';
Timeval()
Definition: Timeval.h:26
Timeval & operator+=(Timeval rhs)
Definition: Timeval.h:51
friend bool operator<=(Timeval x, Timeval y)
Definition: Timeval.h:94
Timeval(long long usec)
Definition: Timeval.h:41
friend bool operator==(Timeval x, Timeval y)
Definition: Timeval.h:82
friend bool operator>(Timeval x, Timeval y)
Definition: Timeval.h:93
friend Timeval operator-(Timeval x, Timeval y)
Definition: Timeval.h:79
friend Timeval operator+(Timeval x, Timeval y)
Definition: Timeval.h:78
friend bool operator<(Timeval x, Timeval y)
Definition: Timeval.h:86
Definition: AbstractSceneLoader.h:11
Timeval(long sec, long usec)
Definition: Timeval.h:31
friend Timeval operator%(Timeval x, Timeval y)
Definition: Timeval.h:80
friend bool operator>=(Timeval x, Timeval y)
Definition: Timeval.h:95
friend std::ostream & operator<<(std::ostream &os, Timeval x)
Definition: Timeval.h:97
friend bool operator!=(Timeval x, Timeval y)
Definition: Timeval.h:92
Timeval & operator%=(Timeval rhs)
Definition: Timeval.h:68
Timeval & operator-=(Timeval rhs)
Definition: Timeval.h:61