define fixes

This commit is contained in:
Robin Müller 2021-05-12 14:43:08 +02:00
parent 5b23b928cf
commit d81c6f40fb
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -2,9 +2,9 @@
#include "../../timemanager/Clock.h" #include "../../timemanager/Clock.h"
#include <chrono> #include <chrono>
#if defined(WIN32) #if defined(_WIN32)
#include <sysinfoapi.h> #include <sysinfoapi.h>
#elif defined(LINUX) #elif defined(__unix__)
#include <fstream> #include <fstream>
#endif #endif
@ -92,7 +92,7 @@ timeval Clock::getUptime() {
auto fraction = uptime - secondsChrono; auto fraction = uptime - secondsChrono;
timeval.tv_usec = std::chrono::duration_cast<std::chrono::microseconds>( timeval.tv_usec = std::chrono::duration_cast<std::chrono::microseconds>(
fraction).count(); fraction).count();
#elif defined(LINUX) #elif defined(__unix__)
double uptimeSeconds; double uptimeSeconds;
if (std::ifstream("/proc/uptime", std::ios::in) >> uptimeSeconds) if (std::ifstream("/proc/uptime", std::ios::in) >> uptimeSeconds)
{ {
@ -120,7 +120,6 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
} }
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
/* Do some magic with chrono (C++20!) */ /* Do some magic with chrono (C++20!) */
/* Right now, the library doesn't have the new features to get the required values yet. /* Right now, the library doesn't have the new features to get the required values yet.
so we work around that for now. */ so we work around that for now. */