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
better patch
Attachments:
0001-mktime64-should-return-normalized-structs.patch 2.2 KB
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