50 #ifndef INCLUDE_OKVIS_IMPLEMENTATION_DURATION_HPP_
51 #define INCLUDE_OKVIS_IMPLEMENTATION_DURATION_HPP_
71 sec = (int32_t)trunc(d);
76 sec = (int32_t) floor(d);
78 sec = (int32_t) floor(d) + 1;
80 nsec = (int32_t)((d - (
double) sec) * 1000000000);
81 return *
static_cast<T*
>(
this);
86 sec = (int32_t)(t / 1000000000);
87 nsec = (int32_t)(t % 1000000000);
91 return *
static_cast<T*
>(
this);
96 return T(sec + rhs.sec, nsec + rhs.nsec);
101 return T(toSec() * scale);
106 return T(sec - rhs.sec, nsec - rhs.nsec);
111 return T(-sec, -nsec);
117 return *
static_cast<T*
>(
this);
123 return *
static_cast<T*
>(
this);
128 fromSec(toSec() * scale);
129 return *
static_cast<T*
>(
this);
136 else if (sec == rhs.sec && nsec < rhs.nsec)
145 else if (sec == rhs.sec && nsec > rhs.nsec)
154 else if (sec == rhs.sec && nsec <= rhs.nsec)
163 else if (sec == rhs.sec && nsec >= rhs.nsec)
170 return sec == rhs.sec && nsec == rhs.nsec;
175 return sec == 0 && nsec == 0;
179 #endif // INCLUDE_OKVIS_IMPLEMENTATION_DURATION_HPP_
DurationBase()
Definition: Duration.hpp:85
bool operator==(const T &rhs) const
Definition: Duration.hpp:169
bool isZero()
Definition: Duration.hpp:174
bool operator<(const T &rhs) const
Definition: Duration.hpp:133
bool operator<=(const T &rhs) const
Definition: Duration.hpp:151
Header file for the DurationBase, Duration and WallDuration class.
bool operator>(const T &rhs) const
Definition: Duration.hpp:142
T & fromNSec(int64_t t)
Definition: Duration.hpp:85
bool operator>=(const T &rhs) const
Definition: Duration.hpp:160
T & operator-=(const T &rhs)
Definition: Duration.hpp:121
T operator+(const T &rhs) const
Definition: Duration.hpp:95
void normalizeSecNSecSigned(int64_t &sec, int64_t &nsec)
Definition: Duration.cpp:55
int32_t nsec
Definition: Duration.hpp:84
T operator-() const
Definition: Duration.hpp:110
T & fromSec(double t)
Definition: Duration.hpp:69
T operator*(double scale) const
Definition: Duration.hpp:100
T & operator*=(double scale)
Definition: Duration.hpp:127
int32_t sec
Definition: Duration.hpp:84
T & operator+=(const T &rhs)
Definition: Duration.hpp:115