coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coreutils] stat: reverting recent %X %Y %Z change


From: Pádraig Brady
Subject: Re: [coreutils] stat: reverting recent %X %Y %Z change
Date: Fri, 29 Oct 2010 12:57:07 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

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

>>From 4ee918f1ca742c9b02d00e703625b388b309bcc1 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> 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

[Prev in Thread] Current Thread [Next in Thread]