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 00040 class TimeValue 00041 { 00042 public: 00066 TimeValue(long sec=0, long usec=0); 00067 00089 TimeValue(double timeval); 00090 00110 inline long int sec() const {return m_sec;} 00111 00131 inline long int usec() const {return m_usec;} 00132 00157 TimeValue operator-(TimeValue& tm); 00158 00182 TimeValue operator+(TimeValue& tm); 00183 00207 TimeValue operator=(double time); 00208 00228 operator double() const; 00229 00249 int sign() const; 00250 00251 // private: 00252 00268 void normalize(); 00269 00270 private: 00271 long int m_sec; 00272 long int m_usec; 00273 }; 00274 }; 00275 00276 #endif // COIL_TIMEVALUE_H