Piotr Caban : msvcrt: Fixed mkgmtime and _mkgmtime64 implementation.

Alexandre Julliard julliard at winehq.org
Mon Dec 10 14:00:39 CST 2012


Module: wine
Branch: master
Commit: c9a7436812560b612f83b9d44388ff2de8682780
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c9a7436812560b612f83b9d44388ff2de8682780

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Dec 10 12:47:26 2012 +0100

msvcrt: Fixed mkgmtime and _mkgmtime64 implementation.

---

 dlls/msvcrt/time.c |   30 +++---------------------------
 1 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index e484bf4..60c7120 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -348,32 +348,7 @@ MSVCRT___time32_t CDECL MSVCRT_mktime(struct MSVCRT_tm *mstm)
  */
 MSVCRT___time64_t CDECL MSVCRT__mkgmtime64(struct MSVCRT_tm *time)
 {
-    SYSTEMTIME st;
-    FILETIME ft;
-    MSVCRT___time64_t ret;
-    int i;
-
-    st.wMilliseconds = 0;
-    st.wSecond = time->tm_sec;
-    st.wMinute = time->tm_min;
-    st.wHour = time->tm_hour;
-    st.wDay = time->tm_mday;
-    st.wMonth = time->tm_mon+1;
-    st.wYear = time->tm_year+1900;
-
-    if(!SystemTimeToFileTime(&st, &ft))
-        return -1;
-
-    FileTimeToSystemTime(&ft, &st);
-    time->tm_wday = st.wDayOfWeek;
-
-    for(i=time->tm_yday=0; i<st.wMonth-1; i++)
-        time->tm_yday += MonthLengths[IsLeapYear(st.wYear)][i];
-    time->tm_yday += st.wDay-1;
-
-    ret = ((MSVCRT___time64_t)ft.dwHighDateTime<<32)+ft.dwLowDateTime;
-    ret = (ret-TICKS_1601_TO_1970)/TICKSPERSEC;
-    return ret;
+    return mktime_helper(time, FALSE);
 }
 
 /**********************************************************************
@@ -381,7 +356,8 @@ MSVCRT___time64_t CDECL MSVCRT__mkgmtime64(struct MSVCRT_tm *time)
  */
 MSVCRT___time32_t CDECL MSVCRT__mkgmtime32(struct MSVCRT_tm *time)
 {
-    return MSVCRT__mkgmtime64(time);
+    MSVCRT___time64_t ret = MSVCRT__mkgmtime64(time);
+    return ret == (MSVCRT___time32_t)ret ? ret : -1;
 }
 
 /**********************************************************************




More information about the wine-cvs mailing list