Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _TimeStamp_H
00019 #define _TimeStamp_H
00020
00021 #ifdef __LINUX__
00022 #include <time.h>
00023 #else
00024 #include <windows.h>
00025 #ifdef _DEBUG
00026
00027 #undef THIS_FILE
00028 static char THIS_FILE[] = __FILE__;
00029 #endif
00030 namespace RTB
00031 {
00032
00033 #endif
00034
00035
00036
00042 class TimeStamp
00043 {
00044 public:
00046 TimeStamp();
00047
00049 virtual ~TimeStamp(){};
00050
00052 void SetNow();
00053
00055 double operator-(const TimeStamp& EarlierTime) const;
00056
00058
00060 void operator+=(double TimeS);
00061
00063
00065 void operator-=(double TimeS);
00066
00068 bool operator>(const TimeStamp& Time);
00069
00071 bool operator<(const TimeStamp& Time);
00072
00076 void getTimeStamp(long& lSeconds, long& lNanoSeconds);
00077
00081 void setTimeStamp(const long& lSeconds, const long& lNanoSeconds);
00082
00083 protected:
00085 #ifdef __LINUX__
00086 timespec m_TimeStamp;
00087 #else
00088 LARGE_INTEGER m_TimeStamp;
00089 #endif
00090
00091 private:
00093 #ifdef __LINUX__
00094 static double TimespecToDouble(const ::timespec& LargeInt);
00095
00097 static ::timespec DoubleToTimespec(double TimeS);
00098 #else
00099 static double LargeIntToDouble(const LARGE_INTEGER& LargeInt);
00100
00102 static LARGE_INTEGER DoubleToLargeInt(double TimeS);
00103
00105 static double m_DwordSize;
00106
00108 static double m_SecPerCount;
00109 #endif
00110 };
00111
00112 #ifdef __LINUX__
00113 #else
00114 }
00115 #endif
00116 #endif