[PATCH 07/59] Document mktime out-of-range + tm_isdst
Florian Weimer
fw@deneb.enyo.de
Sun Jan 5 08:03:54 GMT 2025
* Paul Eggert:
> +If local time ever observes daylight saving time, the @code{tm_isdst}
> +member is inspected after other members are brought into range. If
> +negative, @code{mktime} uses time zone data to determine whether
> +daylight saving time is in effect at the requested time. Then members
> +are adjusted if they would otherwise be inconsistent, e.g., by adding
> +or subtracting an hour if the broken-down time would otherwise have
> +the wrong @code{tm_isdst} member or would occur during a
> +spring-forward gap.
The “Then members are adjusted” part seems unclear to me. If tm_isdst
is negative, is there adjustment based on time zone offset? Would
that even be possible, given that tm_gmtoff may not have been
initialized?
> Ordinarily callers should specify a negative @code{tm_isdst} member.
> The main practical use for nonnegative @code{tm_isdst} is when a the
> broken-down time was produced by @code{localtime} or similar functions
> so its @code{tm_isdst} is already known to be correct.
Please clarify that gmtime does not count as a similar function in
this context.
More information about the Libc-alpha
mailing list