Commit 7bf1ee87 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

- move _timezone to time.c, and correct its type

- implement _tzset, and initialize _daylight, _timezone, and _tzname from libc values
parent f12eadf7
...@@ -56,7 +56,6 @@ char **_environ = 0; ...@@ -56,7 +56,6 @@ char **_environ = 0;
MSVCRT_wchar_t **_wenviron = 0; MSVCRT_wchar_t **_wenviron = 0;
char **MSVCRT___initenv = 0; char **MSVCRT___initenv = 0;
MSVCRT_wchar_t **MSVCRT___winitenv = 0; MSVCRT_wchar_t **MSVCRT___winitenv = 0;
int MSVCRT_timezone;
int MSVCRT_app_type; int MSVCRT_app_type;
char* MSVCRT__pgmptr = 0; char* MSVCRT__pgmptr = 0;
WCHAR* MSVCRT__wpgmptr = 0; WCHAR* MSVCRT__wpgmptr = 0;
...@@ -231,11 +230,6 @@ char*** __p___initenv(void) { return &MSVCRT___initenv; } ...@@ -231,11 +230,6 @@ char*** __p___initenv(void) { return &MSVCRT___initenv; }
*/ */
MSVCRT_wchar_t*** __p___winitenv(void) { return &MSVCRT___winitenv; } 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 */ /* INTERNAL: Create a wide string from an ascii string */
static MSVCRT_wchar_t *wstrdupa(const char *str) static MSVCRT_wchar_t *wstrdupa(const char *str)
{ {
...@@ -280,7 +274,6 @@ void msvcrt_init_args(void) ...@@ -280,7 +274,6 @@ void msvcrt_init_args(void)
MSVCRT__HUGE = HUGE_VAL; MSVCRT__HUGE = HUGE_VAL;
MSVCRT___setlc_active = 0; MSVCRT___setlc_active = 0;
MSVCRT___unguarded_readlc_active = 0; MSVCRT___unguarded_readlc_active = 0;
MSVCRT_timezone = 0;
MSVCRT__fmode = MSVCRT__O_TEXT; MSVCRT__fmode = MSVCRT__O_TEXT;
MSVCRT___initenv= msvcrt_SnapshotOfEnvironmentA(NULL); MSVCRT___initenv= msvcrt_SnapshotOfEnvironmentA(NULL);
......
...@@ -576,7 +576,6 @@ struct MSVCRT_tm* MSVCRT_gmtime(const MSVCRT_time_t* secs); ...@@ -576,7 +576,6 @@ struct MSVCRT_tm* MSVCRT_gmtime(const MSVCRT_time_t* secs);
MSVCRT_clock_t MSVCRT_clock(void); MSVCRT_clock_t MSVCRT_clock(void);
double MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2); double MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2);
MSVCRT_time_t MSVCRT_time(MSVCRT_time_t*); MSVCRT_time_t MSVCRT_time(MSVCRT_time_t*);
void * MSVCRT___p__daylight(void);
MSVCRT_FILE* MSVCRT__fdopen(int, const char *); MSVCRT_FILE* MSVCRT__fdopen(int, const char *);
int MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, va_list valist); int MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, va_list valist);
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
@ cdecl __p__pctype() @ cdecl __p__pctype()
@ cdecl __p__pgmptr() @ cdecl __p__pgmptr()
@ stub __p__pwctype #() @ stub __p__pwctype #()
@ cdecl __p__timezone() @ cdecl __p__timezone() MSVCRT___p__timezone
@ cdecl __p__tzname() @ cdecl __p__tzname()
@ cdecl __p__wcmdln() @ cdecl __p__wcmdln()
@ cdecl __p__wenviron() @ cdecl __p__wenviron()
...@@ -469,11 +469,11 @@ ...@@ -469,11 +469,11 @@
@ cdecl _tell(long) @ cdecl _tell(long)
@ cdecl -ret64 _telli64(long) @ cdecl -ret64 _telli64(long)
@ cdecl _tempnam(str str) @ cdecl _tempnam(str str)
# extern _timezone @ extern _timezone MSVCRT___timezone
@ cdecl _tolower(long) MSVCRT__tolower @ cdecl _tolower(long) MSVCRT__tolower
@ cdecl _toupper(long) MSVCRT__toupper @ cdecl _toupper(long) MSVCRT__toupper
@ extern _tzname MSVCRT__tzname @ extern _tzname MSVCRT__tzname
@ cdecl _tzset() tzset @ cdecl _tzset() MSVCRT__tzset
@ cdecl _ui64toa(long long ptr long) ntdll._ui64toa @ cdecl _ui64toa(long long ptr long) ntdll._ui64toa
@ cdecl _ui64tow(long long ptr long) ntdll._ui64tow @ cdecl _ui64tow(long long ptr long) ntdll._ui64tow
@ cdecl _ultoa(long ptr long) ntdll._ultoa @ cdecl _ultoa(long ptr long) ntdll._ultoa
......
...@@ -300,25 +300,38 @@ MSVCRT_time_t MSVCRT_time(MSVCRT_time_t* buf) ...@@ -300,25 +300,38 @@ MSVCRT_time_t MSVCRT_time(MSVCRT_time_t* buf)
/********************************************************************* /*********************************************************************
* _daylight (MSVCRT.@) * _daylight (MSVCRT.@)
*/ */
int MSVCRT___daylight = 1; /* FIXME: assume daylight */ int MSVCRT___daylight = 0;
/********************************************************************* /*********************************************************************
* __p_daylight (MSVCRT.@) * __p_daylight (MSVCRT.@)
*/ */
void *MSVCRT___p__daylight(void) int *MSVCRT___p__daylight(void)
{ {
return &MSVCRT___daylight; return &MSVCRT___daylight;
} }
/********************************************************************* /*********************************************************************
* _timezone (MSVCRT.@)
*/
long MSVCRT___timezone = 0;
/*********************************************************************
* __p_timezone (MSVCRT.@)
*/
long *MSVCRT___p__timezone(void)
{
return &MSVCRT___timezone;
}
/*********************************************************************
* _tzname (MSVCRT.@) * _tzname (MSVCRT.@)
* NOTES * NOTES
* Some apps (notably Mozilla) insist on writing to these, so the buffer * Some apps (notably Mozilla) insist on writing to these, so the buffer
* must be large enough. The size is picked based on observation of * must be large enough. The size is picked based on observation of
* Windows XP. * Windows XP.
*/ */
static char tzname_std[64] = ""; /* FIXME: initialize */ static char tzname_std[64] = "";
static char tzname_dst[64] = ""; /* FIXME: initialize */ static char tzname_dst[64] = "";
char *MSVCRT__tzname[2] = { tzname_std, tzname_dst }; char *MSVCRT__tzname[2] = { tzname_std, tzname_dst };
/********************************************************************* /*********************************************************************
...@@ -328,3 +341,17 @@ char **__p__tzname(void) ...@@ -328,3 +341,17 @@ char **__p__tzname(void)
{ {
return MSVCRT__tzname; 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';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment