This commit is contained in:
Robin Müller 2023-03-04 11:04:55 +01:00
parent 95dab69b35
commit 04ee3c7362
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -69,13 +69,13 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
} }
ReturnValue_t Clock::getClockMonotonic(timeval *time) { ReturnValue_t Clock::getClockMonotonic(timeval *time) {
timespec timeUnix{}; timespec timeMonotonic{};
int status = clock_gettime(CLOCK_MONOTONIC_RAW, &timeUnix); int status = clock_gettime(CLOCK_MONOTONIC_RAW, &timeMonotonic);
if (status != 0) { if (status != 0) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
time->tv_sec = timeUnix.tv_sec; time->tv_sec = timeMonotonic.tv_sec;
time->tv_usec = timeUnix.tv_nsec / 1000.0; time->tv_usec = timeMonotonic.tv_nsec / 1000.0;
return returnvalue::OK; return returnvalue::OK;
} }