#include "Util.h" #include uint64_t HALSITL::Util::get_hw_rtc() const { #ifndef CLOCK_REALTIME struct timeval ts; gettimeofday(&ts, nullptr); return ((long long)((ts.tv_sec * 1000000) + ts.tv_usec)); #else struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); const uint64_t seconds = ts.tv_sec; const uint64_t nanoseconds = ts.tv_nsec; return (seconds * 1000000ULL + nanoseconds/1000ULL); #endif } /* get a (hopefully unique) machine ID */ bool HALSITL::Util::get_system_id_unformatted(uint8_t buf[], uint8_t &len) { char *cbuf = (char *)buf; // try first to use machine-id file. Most systems will have this const char *paths[] = { "/etc/machine-id", "/var/lib/dbus/machine-id" }; for (uint8_t i=0; i