[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] date: reinstate the --iso-8601 (-I) option

From: Jim Meyering
Subject: [PATCH] date: reinstate the --iso-8601 (-I) option
Date: Thu, 27 Oct 2011 22:21:04 +0200

Now that date can finally parse the output of date --iso-8601 (-I),
it's only fair to un-deprecate it and restore its documentation:

>From 2f1384b7e4674f2bdf4c471eee050bece59e01e6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 27 Oct 2011 22:02:23 +0200
Subject: [PATCH] date: reinstate the --iso-8601 (-I) option

We deprecated and undocumented the --iso-8601 (-I) option mostly
because date could not parse that particular format.  Now that
it can, it's time to restore the documentation.
* src/date.c (usage): Document it.
* doc/coreutils.texi (Options for date): Reinstate documentation.
Reported by Hubert Depesz Lubaczewski in
 doc/coreutils.texi |   28 ++++++++++++++++++++++++++++
 src/date.c         |    6 +++++-
 2 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 7b37f60..9233194 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -14262,6 +14262,34 @@ Options for date
 system overhead of starting up the @command{date} executable many times can
 be considerable.

address@hidden address@hidden
address@hidden address@hidden
address@hidden address@hidden
address@hidden address@hidden
+Display the date using the @acronym{ISO} 8601 format, @samp{%Y-%m-%d}.
+The argument @var{timespec} specifies the number of additional
+terms of the time to include.  It can be one of the following:
address@hidden @samp
address@hidden auto
+Print just the date.  This is the default if @var{timespec} is omitted.
address@hidden hours
+Append the hour of the day to the date.
address@hidden minutes
+Append the hours and minutes.
address@hidden seconds
+Append the hours, minutes and seconds.
address@hidden ns
+Append the hours, minutes, seconds and nanoseconds.
address@hidden table
+If showing any time terms, then include the time zone using the format
 @item -r @var{file}
 @itemx address@hidden
 @opindex -r
diff --git a/src/date.c b/src/date.c
index 755736a..288804a 100644
--- a/src/date.c
+++ b/src/date.c
@@ -87,7 +87,7 @@ static struct option const long_options[] =
   {"date", required_argument, NULL, 'd'},
   {"file", required_argument, NULL, 'f'},
-  {"iso-8601", optional_argument, NULL, 'I'}, /* Deprecated.  */
+  {"iso-8601", optional_argument, NULL, 'I'},
   {"reference", required_argument, NULL, 'r'},
   {"rfc-822", no_argument, NULL, 'R'},
   {"rfc-2822", no_argument, NULL, 'R'},
@@ -131,6 +131,10 @@ Display the current time in the given FORMAT, or set the 
system date.\n\
   -d, --date=STRING         display time described by STRING, not `now'\n\
   -f, --file=DATEFILE       like --date once for each line of DATEFILE\n\
+  -I[TIMESPEC], --iso-8601[=TIMESPEC]  output date/time in ISO 8601 format.\n\
+                            TIMESPEC=`date' for date only (the default),\n\
+                            `hours', `minutes', `seconds', or `ns' for date\n\
+                            and time to the indicated precision.\n\
 "), stdout);
       fputs (_("\
   -r, --reference=FILE      display the last modification time of FILE\n\

reply via email to

[Prev in Thread] Current Thread [Next in Thread]