[kernel32] use sysconf instead of the obsolete CLK_TCK

Damjan Jovanovic damjan.jov at gmail.com
Mon Sep 10 03:14:42 CDT 2007


Closes #9306.

Changelog:
* Use sysconf(_SC_CLK_TCK) instead of the obsolete (and wrong) CLK_TCK macro.

Damjan Jovanovic
-------------- next part --------------
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index eab7635..03e4da3 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -549,13 +549,12 @@ VOID WINAPI GetSystemTimeAsFileTime(
  *          2) Time is relative. There is no 'starting date', so there is
  *             no need for offset correction, like in UnixTimeToFileTime
  */
-#ifndef CLK_TCK
-# define CLK_TCK CLOCKS_PER_SEC
-#endif
 static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime)
 {
+    long clocksPerSec;
     ULONGLONG secs = RtlEnlargedUnsignedMultiply( unix_time, 10000000 );
-    secs = RtlExtendedLargeIntegerDivide( secs, CLK_TCK, NULL );
+    clocksPerSec = sysconf(_SC_CLK_TCK);
+    secs = RtlExtendedLargeIntegerDivide( secs, clocksPerSec, NULL );
     filetime->dwLowDateTime  = (DWORD)secs;
     filetime->dwHighDateTime = (DWORD)(secs >> 32);
 }


More information about the wine-patches mailing list