26 #ifndef CPP_NIX_TIMEVAL_H_
27 #define CPP_NIX_TIMEVAL_H_
31 timeval
operator+(
const timeval& a,
const timeval& b);
32 timeval
operator-(
const timeval& a,
const timeval& b);
45 : timeval { sec, usec } {
49 return (*
this) = (*this) +
other;
53 return (*
this) = (*this) -
other;
59 inline bool operator==(
const timeval& a,
const timeval& b) {
60 return a.tv_sec == b.tv_sec && a.tv_usec == b.tv_usec;
63 inline bool operator!=(
const timeval& a,
const timeval& b) {
67 inline bool operator<(
const timeval& a,
const timeval& b) {
68 if (a.tv_sec < b.tv_sec) {
70 }
else if (a.tv_sec > b.tv_sec) {
73 return a.tv_usec < b.tv_usec;
77 inline bool operator>(
const timeval& a,
const timeval& b) {
78 if (a.tv_sec > b.tv_sec) {
80 }
else if (a.tv_sec < b.tv_sec) {
83 return a.tv_usec > b.tv_usec;
87 inline bool operator<=(
const timeval& a,
const timeval& b) {
88 if (a.tv_sec < b.tv_sec) {
90 }
else if (a.tv_sec > b.tv_sec) {
93 return a.tv_usec <= b.tv_usec;
97 inline bool operator>=(
const timeval& a,
const timeval& b) {
98 if (a.tv_sec > b.tv_sec) {
100 }
else if (a.tv_sec < b.tv_sec) {
103 return a.tv_usec >= b.tv_usec;
Timeval(const timeval &other)
Timeval & operator+=(const Timeval &other)
bool operator!=(const timeval &a, const timeval &b)
bool operator==(const timeval &a, const timeval &b)
timeval operator-(const timeval &a, const timeval &b)
bool operator<(const timeval &a, const timeval &b)
bool operator>=(const timeval &a, const timeval &b)
Timeval & operator-=(const Timeval &other)
bool operator<=(const timeval &a, const timeval &b)
bool operator>(const timeval &a, const timeval &b)
BinaryKey other(const BinaryKey &key)
timeval operator+(const timeval &a, const timeval &b)
Timeval(int sec=0, int usec=0)