ignore result of mktime

The result of `mktime` is -1 for an error. The result is also -1 if
the time is 1 second before the epoch. That's not useful, so ignore
it.

original commit: aa8ca31cef223128fd8ed1abdc76beb31a0e077a
This commit is contained in:
Matthew Flatt 2019-11-23 19:54:30 -05:00
parent 6789fd84c1
commit ddf4322ef2

View File

@ -351,7 +351,7 @@ ptr S_gmtime(ptr tzoff, ptr tspair) {
if (tzoff == Sfalse) { if (tzoff == Sfalse) {
if (localtime_r(&tx, &tmx) == NULL) return Sfalse; if (localtime_r(&tx, &tmx) == NULL) return Sfalse;
tmx.tm_isdst = -1; /* have mktime determine the DST status */ tmx.tm_isdst = -1; /* have mktime determine the DST status */
if (mktime(&tmx) == (time_t)-1) return Sfalse; mktime(&tmx);
(void) adjust_time_zone(dtvec, &tmx, Sfalse); (void) adjust_time_zone(dtvec, &tmx, Sfalse);
} else { } else {
tx += Sinteger_value(tzoff); tx += Sinteger_value(tzoff);