[PATCH 07/59] Document mktime out-of-range + tm_isdst

Paul Eggert eggert@cs.ucla.edu
Sun Jan 5 14:03:55 GMT 2025


On 2025-01-05 00:03, Florian Weimer wrote:

> The “Then members are adjusted” part seems unclear to me.  If tm_isdst
> is negative, is there adjustment based on time zone offset?

Yes.

> Would that even be possible, given that tm_gmtoff may not have been
> initialized?

Yes, because mktime knows the timezone. It ignores tm_gmtoff when 
initially determining the UTC offset; instread, it inspects the timezone 
data and infers the UTC offset from that.

The attached followup patch attempts to clarify this.


>> 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.

Also done in the attached, which says that gmtime counts as similar only 
if local time is UTC.

Thanks for the review.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Clarify-mktime-and-timegm-doc.patch
Type: text/x-patch
Size: 4383 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250105/b1d06003/attachment.bin>


More information about the Libc-alpha mailing list