00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _NPT_TIME_H_
00011 #define _NPT_TIME_H_
00012
00013
00014
00015
00016 #include "NptTypes.h"
00017
00018
00019
00020
00021 class NPT_TimeStamp
00022 {
00023 public:
00024
00025 NPT_TimeStamp(unsigned long seconds = 0, unsigned long nano_seconds = 0) :
00026 m_Seconds(seconds), m_NanoSeconds(nano_seconds) {}
00027 NPT_TimeStamp(float seconds);
00028 operator float() const;
00029 NPT_TimeStamp& operator+=(const NPT_TimeStamp& time_stamp);
00030 NPT_TimeStamp& operator-=(const NPT_TimeStamp& time_stamp);
00031 bool operator==(const NPT_TimeStamp& time_stamp) const;
00032 bool operator!=(const NPT_TimeStamp& time_stamp) const;
00033 bool operator>(const NPT_TimeStamp& time_stamp) const;
00034 bool operator<(const NPT_TimeStamp& time_stamp) const;
00035 bool operator>=(const NPT_TimeStamp& time_stamp) const;
00036 bool operator<=(const NPT_TimeStamp& time_stamp) const;
00037
00038
00039 friend NPT_TimeStamp operator+(const NPT_TimeStamp& timestamp, long seconds);
00040 friend NPT_TimeStamp operator-(const NPT_TimeStamp& timestamp, long seconds);
00041
00042
00043 long m_Seconds;
00044 long m_NanoSeconds;
00045 };
00046
00047
00048
00049
00050 inline
00051 NPT_TimeStamp
00052 operator+(const NPT_TimeStamp& t1, const NPT_TimeStamp& t2)
00053 {
00054 NPT_TimeStamp t = t1;
00055 return t += t2;
00056 }
00057
00058
00059
00060
00061 inline
00062 NPT_TimeStamp
00063 operator-(const NPT_TimeStamp& t1, const NPT_TimeStamp& t2)
00064 {
00065 NPT_TimeStamp t = t1;
00066 return t -= t2;
00067 }
00068
00069
00070
00071
00072 typedef NPT_TimeStamp NPT_TimeInterval;
00073
00074 #endif // _NPT_TIME_H_