timezone code bullet-proofed a bit.

This commit is contained in:
shivers 1997-11-10 02:55:17 +00:00
parent a5f1300753
commit 65f6bdd35a
1 changed files with 4 additions and 2 deletions

View File

@ -174,10 +174,12 @@ scheme_value time2date(int hi_secs, int lo_secs, scheme_value zone,
#ifdef HAVE_GMTOFF #ifdef HAVE_GMTOFF
*tz_secs = d.tm_gmtoff; *tz_secs = d.tm_gmtoff;
#else #else
{ char **oldenv = environ; /* Set TZ to UTC */ { struct tm dcopy = d;
char **oldenv = environ; /* Set TZ to UTC */
environ=utc_env; /* time temporarily. */ environ=utc_env; /* time temporarily. */
tzset(); /* NetBSD, SunOS POSIX-noncompliance requires this. */ tzset(); /* NetBSD, SunOS POSIX-noncompliance requires this. */
*tz_secs = mktime(&d) - t; dcopy.tm_isdst = 0;
*tz_secs = mktime(&dcopy) - t; /* mktime() may mung dcopy. */
environ=oldenv; environ=oldenv;
} }
#endif #endif