cec: added PA detection via ADL for AMD, and attempt to get the PA from the registry...
[deb_libcec.git] / src / lib / platform / util / timeutils.h
index 3b1ef700c8f4213ca1a1f2af3ee15e5e6f5d71e7..5f2d27aeec3f46914e0a5b3388df50a2278f28df 100644 (file)
@@ -78,23 +78,20 @@ namespace PLATFORM
   inline int64_t GetTimeMs()
   {
   #if defined(__APPLE__)
-    return (int64_t) (CVGetCurrentHostTime() * 1000 / CVGetHostClockFrequency());
+    return (int64_t) (CVGetCurrentHostTime() / (int64_t)(CVGetHostClockFrequency() * 0.001));
   #elif defined(__WINDOWS__)
-    time_t rawtime;
-    time(&rawtime);
-
     LARGE_INTEGER tickPerSecond;
     LARGE_INTEGER tick;
     if (QueryPerformanceFrequency(&tickPerSecond))
     {
       QueryPerformanceCounter(&tick);
-      return (int64_t) (tick.QuadPart / 1000.);
+      return (int64_t) (tick.QuadPart / (tickPerSecond.QuadPart / 1000.));
     }
     return -1;
   #else
-    timeval time;
-    gettimeofday(&time, NULL);
-    return (int64_t) (time.tv_sec * 1000 + time.tv_usec / 1000);
+    timespec time;
+    clock_gettime(CLOCK_MONOTONIC, &time);
+    return (int64_t)time.tv_sec * 1000 + time.tv_nsec / 1000000;
   #endif
   }