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

2020-04-12 Thread Paul Eggert

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.






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

2020-04-12 Thread Drake Jacovian

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