GNU bug report logs - #40586
date and '%-N' does not appear to remove leading zeros anymore, but trailing zeros.

Previous Next

Package: coreutils;

Reported by: Drake Jacovian <gnu.org <at> infernalbeast.com>

Date: Sun, 12 Apr 2020 22:08:02 UTC

Severity: normal

Full log


Message #17 received at 40586 <at> debbugs.gnu.org (full text, mbox):

From: joerg.boehmer <at> snafu.de
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 40586 <at> debbugs.gnu.org
Subject: Re: bug#40586: date and '%-N' does not appear to remove leading zeros
 anymore, but trailing zeros.
Date: Fri, 15 Apr 2022 16:27:39 +0200
Am 15.04.2022 00:10, schrieb Paul Eggert:
> On 4/1hour...4/22 09:48, joerg.boehmer <at> snafu.de wrote:
> 
>> %N     nanoseconds (000000000..999999999)
>> 
>> The current description gives the impression that nanoseconds are an 
>> integral quantity like seconds and minutes. This leads the user to 
>> assume that leading zeros are being removed.
> 
> Similar wording is used elsewhere:
> 
>   %M   minute (00..59)
>   %m   month (01..12)
>   %H   hour (00..23)
>   %W   week number of year, with Monday as first day of week (00..53)
> 
> It's true that nanoseconds are more complicated than the others.
> However, it's not clear whether all the little details need to be in
> the man page, or how to summarize those details concisely.

The problem is imo the naming: second, minute, hour ... are all integral 
values counting from 0 to some max. value. Thus everybody expects that 
zeros are padded to the left side.
But %N is now considered the fractional part of the second in 
nanoseconds granularity or the positions after decimal point. Thus 
everybody can assume that the padding is applied to the right.
I think it's very important that the user quickly grasps the meaning of 
the formats from the man page to avoid frustration.




This bug report was last modified 3 years and 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.