Permalink
Browse files

stat: do not provide variable precision time stamps

* src/stat.c: Don't include fstimeprec.c.
(out_epoch_sec): Don't call fstimeprec.
* NEWS: Update description.
* doc/coreutils.texi: Likewise.
  • Loading branch information...
1 parent 6568b17 commit 4a8e9bf14c33b356680298d29f7321d82d4fde5d Jim Meyering committed Nov 13, 2010
Showing with 10 additions and 13 deletions.
  1. +3 −2 NEWS
  2. +5 −5 doc/coreutils.texi
  3. +1 −1 gnulib
  4. +1 −5 src/stat.c
View
5 NEWS
@@ -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
View
@@ -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
2 gnulib
Submodule gnulib updated from 4baf5c to 6383a3
View
@@ -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]))

0 comments on commit 4a8e9bf

Please sign in to comment.