26 #ifndef WFMATH_TIMESTAMP_H
27 #define WFMATH_TIMESTAMP_H
29 #include <wfmath/const.h>
37 #include <sys/timeb.h>
54 TimeDiff(
long sec,
long usec,
bool is_valid);
69 std::pair<long,long>
full_time()
const {
return std::make_pair(m_sec,m_usec);}
71 bool isValid()
const {
return m_isvalid;}
106 inline bool operator>(
const TimeDiff &a,
const TimeDiff &b) {
return b < a;}
107 inline bool operator<=(
const TimeDiff &a,
const TimeDiff &b) {
return !(b < a);}
108 inline bool operator>=(
const TimeDiff &a,
const TimeDiff &b) {
return !(a < b);}
109 inline bool operator!=(
const TimeDiff &a,
const TimeDiff &b) {
return !(b == a);}
130 TimeStamp(
long sec,
long usec,
bool isvalid);
139 friend std::ostream& operator<<(std::ostream& os,
const TimeStamp&);
140 friend std::istream& operator>>(std::istream& is,
TimeStamp&);
142 bool isValid()
const {
return _isvalid;}
163 inline TimeStamp operator+(TimeDiff msec,
const TimeStamp &a) {
return a + msec;}
165 inline bool operator>(
const TimeStamp &a,
const TimeStamp &b) {
return b < a;}
166 inline bool operator<=(
const TimeStamp &a,
const TimeStamp &b) {
return !(b < a);}
167 inline bool operator>=(
const TimeStamp &a,
const TimeStamp &b) {
return !(a < b);}
168 inline bool operator!=(
const TimeStamp &a,
const TimeStamp &b) {
return !(b == a);}
172 #endif // WFMATH_TIMESTAMP_H