1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-20 06:12:14 +02:00

date: improve doc

Problem reported by Dan Jacobson (Bug#51288).
* doc/coreutils.texi (date invocation, Setting the time)
(Options for date):
* src/date.c (usage): Improve doc.
This commit is contained in:
Paul Eggert
2022-02-04 18:21:06 -08:00
parent 413a6cf521
commit 67cd2c3b72
2 changed files with 17 additions and 9 deletions

View File

@@ -15976,9 +15976,14 @@ Synopses:
@example
date [@var{option}]@dots{} [+@var{format}]
date [-u|--utc|--universal] @c this avoids a newline in the output
[ MMDDhhmm[[CC]YY][.ss] ]
[@var{MMDDhhmm}[[@var{CC}]@var{YY}][.@var{ss}]]
@end example
The @command{date} command displays the date and time.
With the @option{--set} (@option{-s}) option, or with
@samp{[@var{MMDDhhmm}[[@var{CC}]@var{YY}][.@var{ss}]]},
it sets the date and time.
@vindex LC_TIME
Invoking @command{date} with no @var{format} argument is equivalent to invoking
it with a default format that depends on the @env{LC_TIME} locale category.
@@ -16312,17 +16317,18 @@ modifiers are GNU extensions.
@cindex time setting
@cindex appropriate privileges
If given an argument that does not start with @samp{+}, @command{date} sets
the system clock to the date and time specified by that argument (as
described below). You must have appropriate privileges to set the
system clock. Note for changes to persist across a reboot, the
You must have appropriate privileges to set the
system clock. For changes to persist across a reboot, the
hardware clock may need to be updated from the system clock, which
might not happen automatically on your system.
The argument must consist entirely of digits, which have the following
meaning:
To set the clock, you can use the @option{--set} (@option{-s}) option
(@pxref{Options for date}). To set the clock without using GNU
extensions, you can give @command{date} an argument of the form
@samp{@var{MMDDhhmm}[[@var{CC}]@var{YY}][.@var{ss}]} where each two-letter
component stands for two digits with the following meanings:
@table @samp
@table @var
@item MM
month
@item DD
@@ -16352,6 +16358,7 @@ relative to Universal Time rather than to the local time zone.
@cindex options for @command{date}
The program accepts the following options. Also see @ref{Common options}.
Except for @option{-u}, these options are all GNU extensions to POSIX.
@table @samp

View File

@@ -135,7 +135,8 @@ Usage: %s [OPTION]... [+FORMAT]\n\
"),
program_name, program_name);
fputs (_("\
Display the current time in the given FORMAT, or set the system date.\n\
Display date and time in the given FORMAT.\n\
With -s, or with [MMDDhhmm[[CC]YY][.ss]], set the date and time.\n\
"), stdout);
emit_mandatory_arg_note ();