Commit 4c4fa08c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

win32: prefer 64-bits ticks count on Vista builds

While less precise, ticks count should be more stable than performance
counters.
parent eb7da3f0
...@@ -55,7 +55,7 @@ struct vlc_thread ...@@ -55,7 +55,7 @@ struct vlc_thread
void *data; void *data;
}; };
#if (_WIN32_WINNT < 0x0601) #if (_WIN32_WINNT < 0x0600)
static LARGE_INTEGER freq; static LARGE_INTEGER freq;
#endif #endif
static vlc_mutex_t super_mutex; static vlc_mutex_t super_mutex;
...@@ -72,7 +72,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) ...@@ -72,7 +72,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
switch (fdwReason) switch (fdwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
#if (_WIN32_WINNT < 0x0601) #if (_WIN32_WINNT < 0x0600)
if (!QueryPerformanceFrequency (&freq)) if (!QueryPerformanceFrequency (&freq))
return FALSE; return FALSE;
#endif #endif
...@@ -717,7 +717,17 @@ mtime_t mdate (void) ...@@ -717,7 +717,17 @@ mtime_t mdate (void)
if (unlikely(!QueryUnbiasedInterruptTime (&ts))) if (unlikely(!QueryUnbiasedInterruptTime (&ts)))
abort (); abort ();
return ts / 10; /* hundreds of nanoseconds */ /* hundreds of nanoseconds */
static_assert ((10000000 % CLOCK_FREQ) == 0, "Broken frequencies ratio");
return ts / (10000000 / CLOCK_FREQ);
#elif (_WIN32_WINNT >= 0x0600)
ULONGLONG ts = GetTickCount64 ();
/* milliseconds */
static_assert ((CLOCK_FREQ % 1000) == 0, "Broken frequencies ratio");
return ts * (CLOCK_FREQ / 1000);
#else #else
/* We don't need the real date, just the value of a high precision timer */ /* We don't need the real date, just the value of a high precision timer */
LARGE_INTEGER counter; LARGE_INTEGER counter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment