[tz] mktime() clarification

brian.inglis at systematicsw.ab.ca brian.inglis at systematicsw.ab.ca
Mon Mar 25 23:24:18 UTC 2024


On 2024-03-25 15:08, Dag-Erling Smørgrav via tz wrote:
> "Clive D.W. Feather via tz" <tz at iana.org> writes:
>> There is no requirement in the C99 Standard (I dropped out of WG14 shortly
>> after) that the call to mktime is made before the value of errno is read.
> 
> True, I was a little hasty in abbreviating my example, but beside the
> point, as you'd realize if you'd bothered to try it.
> 
>       struct tm tm = { .tm_mday = 1, .tm_year = 69 };
>       errno = 0;
>       time_t ret = mktime(&tm);
>       printf("%ld %d\n", (long)ret, errno);

If you want others to run code, you should provide a complete program.

It would be more informative to state the platform and compiler you used, show 
the results you got, and explain what you think it means.

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