[tz] What does "tm_isdst" mean? (was: Re: Unexpected last transition in Africa/Casablanca)
gharris at sonic.net
Wed Mar 30 20:14:22 UTC 2022
On Mar 30, 2022, at 11:36 AM, Paul Eggert via tz <tz at iana.org> wrote:
> It'd be less intrusive to add a transition after the last transition, which I hope would also work around the problem (as it'd exhibit a similar pattern) but would cause the rearguard and main timestamps to disagree only with respect to the isdst flag for a day, which is less of a difference.
Oh, it's this flag again.
A C22 draft as of October 18, 2021:
7.27.1 Components of time
The header <time.h> defines several macros, and declares types and functions for manipulating time. Many functions deal with a calendar time that represents the current date (according to the Gregorian calendar) and time. Some functions deal with local time, which is the calendar time expressed for some specific time zone, and with Daylight Saving Time, which is a temporary change in the algorithm for determining local time. The local time zone and Daylight Saving Time are implementation-defined.
The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight Saving Time is not in effect, and negative if the information is not available.
As I read it:
an implementation that interprets "Daylight Saving Time" as "the clocks are temporarily turned forward", even if, as in Ireland, turning the clock forward is a change to *standard* time, would be valid, as it's a temporary change - as is the change back to "winter time";
an implementation that interprets "Daylight Saving Time" as "the clocks are temporarily changed from standard time", meaning that, in Ireland, "Daylight Saving Time" would be "winter time" would also be valid, as it's again a temporary change.
On the other hand, an implementation that interprets "Daylight Saving Time" as "the clocks are temporarily turned *backward*" would also be valid, as long as they're temporarily turned forward as well.
That ambiguity would require that the standard address what "*the* algorithm for determining local time", emphasis on "*the*" as in "this one is Official", is - is it the algorithm used during what the applicable government deems to be "standard time", or what? "The local time zone and Daylight Saving Time are implementation-defined." sounds as if they're trying to avoid that particular tarpit.
However, a change to "permanent Daylight Saving Time" wouldn't be "Daylight Saving Time", as the change wouldn't be permanent.
Should somebody ask the C standards committee to clarify this?
More information about the tz