[tz] mktime() clarification
brian.inglis at systematicsw.ab.ca
brian.inglis at systematicsw.ab.ca
Tue Mar 26 03:52:17 UTC 2024
On 2024-03-25 19:52, Paul Eggert via tz wrote:
> On 3/25/24 12:16, Dag-Erling Smørgrav via tz wrote:
>> it seems to me
>> that the only reliable way to determine whether mktime() succeeded,
>> within the bounds of the aforementioned standards, is to set tm_wday or
>> tm_yday to an out-of-bounds value (e.g. -1) prior to calling mktime()
>
> That's what I do, and it works portably on all platforms I know of. In contrast,
> I doubt whether the errno=0 trick is portable.
>
> I installed the attached proposed patch to the documentation.
> +To distinguish failure from a valid \-1 return,
> +you can set
> +.B tm_mday
.B tm_wday?
> +or
> +.B tm_yday
> +to a negative value before calling
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
More information about the tz
mailing list