coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] Re: [PATCH 2/2] stat: print timestamps to full resolutio


From: Eric Blake
Subject: Re: [coreutils] Re: [PATCH 2/2] stat: print timestamps to full resolution
Date: Thu, 21 Oct 2010 10:36:14 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4

On 10/21/2010 10:32 AM, Jim Meyering wrote:
A possible disadvantage of using this approach is that the naive
implementation would perform truncation.  I.e., using a format of
"%X.%3.3:X", a time of N.100999999 would be truncated to N.100

I would argue that you WANT truncation by default. POSIX is explicit that if a file system cannot represent the full precision of utimensat, that it truncate rather than round. The same should apply in any other context - rounding time into the future is always a potential for confusing bugs, and truncation is the best course of action when reducing precision.


I'm inclined to say:
If you care, don't truncate in the first place, or use
another tool, e.g., printf, to format the floating point number.

Agreed.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

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