forcemerge 18159 20523
stop

previously discussed at: http://bugs.gnu.org/18159

On 07/05/15 01:52, Markus Baur wrote:
> On one of my production systems I do daily database dumps between midnight 
> and 1am every day. I noticed on March 9th this year is was dumping the wrong 
> day. Digging further into this I found the shell wrapper script to be at 
> fault and specifically the GNU date program. Here is a simplified version to 
> reproduce the bug:
> 
> script:
> 
> #!/bin/sh
> 
> echo NOW is `date`
> echo TODAY is `date +%Y%m%d`
> echo YESTERDAY is `date -d 'yesterday' +%Y%m%d`
> echo 30 DAYS AGO is `date -d '30 days ago' +%Y%m%d`
> 
> 
> output:
> 
> root@yoyo-01-64-lv$ date 03090059; ./yesterday.sh 
> Mon Mar  9 00:59:00 PDT 2015
> NOW is Mon Mar 9 00:59:00 PDT 2015
> TODAY is 20150309
> YESTERDAY is 20150307
> 30 DAYS AGO is 20150206
> 
> root@yoyo-01-64-lv$ date 03090100; ./yesterday.sh 
> Mon Mar  9 01:00:00 PDT 2015
> NOW is Mon Mar 9 01:00:00 PDT 2015
> TODAY is 20150309
> YESTERDAY is 20150308
> 30 DAYS AGO is 20150207
> 
> GNU date version info:
> 
> root@yoyo-01-64-lv$ date --version
> date (GNU coreutils) 8.4
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> As you can see, the “yesterday” as well as the “30 days ago” calculation are 
> one day off at 00:59, but correct a minute later.
> 
> Cheers,
> Markus
> 




Reply via email to