bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20523: GNU coreutils 8.4 date: wrong day shift calculation at the sp


From: Markus Baur
Subject: bug#20523: GNU coreutils 8.4 date: wrong day shift calculation at the spring daylight savings time cutover
Date: Thu, 7 May 2015 00:52:12 +0000

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:

address@hidden 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

address@hidden 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:

address@hidden 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

[Prev in Thread] Current Thread [Next in Thread]