[Remind-Fans] Remind 04.02.00: make test failed on OpenBSD
Martin Ziemer
horrad at horrad.de
Mon Oct 17 09:52:55 EDT 2022
Am Mon, Oct 17, 2022 at 09:31:45AM -0400 schrieb Dianne Skoll via Remind-fans:
> On Mon, 17 Oct 2022 13:25:13 +0000
> Tim Chase via Remind-fans <remind-fans at lists.skoll.ca> wrote:
> > I just compared the clocks on my OpenBSD machines using
> >
> > $ TZ=America/Toronto date
> > Mon Oct 17 09:15:24 EDT 2022
> Yes, but that's not the test we need. We need to know what time
> it thinks it is at 2022-11-06T01:59 in Toronto.
>
> Daylight Saving Time in Toronto ends at 2022-11-06T02:00 local time.
> However, there's an ambiguity and it's possible OpenBSD's C library
> and glibg handle it differently. There are actually *two different*
> times in Toronto at 2022-11-06T01:59: One before daylight saving time
> ends, which corresponds to the time *before* DST ends, which means
> 2022-11-06T05:59 UTC. The second 2022-11-06T01:59 corresponds to
> the time *after* DST ends, which is 2022-11-06T06:59.
I just tested this case and found out, with negative tm_isdst (as used in
the code) the daylight saving changes from 01:11 to 01:12!:
(57) horrad at dozer:~/Temp $ TZ=America/Toronto date -j "2211060112"
Sun Nov 6 01:12:00 EST 2022
(58) horrad at dozer:~/Temp $ TZ=America/Toronto date -j "2211060111"
Sun Nov 6 01:11:00 EDT 2022
According to the manpage on OpenBSD a negative tm_isdst means the System
should try to detect the daylight saving time and there even is a warning,
for no consistent return values in this case.
For reference the manpage:
(56) horrad at dozer:~/Temp $ cat
mktime() converts the broken-down time, expressed as local time, in the
structure pointed to by tm into a calendar time value with the same
encoding as that of the values returned by the time() function. The
original values of the tm_wday and tm_yday components of the structure
are ignored, and the original values of the other components are not
restricted to their normal ranges. (A positive or zero value for
tm_isdst causes mktime() to presume initially that summer time (for
example, Daylight Saving Time in the U.S.A.) respectively, is or is not
in effect for the specified time. A negative value for tm_isdst causes
the mktime() function to attempt to divine whether summer time is in
effect for the specified time; in this case it does not use a consistent
rule and may give a different answer when later presented with the same
argument.) On successful completion, the values of the tm_wday and
tm_yday components of the structure are set appropriately, and the other
components are set to represent the specified calendar time, but with
their values forced to their normal ranges; the final value of tm_mday is
not set until tm_mon and tm_year are determined. mktime() returns the
specified calendar time; if the calendar time cannot be represented, it
returns -1.
mktime() converts the broken-down time, expressed as local time, in the
structure pointed to by tm into a calendar time value with the same
encoding as that of the values returned by the time() function. The
original values of the tm_wday and tm_yday components of the structure
are ignored, and the original values of the other components are not
restricted to their normal ranges. (A positive or zero value for
tm_isdst causes mktime() to presume initially that summer time (for
example, Daylight Saving Time in the U.S.A.) respectively, is or is not
in effect for the specified time. A negative value for tm_isdst causes
the mktime() function to attempt to divine whether summer time is in
effect for the specified time; in this case it does not use a consistent
rule and may give a different answer when later presented with the same
argument.) On successful completion, the values of the tm_wday and
tm_yday components of the structure are set appropriately, and the other
components are set to represent the specified calendar time, but with
their values forced to their normal ranges; the final value of tm_mday is
not set until tm_mon and tm_year are determined. mktime() returns the
specified calendar time; if the calendar time cannot be represented, it
returns -1.
More information about the Remind-fans
mailing list