Re: [coreutils] Re: [PATCH 2/2] stat: print timestamps to full resolutio
From:
Pádraig Brady
Subject:
Re: [coreutils] Re: [PATCH 2/2] stat: print timestamps to full resolution
Date:
Thu, 21 Oct 2010 15:42:13 +0100
User-agent:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3
On 21/10/10 15:18, Pádraig Brady wrote:
> On 21/10/10 15:01, Jim Meyering wrote:
>> Andreas Schwab wrote:
>>> Jim Meyering <address@hidden> writes:
>>>
>>>> And besides, with coreutils-8.6 already released, reverting the
>>>> change is no longer an option.
>>>
>>> Why? I'm pretty sure more breakage will pop up over time.
>>
>> Hmm... I see what you mean.
>> Anyone using a distribution with coreutils-8.5 or older will
>> think it's fine to treat $(stat -c %X) as an integer with no
>> decimal or trailing fraction.
>>
>> Is it worthwhile to create a new format, say %...:X (and same for Y and Z)
>> that expands to seconds.nanoseconds and to revert %...X to the old
>> seconds-only semantics?
>>
>> That would make it so people could use stat's %X %Y %Z portably
>> while new scripts can still get nanosecond accuracy when needed.
>>
>> Here's PoC code:
>>
>> $ for i in %X %:X %Y %:Y %Z %:Z; do src/stat -c $i .; done
>> 1256665918
>> 1256665918.441784225
>
> Or use '.' rather than ':' which also has the
> advantage of being backward compat with older stats,
To clarify, coreutils <= 8.5 output these timestamps
using an int format internally, and so ignored any specified precision.
coreutils 8.6 treats these timestamps as strings and
therefore %.X will not output anything which is a pity,
but if we're considering making 8.6 "special" in it's
handling of %[WXYZ], then perhaps this is OK.
cheers,
Pádraig.