00001 #ifndef __TIMEVALUE_H 00002 #define __TIMEVALUE_H 00003 00004 #include <pthread.h> 00005 #include "BasicObject.h" 00006 00007 class TimeValue : public BasicObject { 00008 public: 00009 TimeValue(); 00010 TimeValue(const TimeValue&); 00011 TimeValue(int, int); 00012 00013 TimeValue operator-(const TimeValue&); 00014 TimeValue operator+(const TimeValue&); 00015 TimeValue operator*(double value); 00016 00017 virtual ~TimeValue() {} 00018 00019 void setToCurrentTime(); 00020 static TimeValue getCurrentTime(); 00021 00022 timeval getTimevalStruct(); 00023 timespec getTimespecStruct(); 00024 bool isZero(); 00025 long getSeconds(); 00026 long getMilliseconds(); 00027 long getTotalMilliseconds(); 00028 long getMicroseconds(); 00029 00030 void setSeconds(long); 00031 void setMilliseconds(long); 00032 void setMicroseconds(long); 00033 00034 virtual void toStream(std::ostream&); 00035 friend bool operator<(const TimeValue& value1, const TimeValue& value2); 00036 00037 private: 00038 void doCarry(); 00039 00040 timeval m_timeValue; 00041 timespec m_timeSpec; 00042 }; 00043 00044 bool operator<(const timespec& time1, const timespec& time2); 00045 bool operator<(const TimeValue& value1, const TimeValue& value2); 00046 00047 #endif