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

- implement _tzset, and initialize _daylight, _timezone, and _tzname
  from libc values
This commit is contained in:
Juan Lang 2005-05-14 11:07:10 +00:00 committed by Alexandre Julliard
parent f12eadf7bf
commit 7bf1ee877d
4 changed files with 34 additions and 15 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -300,16 +300,29 @@ 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
@ -317,8 +330,8 @@ void *MSVCRT___p__daylight(void)
* 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';
}