From 10d002160949c985e6f99fb8d647d5e3c67ef554 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 17 Apr 2002 21:23:31 +0000 Subject: 2002-04-17 Jeff Johnston * libc/include/time.h (tzset, _tzset_r): Added prototypes. (strptime): Moved prototype to be within !__STRICT_ANSI__. (_tzname, _daylight, _timezone): No long __CYGWIN__ only. (tzname): Defined for all platforms. (daylight, timezone): Defined only for CYGWIN. * libc/sys/linux/machine/i386/crt0.c: Add call to tzset() after environment set up. * libc/stdlib/setenv_r.c (_setenv_r): Call tzset() if the TZ environment variable is set. * libc/time/Makefile.am: Add support for tzset.c, tzlock.c, and tzset_r.c. * libc/time/Makefile.in: Regenerated. * libc/time/gmtime.c (gmtime): Changed to call gmtime_r. * libc/time/gmtime_r.c (gmtime_r): Changed to call _mktm_r. * libc/time/lcltime_r.c (lcltime_r): Ditto. * libc/time/local.h: New local header file. * libc/time/mktime.c (mktime): Add timezone support. * libc/time/mktm_r.c: New file which is the common engine for gmtime_r and lcltime_r. This code has timezone support. * libc/time/strftime.c (strftime): Add %Z timezone support. * libc/time/tzlock.c: New file containing timezone lock stubs. * libc/time/tzset.c: New file containing tzset() routine. * libc/time/tzset_r.c: New file containing _tzset_r and internal routine for calculating timezone changes for specified year. --- newlib/libc/stdlib/setenv_r.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'newlib/libc/stdlib/setenv_r.c') diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c index 6cc18a868..f06dc6772 100644 --- a/newlib/libc/stdlib/setenv_r.c +++ b/newlib/libc/stdlib/setenv_r.c @@ -1,5 +1,5 @@ /* This file may have been modified by DJ Delorie (Jan 1991). If so, -** these modifications are Copyright (C) 1991 DJ Delorie +** these modifications are Copyright (C) 1991 DJ Delorie. */ /* @@ -26,6 +26,7 @@ #include #include #include +#include #include "envlock.h" extern char **environ; @@ -69,8 +70,11 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), } if (strlen (C) >= l_value) { /* old larger; copy over */ - while ((*C++ = *value++) != 0); + 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; } } @@ -117,6 +121,10 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), ENV_UNLOCK; + /* if we are setting the TZ environment variable, update timezone info */ + if (strcmp (name, "TZ") == 0) + tzset (); + return 0; } -- cgit v1.2.3