diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | doc/coreutils.texi | 10 | ||||
m--------- | gnulib | 0 | ||||
-rw-r--r-- | src/stat.c | 6 |
4 files changed, 9 insertions, 12 deletions
@@ -24,8 +24,9 @@ GNU coreutils NEWS -*- outline -*- stat's %X, %Y, and %Z directives once again print only the integer part of seconds since the epoch. This reverts a change from coreutils-8.6, that was deemed unnecessarily disruptive. To obtain - a full resolution time stamp for %X, use %.X; if you want (say) just - 3 fractional digits, use %.3X. Likewise for %Y and %Z. + a nanosecond-precision floating point time stamp for %X use %.X; + if you want (say) just 3 fractional digits, use %.3X. Likewise + for %Y and %Z. stat's new %W format directive would print floating point seconds. However, with the above change to %X, %Y and %Z, we've made %W work diff --git a/doc/coreutils.texi b/doc/coreutils.texi index ce56b0e5e..6a4257f61 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -10718,10 +10718,10 @@ The valid @var{format} directives for files with @option{--format} and The @samp{%W}, @samp{%X}, @samp{%Y}, and @samp{%Z} formats accept a precision preceded by a period to specify the number of digits to -print after the decimal point. For example, @samp{%.9X} outputs the -last access time to nanosecond precision. If a period is given but no -precision, @command{stat} uses the estimated precision of the file -system. When discarding excess precision, time stamps are truncated +print after the decimal point. For example, @samp{%.3X} outputs the +last access time to millisecond precision. If a period is given but no +precision, @command{stat} uses 9 digits, so @samp{%.X} is equivalent to +@samp{%.9X} When discarding excess precision, time stamps are truncated toward minus infinity. @example @@ -10737,7 +10737,7 @@ precision: $ stat -c '[%.3Y]' /usr [1288929712.114] $ stat -c '[%.Y]' /usr - [1288929712.114951] + [1288929712.114951834] @end example The mount point printed by @samp{%m} is similar to that output diff --git a/gnulib b/gnulib -Subproject 4baf5c1e594a65a315fbd5094eaeeb11f4630d1 +Subproject 6383a3bbe16d3615791568c030fed5bfe86a438 diff --git a/src/stat.c b/src/stat.c index ae7ce021f..b419f1943 100644 --- a/src/stat.c +++ b/src/stat.c @@ -63,7 +63,6 @@ #include "file-type.h" #include "filemode.h" #include "fs.h" -#include "fstimeprec.h" #include "getopt.h" #include "mountlist.h" #include "quote.h" @@ -557,10 +556,7 @@ out_epoch_sec (char *pformat, size_t prefix_len, struct stat const *statbuf, } else { - static struct fstimeprec *tab; - if (! tab) - tab = fstimeprec_alloc (); - precision = fstimeprec (tab, statbuf); + precision = 9; } if (precision && ISDIGIT (dot[-1])) |