GNU bug report logs - #20523
GNU coreutils 8.4 date: wrong day shift calculation at the spring daylight savings time cutover

Previous Next

Package: coreutils;

Reported by: Markus Baur <mbaur <at> shutterfly.com>

Date: Thu, 7 May 2015 01:34:02 UTC

Severity: normal

Tags: notabug

Merged with 11098, 11101, 11125, 15785, 18159, 18479

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Markus Baur <mbaur <at> shutterfly.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: 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
[Message part 1 (text/plain, inline)]
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 <at> 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 <at> 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 <at> 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

[Message part 2 (text/html, inline)]

This bug report was last modified 6 years and 211 days ago.

Previous Next


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