On 28/10/10 12:03, Jim Meyering wrote:

>>From 4ee918f1ca742c9b02d00e703625b388b309bcc1 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyer...@redhat.com>
> Date: Thu, 21 Oct 2010 18:41:24 +0200
> Subject: [PATCH] stat: revert %X-%Y-%Z change; use e.g., %:X to print 
> fractional seconds
> 
> This reverts part of the recent commit 9069af45,
> "stat: print timestamps to full resolution", which made %X, %Y, %Z
> print floating point numbers.  We prefer to retain portability of
> %X, %Y and %Z uses, while still providing access to full-resolution
> time stamps via modified format strings.  Also make the new
> %W consistent.
> * src/stat.c: Include "xstrtol.h".
> (print_it): Accept a new %...:[XYZ] format directive,
> e.g., %:X, to print the nanoseconds portion of the corresponding time.
> For example, %3.3:Y prints the zero-padded, truncated, milliseconds
> part of the time of last modification.

The above needs to be updated I think
as the current code needs a 0 specified.

$ src/stat -c [%3.3:Y] /usr
[ 31]

$ src/stat -c [%03.3:Y] /usr
[031]

I notice that this does not truncate as I would expect.
$ src/stat -c [%.3:Y] /usr
[31]

Should we perhaps treat the bit before the '.' as
the width for %ld (defaulting to 09), and the bit
after the '.' as the width for %s?

I've not thought much about that really.

have to run,
Pádraig.

Reply via email to