$search
00001 00060 #ifndef _TimeStamp_H 00061 #define _TimeStamp_H 00062 00063 #ifdef __LINUX__ 00064 #include <time.h> 00065 #else 00066 #include <windows.h> 00067 #ifdef _DEBUG 00068 //#define new DEBUG_NEW 00069 #undef THIS_FILE 00070 static char THIS_FILE[] = __FILE__; 00071 #endif 00072 namespace RTB { 00073 00074 #endif 00075 00076 //------------------------------------------------------------------- 00077 00078 00084 class TimeStamp 00085 { 00086 public: 00088 TimeStamp(); 00089 00091 virtual ~TimeStamp() {}; 00092 00094 void SetNow(); 00095 00097 double operator-(const TimeStamp& EarlierTime) const; 00098 00100 00102 void operator+=(double TimeS); 00103 00105 00107 void operator-=(double TimeS); 00108 00110 bool operator>(const TimeStamp& Time); 00111 00113 bool operator<(const TimeStamp& Time); 00114 00118 void getTimeStamp(long& lSeconds, long& lNanoSeconds); 00119 00123 void setTimeStamp(const long& lSeconds, const long& lNanoSeconds); 00124 00125 00126 protected: 00127 00129 #ifdef __LINUX__ 00130 timespec m_TimeStamp; 00131 #else 00132 LARGE_INTEGER m_TimeStamp; 00133 #endif 00134 00135 private: 00136 00138 #ifdef __LINUX__ 00139 static double TimespecToDouble(const ::timespec& LargeInt); 00140 00142 static ::timespec DoubleToTimespec(double TimeS); 00143 #else 00144 static double LargeIntToDouble(const LARGE_INTEGER& LargeInt); 00145 00147 static LARGE_INTEGER DoubleToLargeInt(double TimeS); 00148 00150 static double m_DwordSize; 00151 00153 static double m_SecPerCount; 00154 #endif 00155 00156 }; 00157 00158 #ifdef __LINUX__ 00159 #else 00160 }//namespace 00161 #endif 00162 #endif 00163