Thread (21 messages) 21 messages, 7 authors, 2024-08-23

Re: [PATCH v3] ctime.3: EXAMPLES: Add example program

From: Vincent Lefevre <hidden>
Date: 2024-08-23 13:54:53

On 2024-08-23 15:12:16 +0200, Alejandro Colomar wrote:
Looking at the WG14 document logs, it seems it was added in n3147:
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3147.txt>
Thanks for the reference. Additional details can be found
in CD2 ballot at

  https://open-std.org/JTC1/SC22/WG14/www/docs/n3148.doc

which references the POSIX bug

  https://austingroupbugs.net/view.php?id=1614

where I can see at the end:

  On page 1332 line 44348 section mktime(), change:

    if (mktime(&time_str) == -1)

  to:

    time_str.tm_wday = -1;
    if (mktime(&time_str) == (time_t)-1 && time_str.tm_wday == -1)

This is the test I suggested: a check that mktime() returns -1,
and since it can be a valid value, a second test on tm_wday
(where the input, which is ignored, has an invalid value such
as -1 here, or INT_MAX in your case; note that -1 may be more
efficient with some processors, and shorter to write).

-- 
Vincent Lefèvre [off-list ref] - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help