bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH] time: fix rounding to next second


From: Chet Ramey
Subject: Re: [PATCH] time: fix rounding to next second
Date: Fri, 17 Oct 2025 15:37:14 -0400
User-agent: Mozilla Thunderbird

On 10/17/25 2:33 PM, Grisha Levit wrote:

A zero precision just cuts the decimal point and everything following it.
This is what ksh93 does, and consistent with what POSIX interp 267
specified (the TIMEFORMAT part never actually made it into the standard).

I read that but didn't find anything that suggested a precision of 0 be
treated specially w.r.t. rounding. I think this is the relevant part of
the proposed text:

     The optional p is a decimal digit specifying
     the precision, the number of digits after the
     decimal point. A value of 0 shall not display
     the decimal point.

I interpreted a zero precision to mean you don't even look at the fractional part when I invented TIMEFORMAT. This goes back to 1996.
Since POSIX took TIMEFORMAT from bash, I didn't see any reason to change.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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