]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
date: document +%-N change
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 21 May 2020 00:31:18 +0000 (17:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 21 May 2020 00:32:53 +0000 (17:32 -0700)
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.

NEWS
doc/coreutils.texi

diff --git a/NEWS b/NEWS
index 1f59a156a24c6f97b1ef232e376e29344e0c0862..8ddd0e22f6777152588b7f3398c773e1a06a9cd6 100644 (file)
--- 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.
index 0e1dc48bd053cab0379fe77f41d735fbf88d6e92..f0684b1c5997ff8090df67a8f644a10ed421cf8e 100644 (file)
@@ -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: