Implemented KERNEL32 GetSystemTimes

Martin Bailey martin at pcalpha.com
Sat Sep 13 19:48:45 CDT 2008


---
 dlls/kernel32/kernel32.spec |    2 +-
 dlls/kernel32/time.c        |   35 +++++++++++++++++++++++++++++++++++
 include/winbase.h           |    1 +
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index f1fc07a..db7acfe 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -620,7 +620,7 @@
 @ stdcall GetSystemTime(ptr)
 @ stdcall GetSystemTimeAdjustment(ptr ptr ptr)
 @ stdcall GetSystemTimeAsFileTime(ptr)
-# @ stub GetSystemTimes
+@ stdcall GetSystemTimes(ptr ptr ptr)
 @ stdcall GetSystemWindowsDirectoryA(ptr long)
 @ stdcall GetSystemWindowsDirectoryW(ptr long)
 @ stdcall GetSystemWow64DirectoryA(ptr long)
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index 29b3dc8..f4c23b5 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -556,6 +556,41 @@ static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime)
     filetime->dwHighDateTime = (DWORD)(secs >> 32);
 }
 
+
+/***********************************************************************
+ *              GetSystemTimes  (KERNEL32.@)
+ *
+ *  Retrieves system timing information.
+ *
+ * PARAMS
+ *  lpIdleTime     [out] The time spent in idle routines in 100's of nanoseconds.
+ *  lpKernelTime   [out] The time spent in kernel routines in 100's of nanoseconds.
+ *  lpUserTime     [out] The time spent in user routines in 100's of nanoseconds.
+ *
+ * RETURNS
+ *  Nothing.
+ *
+ * BUGS
+ *  IdleTime isn't calculated.
+ */
+VOID WINAPI GetSystemTimes(
+    LPFILETIME lpIdleTime,
+    LPFILETIME lpKernelTime,
+    LPFILETIME lpUserTime)
+{
+    struct tms tms;
+    times(&tms);
+    /* FIXME: Calculate based on Idle process time
+    if (lpIdleTime)
+        TIME_ClockTimeToFileTime(tms.tms_utime+tms.tms_stime,lpIdleTime);
+    */
+    if (lpKernelTime)
+        TIME_ClockTimeToFileTime(tms.tms_stime,lpKernelTime);
+    if (lpUserTime)
+        TIME_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
+}
+
+
 /*********************************************************************
  *	GetProcessTimes				(KERNEL32.@)
  *
diff --git a/include/winbase.h b/include/winbase.h
index 0b637f5..65da81b 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1697,6 +1697,7 @@ WINBASEAPI BOOL        WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
 WINBASEAPI VOID        WINAPI GetSystemTime(LPSYSTEMTIME);
 WINBASEAPI BOOL        WINAPI GetSystemTimeAdjustment(PDWORD,PDWORD,PBOOL);
 WINBASEAPI VOID        WINAPI GetSystemTimeAsFileTime(LPFILETIME);
+WINBASEAPI VOID        WINAPI GetSystemTimes(LPFILETIME,LPFILETIME,LPFILETIME);
 WINBASEAPI UINT        WINAPI GetSystemWindowsDirectoryA(LPSTR,UINT);
 WINBASEAPI UINT        WINAPI GetSystemWindowsDirectoryW(LPWSTR,UINT);
 #define                       GetSystemWindowsDirectory WINELIB_NAME_AW(GetSystemWindowsDirectory)
-- 
1.5.1.6


--------------040007070001020708020300--



More information about the wine-patches mailing list