Fix more date bugs.
authorElliott Hughes <enh@google.com>
Tue, 11 Aug 2015 21:06:06 +0000 (16:06 -0500)
committerRob Landley <rob@landley.net>
Tue, 11 Aug 2015 21:06:06 +0000 (16:06 -0500)
commit05499787ca89fa4b017c2441e89020799f02e4c1
treec8e48c77d96b47fd710238f82240126e71798981
parent7f6bb3dae7ffe5ffdf10cc2e73a803ff820ebca8
Fix more date bugs.

Correctly and portably check for non-normal dates, and explicitly show
the "before" and "after" dates (in the format of the user's choosing).
Clear the struct tm in date_main rather than parse_default because on
one path the struct tm is actually initialized. Explicitly clear the
tm_sec field in parse_default because -- experiment shows -- that
should not be preserved. Only do the "what does this 2-digit year
mean?" dance if we actually parsed a 2-digit year. Show the right
string in the error message if strptime fails.

Also add more tests, and use UTC in the tests to avoid flakiness.
tests/date.test
toys/posix/date.c