Bug 6005 - Date doesn't show 1 day before if it's about to change timezone
Summary: Date doesn't show 1 day before if it's about to change timezone
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-30 23:12 UTC by Daniel Horecki
Modified: 2014-07-03 11:41 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Horecki 2008-03-30 23:12:54 UTC
Date show time off by 1 hour, if at previous day it's was timezone change. E.g.:

sh@hoth:~/ > date
Mon Mar 31 00:43:49 CEST 2008
sh@hoth:~/ > date -d '1 day ago'
Sat Mar 29 23:43:47 CET 2008
sh@hoth:~/ > date -d '2 hours ago'
Sun Mar 30 22:44:58 CEST 2008
sh@hoth:~/ > date --version
date (GNU coreutils) 6.10

But, if it's past 01:00 day after timezone change, it shows correct time:

sh@hoth:~/ > date
Mon Mar 31 01:35:00 CEST 2008
sh@hoth:~/ > date -d '1 day ago'
Sun Mar 30 00:35:02 CET 2008

I can see in logs that timezone was changed at 2:00 to 3:00. This is glibc-2.7.
Older glibc (2.3.5) and coreutils (5.2.1) doesn't have this bug.
It looks like it internally change date at midnight, not 2:00. It should display
missing hour according to timezone.
Comment 1 Daniel Horecki 2008-03-31 17:50:46 UTC
Past 1:00 it shows incorrect date still, my mistake.
Comment 2 Ulrich Drepper 2008-04-08 00:45:04 UTC
You have to provide a test program using only glibc functions.  I won't hunt
down problems in external programs like date.
Comment 3 Petr Baudis 2010-06-01 03:41:01 UTC
Frankly, I don't even get at all from the original report what the problem was,
the information shown looks correct to me.