d885b528f2d26435ecff83da9e50e815ac73605b |
|
11-Nov-2015 |
Elliott Hughes <enh@google.com> |
Fix year parsing in date(1). Four-digit years were being mangled by the code for two-digit years. Move all the two-digit year code into the "we only saw two digits" case. Add some new tests and fix existing tests.
/external/toybox/tests/date.test
|
05499787ca89fa4b017c2441e89020799f02e4c1 |
|
11-Aug-2015 |
Elliott Hughes <enh@google.com> |
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.
/external/toybox/tests/date.test
|
400dacdeb69bc13868a625fc2ce8b49b6acd5ae3 |
|
08-Aug-2015 |
Elliott Hughes <enh@google.com> |
Reject invalid dates in date(1). Humans get upset when date(1) lets mktime(3) work out what the 99th day of the 99th month would be rather than rejecting the invalid date. For the subtly wrong cases, rather than get into the leap year business, let's rely on localtime_r(3).
/external/toybox/tests/date.test
|