Use a -1 value for tm_isdst to guess time zone if it's unspecified.
This commit is contained in:
parent
a4a437484d
commit
8726142251
|
@ -226,7 +226,6 @@ s48_value date2time(s48_value sec, s48_value min, s48_value hour,
|
|||
d.tm_mon = s48_extract_fixnum (month);
|
||||
d.tm_year = s48_extract_fixnum (year);
|
||||
d.tm_wday = 0; d.tm_yday = 0;
|
||||
d.tm_isdst = (summer == S48_FALSE) ? 0 : 1;
|
||||
|
||||
if( S48_FIXNUM_P(tz_secs) ) { /* Offset from GMT in seconds. */
|
||||
char **oldenv = environ; /* Set TZ to UTC */
|
||||
|
@ -243,12 +242,17 @@ s48_value date2time(s48_value sec, s48_value min, s48_value 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( S48_STRING_P(tz_name) ) { /* Time zone */
|
||||
char *newenv[2];
|
||||
char **oldenv = make_newenv(tz_name, newenv);
|
||||
if( !oldenv ) return s48_enter_fixnum(errno);
|
||||
tzset(); /* NetBSD, SunOS POSIX-noncompliance requires this. */
|
||||
errno = 0;
|
||||
|
||||
d.tm_isdst = -1;
|
||||
t = mktime(&d);
|
||||
if ((t == -1) && (errno != 0))
|
||||
s48_raise_os_error_5 (errno, sec, min, hour, mday, month);
|
||||
|
@ -258,6 +262,7 @@ s48_value date2time(s48_value sec, s48_value min, s48_value hour,
|
|||
else { /* Local time */
|
||||
tzset(); /* NetBSD, SunOS POSIX-noncompliance requires this. */
|
||||
errno = 0;
|
||||
d.tm_isdst = -1;
|
||||
t = mktime(&d);
|
||||
if ((t == -1) && (errno != 0))
|
||||
s48_raise_os_error_5 (errno, sec, min, hour, mday, month);
|
||||
|
|
Loading…
Reference in New Issue