Issue 49 in y2038: mktime64 does not correct unnormalized struct tm's

34 views
Skip to first unread message

codesite...@google.com

unread,
May 30, 2010, 2:13:52 AM5/30/10
to y2038...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 49 by bugzilla.rw: mktime64 does not correct unnormalized struct
tm's
http://code.google.com/p/y2038/issues/detail?id=49

mktime manpage on Linux:

if structure members are outside their valid
interval, they will be normalized (so that, for example, 40 October
is
changed into 9 November);

This does not happen currently, something like attached patch is needed.

Attachments:
time64.c.patch 743 bytes

codesite...@google.com

unread,
May 30, 2010, 3:45:35 AM5/30/10
to y2038...@googlegroups.com

Comment #1 on issue 49 by bugzilla.rw: mktime64 does not correct

better patch

Attachments:
0001-mktime64-should-return-normalized-structs.patch 2.2 KB

codesite...@google.com

unread,
May 30, 2010, 5:58:11 PM5/30/10
to y2038...@googlegroups.com
Updates:
Status: Fixed

Comment #2 on issue 49 by schwern: mktime64 does not correct unnormalized

So not only do we have to take crappy input, but we have to say thank you
and fix it
for them? Guh. POSIX and ISO C agree. When I get my time machine fixed,
I'm
traveling back to 1972 and slapping the hell out of Dennis Ritchie.

Now that I've vented, thank you very much for noticing and patching this!
Your
solution is pretty elegant, it wouldn't have occurred to me. I've cleaned
out the
debugging printfs, added some tests, and committed it.
http://github.com/schwern/y2038/commit/0f1670b73f015b0bfacc426843ee06c7ed4cf28e

Reply all
Reply to author
Forward
0 new messages