cec: fix GetTimeMs() on linux. add time in ms since startup to log messages
[deb_libcec.git] / src / lib / platform / timeutils.h
index c4140203736bc258e3551a31fda001009a985e45..20b6eff8d5e9b6b5669b89f432072bb8ec9ae200 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #include <stdint.h>
-#include <time.h>
+#include <sys/time.h>
 
 namespace CEC
 {
@@ -38,10 +38,9 @@ namespace CEC
     }
     return -1;
   #else
-    struct timespec time;
-    clock_gettime(CLOCK_MONOTONIC, &time);
-
-    return ((int64_t)time.tv_sec * (int64_t)1000) + (int64_t)time.tv_nsec / (int64_t)1000;
+    timeval time;
+    gettimeofday(&time, NULL);
+    return (int64_t) (time.tv_sec * 1000 + time.tv_usec / 1000);
   #endif
   }