GNU bug report logs -
#40586
date and '%-N' does not appear to remove leading zeros anymore, but trailing zeros.
Previous Next
To reply to this bug, email your comments to 40586 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#40586
; Package
coreutils
.
(Sun, 12 Apr 2020 22:08:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drake Jacovian <gnu.org <at> infernalbeast.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Sun, 12 Apr 2020 22:08:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Using...
date (GNU coreutils) 8.32
uname -a
Linux server 4.19.114-1-MANJARO #1 SMP Thu Apr 2 17:04:36 UTC 2020
x86_64 GNU/Linux
I have noticed that %-N when used with the data command no longer
appears to always remove leading zeros, instead it appears to be
removing trailing zeros? Obviously, removing trailing zeroes will
changes it value.
From the date manual '(hyphen) do not pad the field'
As an example of this...
for i in {1..100}; do date +'%-N'; sleep 0.01; done
...can return the following values.
975014256
98960514
004239247
018627712
032860182
047079472
061412362
075671305
090001272
104960757
119612273
134225597
148815084
163728277
17841512
19301887
207621036
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#40586
; Package
coreutils
.
(Sun, 12 Apr 2020 23:16:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 40586 <at> debbugs.gnu.org (full text, mbox):
On 4/12/20 1:51 PM, Drake Jacovian wrote:
> Obviously, removing trailing zeroes will changes it value.
%-N is intended to be used after a decimal point, so removing trailing zeros
does not change its value in its intended use.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#40586
; Package
coreutils
.
(Thu, 14 Apr 2022 16:51:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 40586 <at> debbugs.gnu.org (full text, mbox):
> %-N is intended to be used after a decimal point...
Please note this intention in the man-page. The current man-page:
%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.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#40586
; Package
coreutils
.
(Thu, 14 Apr 2022 22:11:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 40586 <at> debbugs.gnu.org (full text, mbox):
On 4/14/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.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#40586
; Package
coreutils
.
(Fri, 15 Apr 2022 14:28:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 40586 <at> debbugs.gnu.org (full text, mbox):
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 2 years and 204 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.