From 7bf1ee877dbaad6933ff9eaf62d731bb60eac188 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Sat, 14 May 2005 11:07:10 +0000 Subject: [PATCH] - move _timezone to time.c, and correct its type - implement _tzset, and initialize _daylight, _timezone, and _tzname from libc values --- dlls/msvcrt/data.c | 7 ------- dlls/msvcrt/msvcrt.h | 1 - dlls/msvcrt/msvcrt.spec | 6 +++--- dlls/msvcrt/time.c | 35 +++++++++++++++++++++++++++++++---- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/dlls/msvcrt/data.c b/dlls/msvcrt/data.c index 1e9c24b6950..7ce401b6a7b 100644 --- a/dlls/msvcrt/data.c +++ b/dlls/msvcrt/data.c @@ -56,7 +56,6 @@ char **_environ = 0; MSVCRT_wchar_t **_wenviron = 0; char **MSVCRT___initenv = 0; MSVCRT_wchar_t **MSVCRT___winitenv = 0; -int MSVCRT_timezone; int MSVCRT_app_type; char* MSVCRT__pgmptr = 0; WCHAR* MSVCRT__wpgmptr = 0; @@ -231,11 +230,6 @@ char*** __p___initenv(void) { return &MSVCRT___initenv; } */ MSVCRT_wchar_t*** __p___winitenv(void) { return &MSVCRT___winitenv; } -/********************************************************************* - * __p__timezone (MSVCRT.@) - */ -int* __p__timezone(void) { return &MSVCRT_timezone; } - /* INTERNAL: Create a wide string from an ascii string */ static MSVCRT_wchar_t *wstrdupa(const char *str) { @@ -280,7 +274,6 @@ void msvcrt_init_args(void) MSVCRT__HUGE = HUGE_VAL; MSVCRT___setlc_active = 0; MSVCRT___unguarded_readlc_active = 0; - MSVCRT_timezone = 0; MSVCRT__fmode = MSVCRT__O_TEXT; MSVCRT___initenv= msvcrt_SnapshotOfEnvironmentA(NULL); diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 03f553d6d82..8d22a2166c7 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -576,7 +576,6 @@ 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); MSVCRT_FILE* MSVCRT__fdopen(int, const char *); int MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, va_list valist); diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 6372e0d51f8..3cbd497a3d1 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -121,7 +121,7 @@ @ cdecl __p__pctype() @ cdecl __p__pgmptr() @ stub __p__pwctype #() -@ cdecl __p__timezone() +@ cdecl __p__timezone() MSVCRT___p__timezone @ cdecl __p__tzname() @ cdecl __p__wcmdln() @ cdecl __p__wenviron() @@ -469,11 +469,11 @@ @ cdecl _tell(long) @ cdecl -ret64 _telli64(long) @ cdecl _tempnam(str str) -# extern _timezone +@ extern _timezone MSVCRT___timezone @ cdecl _tolower(long) MSVCRT__tolower @ cdecl _toupper(long) MSVCRT__toupper @ extern _tzname MSVCRT__tzname -@ cdecl _tzset() tzset +@ cdecl _tzset() MSVCRT__tzset @ cdecl _ui64toa(long long ptr long) ntdll._ui64toa @ cdecl _ui64tow(long long ptr long) ntdll._ui64tow @ cdecl _ultoa(long ptr long) ntdll._ultoa diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index c7964160e0c..9178412799b 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -300,25 +300,38 @@ MSVCRT_time_t MSVCRT_time(MSVCRT_time_t* buf) /********************************************************************* * _daylight (MSVCRT.@) */ -int MSVCRT___daylight = 1; /* FIXME: assume daylight */ +int MSVCRT___daylight = 0; /********************************************************************* * __p_daylight (MSVCRT.@) */ -void *MSVCRT___p__daylight(void) +int *MSVCRT___p__daylight(void) { return &MSVCRT___daylight; } /********************************************************************* + * _timezone (MSVCRT.@) + */ +long MSVCRT___timezone = 0; + +/********************************************************************* + * __p_timezone (MSVCRT.@) + */ +long *MSVCRT___p__timezone(void) +{ + return &MSVCRT___timezone; +} + +/********************************************************************* * _tzname (MSVCRT.@) * NOTES * Some apps (notably Mozilla) insist on writing to these, so the buffer * must be large enough. The size is picked based on observation of * Windows XP. */ -static char tzname_std[64] = ""; /* FIXME: initialize */ -static char tzname_dst[64] = ""; /* FIXME: initialize */ +static char tzname_std[64] = ""; +static char tzname_dst[64] = ""; char *MSVCRT__tzname[2] = { tzname_std, tzname_dst }; /********************************************************************* @@ -328,3 +341,17 @@ char **__p__tzname(void) { return MSVCRT__tzname; } + +/********************************************************************* + * _tzset (MSVCRT.@) + */ +void MSVCRT__tzset(void) +{ + tzset(); + MSVCRT___daylight = daylight; + MSVCRT___timezone = timezone; + lstrcpynA(tzname_std, tzname[0], sizeof(tzname_std)); + tzname_std[sizeof(tzname_std) - 1] = '\0'; + lstrcpynA(tzname_dst, tzname[1], sizeof(tzname_dst)); + tzname_dst[sizeof(tzname_dst) - 1] = '\0'; +} -- 2.11.4.GIT