Go to the documentation of this file.00001
00042 #ifndef CRL_MULTISENSE_TIMESTAMP_HH
00043 #define CRL_MULTISENSE_TIMESTAMP_HH
00044
00045 #if defined(WIN32)
00046 #ifndef WIN32_LEAN_AND_MEAN
00047 #define WIN32_LEAN_AND_MEAN 1
00048 #endif
00049
00050 #include <windows.h>
00051 #include <winsock2.h>
00052 #else
00053 #include <sys/time.h>
00054 #endif
00055 #include <stdint.h>
00056
00057 namespace crl {
00058 namespace multisense {
00059 namespace details {
00060 namespace utility {
00061
00062
00063
00064
00065
00066
00067 class TimeStamp
00068 {
00069 private:
00070
00071
00072
00073
00074
00075 struct timeval time;
00076
00077
00078
00079
00080
00081
00082
00083 static double timeSynchronizationOffset;
00084 #if defined (WIN32)
00085 static ULARGE_INTEGER offsetSecondsSince1970;
00086 #endif
00087
00088 public:
00089
00090
00091
00092
00093
00094 static TimeStamp getCurrentTime();
00095
00096 static void setTimeAtPps(TimeStamp& local, TimeStamp& remote);
00097 static void setTimeAtPps(struct timeval& local, struct timeval& remote);
00098 static double getTimeSynchronizationOffset();
00099
00100
00101
00102
00103
00104 TimeStamp();
00105 TimeStamp(struct timeval& value);
00106 TimeStamp(double value);
00107
00108
00109
00110
00111
00112 void set(struct timeval& value);
00113
00114
00115
00116
00117
00118 uint32_t getSeconds() const;
00119 uint32_t getMicroSeconds() const;
00120
00121
00122
00123
00124
00125 operator double() const;
00126 TimeStamp& operator=(double timeStamp);
00127 TimeStamp& operator+=(TimeStamp const& other);
00128 TimeStamp& operator-=(TimeStamp const& other);
00129
00130
00131
00132
00133
00134
00135
00136 void normalize();
00137 };
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 }}}}
00149
00150 #endif