Age | Commit message (Collapse) | Author |
|
These are reasonable examples I found in AOSP.
I also came across "today" (which is the same as the more obvious "now"),
"yesterday", "7 days ago" and "1 month ago". I'm not sure how far down
that rabbit hole we want to go. But these ones at least seem reasonable.
|
|
I didn't implement %37N's ability to insert zeroes, so removed those
two tests. If you really need it, I can add the divide loop back.
|
|
(or April 31 in any year). Some normalization allowed, exclusions are just
what http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html says.
|
|
|
|
|
|
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.
|
|
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.
|
|
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).
|