History log of /external/toybox/toys/posix/date.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d852ec18900ef635a38f99ed769a636f15af72c6 19-May-2017 Rob Landley <rob@landley.net> Implement date %N, loosely inspired by Elliott Hughes's patch.

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.
/external/toybox/toys/posix/date.c
36beb530a79fff3d82df2bd1550693ca10d808e8 29-Mar-2017 Rob Landley <rob@landley.net> Don't try to implement %s, we have @seconds, strptime() in libc tends
not to have it, and implementing our own means a pattern like
"Time %%%s%%" is expensive to handle the corner cases of.
/external/toybox/toys/posix/date.c
05e4ba445d2fb08152ebe5cfcf686c22af8a8862 29-Mar-2017 Rob Landley <rob@landley.net> Replace chkmktime() (which produces false positive normalization failures)
with range checks for seconds, minutes, hours, day of month, and month.
/external/toybox/toys/posix/date.c
4e39281c1f380c53ee6ef8b9795111e0695a55be 11-Nov-2015 Elliott Hughes <enh@google.com> Document %s in date(1).
/external/toybox/toys/posix/date.c
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/toys/posix/date.c
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/toys/posix/date.c
7f6bb3dae7ffe5ffdf10cc2e73a803ff820ebca8 11-Aug-2015 Rob Landley <rob@landley.net> Bugfixes from Elliott Hughes: debug code got checked in (oops) and
uninitialized trash in struct tm fields could segfault glibc's strftime().
/external/toybox/toys/posix/date.c
5fb2766a9b51ee326a14ec9909066b20a2bfa9ac 08-Aug-2015 Rob Landley <rob@landley.net> Teach date @unixtime[.fraction], switch -s to be -D (matching busybox and
not stomping on gnu's "an extra argument tells it to set the time so let's
add -s to do the same thing" extension).

Nanoseconds aren't uniformly supported by these apis, so had to stick it in
GLOBALS() and pull it out later. Awkward, open to suggestions for a better way.
(Also, the setting API is microseconds, not nanoseconds. Collect nano, convert
to micro so we can switch APIs later without changing date's external UI again.)

Oh, and shrink really_long_name_mktime() with a for() loop (and rename it)
although I may go back and redo that for portability to hypothetical libraries
if I can convert this mess to struct timespec with proper nanoseconds support.
But that needs an extended strptime() which needs an extended struct tm,
and between us and that is convincing posix computers got fast enough to
care about fractions of a second.

(Yes, I'm aware gnu added %N to date without adding it to strptime, implying
they reimplemented strptime longhand inside date. I'm not doing that.)
/external/toybox/toys/posix/date.c
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/toys/posix/date.c
7a3f53ba446ae2600763ee37b7f8dcc91de3ec5f 03-Aug-2015 Rob Landley <rob@landley.net> Mark command-local functions static.
/external/toybox/toys/posix/date.c
feb696ae85c34ba65da30fde9545153398b1a2de 04-Jul-2014 Rob Landley <rob@landley.net> date -r wasn't saving the result in the right variable. (And make date -ur work.)
/external/toybox/toys/posix/date.c
7dfee8efa743c7dffc3803109a143a4d6333556f 24-May-2014 Rob Landley <rob@landley.net> Remove debug detritus I didn't mean to to check in, and treat an "this variable can never actually be used uninitialized but gcc's warning generator can't tell and fails spamwards" warning.
/external/toybox/toys/posix/date.c
0369ba56ef4f4c14c62ee6bf77bddd444862398a 23-May-2014 Rob Landley <rob@landley.net> date: add -ds, document +FORMAT escapes.
/external/toybox/toys/posix/date.c
6c64f5f186d26d4c95d408979d33831935e026f1 16-Apr-2014 Rob Landley <rob@landley.net> Revert lots of half-finished local debris I didn't mean to check in with Isaac's roadmap update.

Mercurial's "import" command is still broken, committing local tree changes to files that weren't even touched by the patch because the hg developers inisist, when I point out how stupid it is, that they meant to do that. (hg record can do hunks, but import can't even track _files_.)
/external/toybox/toys/posix/date.c
931425ca05b93348dd497598af077d16cdc1cd3c 13-Apr-2014 Isaac Dunham <ibid.ag@gmail.com> roadmap: describe glibc commands.

Some glibc commands are irrelevant because they're for functionality
that is excluded from musl (mtrace, rpc*, localedef, iconvconfig, nscd).
getconf and catchsegv look like candidates for the development toolchain;
locale and iconv were already triaged.
getent is pretty lame, but it and the timezone stuff (tzselect zic
zdump) are the only new possibly interesting commands.
/external/toybox/toys/posix/date.c
669f332aafe1afdbbfbe4b7c1c8fdab6fa2cec1d 11-Apr-2014 Rob Landley <rob@landley.net> Fix date setting, and fluff out help text a bit.
/external/toybox/toys/posix/date.c
7aa651a6a4496d848f86de9b1e6b3a003256a01f 14-Nov-2012 Rob Landley <rob@landley.net> Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.

The actual code should be the same afterward, this is just cosmetic refactoring.
/external/toybox/toys/posix/date.c
c0e56edaf256adb6c60c5a052525a1ffbb927901 08-Oct-2012 Rob Landley <rob@landley.net> New build infrastructure to generate FLAG_ macros and TT alias, #define FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
/external/toybox/toys/posix/date.c
f91b7c89bc852868692b9518185421ebb52d67b3 26-Aug-2012 Rob Landley <rob@landley.net> Regularize command headers, update links to standards documents.
/external/toybox/toys/posix/date.c
3a9241add947cb6d24b5de7a8927517426a78795 25-Aug-2012 Rob Landley <rob@landley.net> Move commands into "posix", "lsb", and "other" menus/directories.
/external/toybox/toys/posix/date.c