[tz] mktime(): wrong value for DST taken?

Zefram zefram at fysh.org
Tue Mar 14 16:15:38 UTC 2017


Kees Dekker wrote:
>Based on the provided TZ value, I expected that 01:59:30 is still
>in DST, and thus the returned value by mktime should be 1319954370
>(i.e. one hour off).

You have misunderstood the timing of the DST transition.  The time of day
given in the TZ variable is interpreted according to local time as it was
prior to the transition.  So your "/02:00" means that, at the end of DST,
local time jumps back from 02:00 to 01:00.  (Jumping at this time of day
is in fact US practice.)  Local times from 01:00 (inclusive) to 02:00
(exclusive) are ambiguous.  Your input falls within the ambiguous period,
so mktime() would be entitled to return either 1319954370 with isdst=1
(as you expected and as glibc did) or 1319957970 with isdst=0 (as the
tz library did).

-zefram


More information about the tz mailing list