msvcrt.mktime fix

Rein Klazes rklazes at xs4all.nl
Thu Oct 21 08:10:22 CDT 2004


Hi,

Now GetTimeZoneInformation returns valid data, a couple of time related
bugs have shown up. 

Changelog:
	dlls/msvcrt	: time.c, msvcrt.h
	- mktime should compute the tm_wday, tm_yday and renormalize the
	other fields of the supplied tm structure.
	- add prototype declarations for the time functions.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/dlls/msvcrt/time.c	2004-09-09 08:52:17.000000000 +0200
+++ mywine/dlls/msvcrt/time.c	2004-10-21 14:53:26.000000000 +0200
@@ -62,7 +62,6 @@
 MSVCRT_time_t MSVCRT_mktime(struct MSVCRT_tm *t)
 {
   MSVCRT_time_t secs;
-
   SYSTEMTIME st;
   FILETIME lft, uft;
   ULONGLONG time;
@@ -80,6 +79,9 @@
 
   time = ((ULONGLONG)uft.dwHighDateTime << 32) | uft.dwLowDateTime;
   secs = time / TICKSPERSEC - SECS_1601_TO_1970;
+  /* compute tm_wday, tm_yday and renormalize the other fields of the
+   * tm structure */
+  if( MSVCRT_localtime( &secs)) *t = tm;
 
   return secs; 
 }
--- wine/dlls/msvcrt/msvcrt.h	2004-10-14 09:09:24.000000000 +0200
+++ mywine/dlls/msvcrt/msvcrt.h	2004-10-21 14:24:39.000000000 +0200
@@ -568,7 +568,13 @@
 int            MSVCRT_fclose(MSVCRT_FILE*);
 void           MSVCRT_terminate();
 MSVCRT_FILE*   MSVCRT__p__iob(void);
+MSVCRT_time_t  MSVCRT_mktime(struct MSVCRT_tm *t);
+struct MSVCRT_tm* MSVCRT_localtime(const MSVCRT_time_t* secs);
+struct MSVCRT_tm* MSVCRT_gmtime(const MSVCRT_time_t* secs);
+MSVCRT_clock_t MSVCRT_clock(void);
+double         MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2);
 MSVCRT_time_t  MSVCRT_time(MSVCRT_time_t*);
+void *         MSVCRT___p__daylight(void);
 
 #ifndef __WINE_MSVCRT_TEST
 int            _write(int,const void*,unsigned int);
@@ -590,6 +596,9 @@
 unsigned int*  __p__fmode(void);
 MSVCRT_wchar_t*   _wcsdup(const MSVCRT_wchar_t*);
 MSVCRT_wchar_t*** __p__wenviron(void);
+char*         _strdate(char* date);
+char*         _strtime(char* date);
+void          _ftime(struct MSVCRT__timeb *buf);
 #endif
 
 /*  FIXME: Functions that we forward to. They shouldn't be defined


More information about the wine-patches mailing list