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   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to