diff --git a/src/date.c b/src/date.c index eb7c624..b6d4b21 100644 --- a/src/date.c +++ b/src/date.c @@ -52,7 +52,11 @@ enum Time_spec /* Put these last, since they aren't valid for --rfc-3339. */ - /* Display date and hour. */ + /* Display year and ordinal day number. */ + TIME_SPEC_ORDINAL, + /* Display year and week number. */ + TIME_SPEC_WEEKS, + /* Display date and hour. */ TIME_SPEC_HOURS, /* Display date, hours, and minutes. */ TIME_SPEC_MINUTES @@ -60,14 +64,14 @@ enum Time_spec static char const *const time_spec_string[] = { - /* Put "hours" and "minutes" first, since they aren't valid for - --rfc-3339. */ - "hours", "minutes", + /* Put "ordinal", "weeks", "hours" and "minutes" first, since + they aren't valid for --rfc-3339. */ + "ordinal", "weeks", "hours", "minutes", "date", "seconds", "ns", NULL }; static enum Time_spec const time_spec[] = { - TIME_SPEC_HOURS, TIME_SPEC_MINUTES, + TIME_SPEC_ORDINAL, TIME_SPEC_WEEKS, TIME_SPEC_HOURS, TIME_SPEC_MINUTES, TIME_SPEC_DATE, TIME_SPEC_SECONDS, TIME_SPEC_NS }; ARGMATCH_VERIFY (time_spec_string, time_spec); @@ -151,8 +155,9 @@ Display the current time in the given FORMAT, or set the system date.\n\ fputs (_("\ -I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 format.\n\ FMT='date' for date only (the default),\n\ - 'hours', 'minutes', 'seconds', or 'ns'\n\ - for date and time to the indicated precision.\n\ + 'ordinal', 'weeks', 'hours', 'minutes',\n\ + 'seconds', or 'ns' for date and time to \n\ + the indicated precision.\n\ Example: 2006-08-14T02:34:56-06:00\n\ "), stdout); fputs (_("\ @@ -392,7 +397,7 @@ main (int argc, char **argv) }; enum Time_spec i = XARGMATCH ("--rfc-3339", optarg, - time_spec_string + 2, time_spec + 2); + time_spec_string + 4, time_spec + 4); new_format = rfc_3339_format[i]; break; } @@ -403,6 +408,8 @@ main (int argc, char **argv) "%Y-%m-%d", "%Y-%m-%dT%H:%M:%S%:z", "%Y-%m-%dT%H:%M:%S,%N%:z", + "%Y-%j", + "%G-W%V", "%Y-%m-%dT%H%:z", "%Y-%m-%dT%H:%M%:z" };