Exact timestamp for sorting and renaming files according to
creation order
Dan Nelson
dnelson at allantgroup.com
Tue Jan 3 22:19:25 UTC 2012
In the last episode (Jan 03), Polytropon said:
> On Tue, 3 Jan 2012 14:49:02 -0600, Dan Nelson wrote:
> > If you ask for the date to be printed in "float" (F) format, it gives
> > more precision. The default is unsigned int (U) format.
> >
> > % stat -f "%N %FB" /COPYRIGHT
> > /COPYRIGHT 1306190895.046721049
>
> Strangely, I only get a 000000000 "suffix" for any
> time stamp, no matter if I create the file or apply
> the command as shown above to an existing file:
>
> % stat -f "%N %FB" /COPYRIGHT
> /COPYRIGHT 1313951230.000000000
>
> Am I missing some file system feature?
>
> Otherwise, this _exactly_ looks like what I'm searching for. It doesn't
> need to be a "human-readable" date representation.
>
> by the way, I'm running FreeBSD 8.2-STABLE/x86 of late August 2011 here,
> file system used is UFS2.
Try raising the vfs.timestamp_precision sysctl above zero. That gives me
useful fractional values on ufs.
% sysctl -d vfs.timestamp_precision
vfs.timestamp_precision: File timestamp precision (
0: seconds,
1: sec + ns accurate to 1/HZ,
2: sec + ns truncated to ms,
3+: sec + ns (max. precision))
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list