MF 0.6: 1.4->1.5:

Provide -1 value for tm_isdst in non-tz-secs cases.
This commit is contained in:
sperber 2001-07-11 13:16:59 +00:00
parent df37fa6cae
commit a4727055dd
1 changed files with 6 additions and 1 deletions

View File

@ -217,7 +217,7 @@ scheme_value date2time(int sec, int min, int hour,
d.tm_sec = sec; d.tm_min = min; d.tm_hour = hour;
d.tm_mday = mday; d.tm_mon = month; d.tm_year = year;
d.tm_wday = 0; d.tm_yday = 0; d.tm_isdst = summer;
d.tm_wday = 0; d.tm_yday = 0;
if( FIXNUMP(tz_secs) ) { /* Offset from GMT in seconds. */
char **oldenv = environ; /* Set TZ to UTC */
@ -232,12 +232,16 @@ scheme_value date2time(int sec, int min, int hour,
environ = oldenv;
}
/* ### Note that we *still* don't implement the manual paragraph
with "When calcultating with time-zones, the date's SUMMER?
field is used to resolve ambiguities. */
else if( STRINGP(tz_name) ) { /* Time zone */
char *newenv[2];
char **oldenv = make_newenv(tz_name, newenv);
if( !oldenv ) return ENTER_FIXNUM(errno);
tzset(); /* NetBSD, SunOS POSIX-noncompliance requires this. */
errno = 0;
d.tm_isdst = -1;
t = mktime(&d);
if( t == -1 ) return ENTER_FIXNUM(errno ? errno : -1);
revert_env(oldenv);
@ -246,6 +250,7 @@ scheme_value date2time(int sec, int min, int hour,
else { /* Local time */
tzset(); /* NetBSD, SunOS POSIX-noncompliance requires this. */
errno = 0;
d.tm_isdst = -1;
t = mktime(&d);
if( t == -1) return ENTER_FIXNUM(errno ? errno : -1);
}