From: Paul Eggert Date: Thu, 21 May 2020 00:31:18 +0000 (-0700) Subject: date: document +%-N change X-Git-Tag: v9.0~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=v8.32-15-g6d0107a37;p=thirdparty%2Fcoreutils.git date: document +%-N change Suggested by Kamil Dudka in: https://lists.gnu.org/r/bug-gnulib/2020-05/msg00205.html * NEWS: Mention the change for coreutils 8.23. * doc/coreutils.texi (Padding and other flags): Document it. --- diff --git a/NEWS b/NEWS index 1f59a156a2..8ddd0e22f6 100644 --- a/NEWS +++ b/NEWS @@ -90,6 +90,11 @@ GNU coreutils NEWS -*- outline -*- [The old behavior was introduced in sh-utils 2.0.15 ca. 1999, predating coreutils package.] + date now pads nanoseconds on the right, not the left. For example, + if the time is currently 1590020079.003388470 seconds after the + Epoch, then "date '+%s.%-N'" formerly output "1590020079.3388470", + and it now outputs "1590020079.00338847". + ls issues an error message on a removed directory, on GNU/Linux systems. Previously no error and no entries were output, and so indistinguishable from an empty directory, with default ls options. diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 0e1dc48bd0..f0684b1c59 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -16034,7 +16034,10 @@ a horizontal tab Unless otherwise specified, @command{date} normally pads numeric fields with zeros, so that, for example, numeric months are always output as two digits. -Seconds since the epoch are not padded, though, +Most numeric fields are padded on the left. +However, nanoseconds are padded on the right since they are commonly +used after decimal points in formats like @samp{%s.%-N}. +Also, seconds since the epoch are not padded since there is no natural width for them. The following optional flags can appear after the @samp{%}: @@ -16082,9 +16085,10 @@ date +%_d/%_m -d "Feb 1" You can optionally specify the field width (after any flag, if present) as a decimal number. If the natural size of the output of the field has less than the specified number of characters, -the result is written right adjusted and padded to the given +the result is normally written right adjusted and padded to the given size. For example, @samp{%9B} prints the right adjusted month name in -a field of width 9. +a field of width 9. Nanoseconds are left adjusted, and are truncated +or padded to the field width. An optional modifier can follow the optional flag and width specification. The modifiers are: