55 ULARGE_INTEGER TimeStamp::offsetSecondsSince1970;
71 this->
set(seconds, microSeconds);
79 const int64_t totalMicroSeconds = nanoseconds / 1000;
81 const int64_t seconds = totalMicroSeconds / 1000000;
82 const int64_t microSeconds = totalMicroSeconds - (seconds * 1000000);
84 this->
set(
static_cast<int32_t
>(seconds),
static_cast<int32_t
>(microSeconds));
100 set(value.tv_sec, value.tv_usec);
108 const int32_t rollover_sec = microSeconds / 1000000;
112 if (rollover_sec != 0)
114 seconds += rollover_sec;
115 microSeconds %= 1000000;
118 if (microSeconds < 0)
122 microSeconds += 1000000;
125 this->
time.tv_sec = seconds;
126 this->
time.tv_usec = microSeconds;
129 #ifndef SENSORPOD_FIRMWARE
152 FILETIME currentTimeAsFileTime;
153 GetSystemTimeAsFileTime (¤tTimeAsFileTime);
155 ULARGE_INTEGER currentTimeAsLargeInteger;
156 currentTimeAsLargeInteger.LowPart = currentTimeAsFileTime.dwLowDateTime;
157 currentTimeAsLargeInteger.HighPart = currentTimeAsFileTime.dwHighDateTime;
158 currentTimeAsLargeInteger.QuadPart -= offsetSecondsSince1970.QuadPart;
161 timeStamp =
TimeStamp(
static_cast<int64_t
>(currentTimeAsLargeInteger.QuadPart) * 100);
165 #if defined (USE_MONOTONIC_CLOCK)
170 if (0 != clock_gettime(CLOCK_MONOTONIC, &ts))
175 TIMESPEC_TO_TIMEVAL(&timeStamp.
time, &ts);
177 gettimeofday(&timeStamp.
time, 0);
185 #endif // SENSORPOD_FIRMWARE
192 return this->
time.tv_sec;
200 return this->
time.tv_usec;
208 return static_cast<int64_t
>(this->
time.tv_sec) * 1000000000 +
static_cast<int64_t
>(this->
time.tv_usec) * 1000;
214 return {
static_cast<int32_t
>(this->
time.tv_sec + other.
time.tv_sec),
215 static_cast<int32_t
>(this->
time.tv_usec + other.
time.tv_usec)};
221 return {
static_cast<int32_t
>(this->
time.tv_sec - other.
time.tv_sec),
222 static_cast<int32_t
>(this->
time.tv_usec - other.
time.tv_usec)};
227 *
this = *
this + other;
233 *
this = *
this - other;