Move tzset calls to time functions.

* libc/stdlib/setenv_r.c (_setenv_r): Remove tzset() call for TZ
	definition.
	* libc/time/lcltime_r.c (localtime_r): Add tzset() call
	* libc/time/mktime.c (mktime):  Ditto.
	* libc/time/strftime.c (strftime, wcsftime): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Craig Howland 2015-03-31 10:26:49 +02:00 committed by Corinna Vinschen
parent 95a4fc8726
commit 382fa90fe1
5 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2015-03-30 Craig Howland <howland@LGSInnovations.com>
* libc/stdlib/setenv_r.c (_setenv_r): Remove tzset() call for TZ
definition.
* libc/time/lcltime_r.c (localtime_r): Add tzset() call
* libc/time/mktime.c (mktime): Ditto.
* libc/time/strftime.c (strftime, wcsftime): Ditto.
2015-03-30 Yaakov Selkowitz <yselkowi@redhat.com>
* libc/time/strftime.c (strftime) <%Z>: Initialize tznam to NULL.

View File

@ -79,9 +79,6 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite),
{ /* old larger; copy over */
while ((*C++ = *value++) != 0);
ENV_UNLOCK;
/* if we are changing the TZ environment variable, update timezone info */
if (strcmp (name, "TZ") == 0)
tzset ();
return 0;
}
}
@ -128,10 +125,6 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite),
ENV_UNLOCK;
/* if we are setting the TZ environment variable, update timezone info */
if (strncmp ((*p_environ)[offset], "TZ=", 3) == 0)
tzset ();
return 0;
}

View File

@ -31,6 +31,7 @@ _DEFUN (localtime_r, (tim_p, res),
year = res->tm_year + YEAR_BASE;
ip = __month_lengths[isleap(year)];
tzset ();
TZ_LOCK;
if (_daylight)
{

View File

@ -197,6 +197,8 @@ _DEFUN(mktime, (tim_p),
/* compute total seconds */
tim += (days * _SEC_IN_DAY);
tzset ();
TZ_LOCK;
if (_daylight)

View File

@ -1283,6 +1283,7 @@ recurse:
if (tim_p->tm_isdst >= 0)
{
long offset;
tzset ();
#if defined (__CYGWIN__)
/* Cygwin must check if the application has been built with or
@ -1313,6 +1314,7 @@ recurse:
size_t size;
const char *tznam = NULL;
tzset ();
TZ_LOCK;
#if defined (__CYGWIN__)
/* See above. */