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 13:07:51 -0400
User-agent: Mozilla Thunderbird

On 10/14/25 10:19 PM, Grisha Levit wrote:
When rounding up the fractional portion of the printed value, increment
the seconds portion if necessary (instead of printing ':', i.e. '0'+10).

Thanks for the report.
Also, I'm assuming it was not intentional that values with a precision
of 0 were being truncated while all other precisions were rounded (but
maybe it was?).

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).

--
``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]