00001 // -*- C++ -*- 00019 #ifndef COIL_TIMEVALUE_H 00020 #define COIL_TIMEVALUE_H 00021 00022 namespace coil 00023 { 00024 00025 #define TIMEVALUE_ONE_SECOND_IN_USECS 1000000 // 1 [sec] = 1000000 [usec] 00026 00027 class TimeValue 00028 { 00029 public: 00053 TimeValue(long sec=0, long usec=0); 00054 TimeValue(double timeval); 00055 00056 inline long int sec() const {return m_sec;} 00057 inline long int usec() const {return m_usec;} 00058 00083 TimeValue operator-(TimeValue& tm); 00084 00108 TimeValue operator+(TimeValue& tm); 00109 00133 TimeValue operator=(double time); 00134 00154 operator double() const; 00155 00175 int sign() const; 00176 00177 // private: 00178 00194 void normalize(); 00195 00196 private: 00197 long int m_sec; 00198 long int m_usec; 00199 }; 00200 }; 00201 00202 #endif // COIL_TIMEVALUE_H