GNU bug report logs -
#8372
date - Summer Time Shift Problem.
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8372 in the body.
You can then email your comments to 8372 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8372
; Package
coreutils
.
(Tue, 29 Mar 2011 08:16:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Reicher, Igor, VF-DE" <igor.reicher <at> vodafone.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Tue, 29 Mar 2011 08:16:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
I have some stuff to repert. See below.
~> date --version
date (GNU coreutils) 5.3.0
Geschrieben von David MacKenzie.
~> date
20110329
~> date "+%Y%m%d" -d "20110329 1 days ago "
20110328
~> date "+%Y%m%d" -d "20110328 0 days ago "
20110328
~> date "+%Y%m%d" -d "20110328 1 days ago "
20110326
~> date "+%Y%m%d" -d "20110328 2 days ago "
20110325
Best Regards
Igor Reicher
[Message part 2 (text/html, inline)]
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8372
; Package
coreutils
.
(Tue, 29 Mar 2011 16:30:03 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
On Tue, Mar 29, 2011 at 10:05:28AM +0200, Reicher, Igor, VF-DE wrote:
> Hello,
>
> I have some stuff to repert. See below.
>
> ~> date --version
> date (GNU coreutils) 5.3.0
> Geschrieben von David MacKenzie.
>
> ~> date
> 20110329
>
> ~> date "+%Y%m%d" -d "20110329 1 days ago "
> 20110328
>
> ~> date "+%Y%m%d" -d "20110328 0 days ago "
> 20110328
>
> ~> date "+%Y%m%d" -d "20110328 1 days ago "
> 20110326
>
> ~> date "+%Y%m%d" -d "20110328 2 days ago "
> 20110325
>
>
> Best Regards
> Igor Reicher
What if you tries "20110329 12:00 n days ago"?
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8372
; Package
coreutils
.
(Tue, 29 Mar 2011 19:03:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
On Tuesday 29 March 2011, Etienne Buira wrote:
> > ~> date --version
> > date (GNU coreutils) 5.3.0
Your version is from 2004 or something. What about updating it?
cu,
Rudi
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8372
; Package
coreutils
.
(Tue, 29 Mar 2011 20:26:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 8372 <at> debbugs.gnu.org (full text, mbox):
tags 8372 + moreinfo notabug
thanks
Reicher, Igor, VF-DE wrote:
> ~> date
> 20110329
>
> ~> date "+%Y%m%d" -d "20110329 1 days ago "
> 20110328
>
> ~> date "+%Y%m%d" -d "20110328 0 days ago "
> 20110328
>
> ~> date "+%Y%m%d" -d "20110328 1 days ago "
> 20110326
>
> ~> date "+%Y%m%d" -d "20110328 2 days ago "
> 20110325
Thank you for your report but this doesn't read like a bug in date but
instead a misunderstanding of how relative times and DST interact.
You didn't say what timezone you are using but that is a critical
piece of information that is needed to know what is happening. Some
timezones changed from standard time to Daylight Saving Time over the
time interval you are specifying. Until you say otherwise I will
assume Europe/Helsinki for the purpose of discussion and since this
was just discussed recently and I have the data ready to post.
First, let's understand when the time changes.
$ zdump -v Europe/Helsinki | grep 2011
Europe/Helsinki Sun Mar 27 00:59:59 2011 UTC = Sun Mar 27 02:59:59 2011 EET isdst=0 gmtoff=7200
Europe/Helsinki Sun Mar 27 01:00:00 2011 UTC = Sun Mar 27 04:00:00 2011 EEST isdst=1 gmtoff=10800
Europe/Helsinki Sun Oct 30 00:59:59 2011 UTC = Sun Oct 30 03:59:59 2011 EEST isdst=1 gmtoff=10800
Europe/Helsinki Sun Oct 30 01:00:00 2011 UTC = Sun Oct 30 03:00:00 2011 EET isdst=0 gmtoff=7200
Sun Mar 27 02:59:59 2011 EET was the last second in EET and Sun Mar 27
04:00:00 2011 EEST was the very next second in your timezone. There
is no 03:00:00 through 03:59:59. The time skips (by law and politics)
directly to 04:00:00 in that timezone. The day is defined to be one
hour shorter that day.
The documentation for date says:
The unit of time displacement may be selected by the string `year'
or `month' for moving by whole years or months. These are fuzzy units,
as years and months are not all of equal duration. More precise units
are `fortnight' which is worth 14 days, `week' worth 7 days, `day'
worth 24 hours, `hour' worth 60 minutes, `minute' or `min' worth 60
seconds, and `second' or `sec' worth one second. An `s' suffix on
these units is accepted and ignored.
The string `tomorrow' is worth one day in the future (equivalent to
`day'), the string `yesterday' is worth one day in the past (equivalent
to `day ago').
So 'yesterday' or '24 hours ago' are equivalent. These are exactly 24
hours ago or 86400 seconds. This is a critical point in your problem.
$ TZ=Europe/Helsinki date -d 20110329
Tue Mar 29 00:00:00 EEST 2011
$ TZ=Europe/Helsinki date -d '20110329 24 hours ago'
Mon Mar 28 00:00:00 EEST 2011
$ TZ=Europe/Helsinki date -d '20110329 48 hours ago'
Sat Mar 26 23:00:00 EET 2011
This recreates the same results you posted. The reasoning is a little
more obvious if I list out the hours explicitly.
Mon Mar 28 00:00:00 EEST 2011 -0 hours
Sun Mar 27 23:00:00 EEST 2011 -1 hours
Sun Mar 27 22:00:00 EEST 2011 -2 hours
Sun Mar 27 21:00:00 EEST 2011 -3 hours
Sun Mar 27 20:00:00 EEST 2011 -4 hours
Sun Mar 27 19:00:00 EEST 2011 -5 hours
Sun Mar 27 18:00:00 EEST 2011 -6 hours
Sun Mar 27 17:00:00 EEST 2011 -7 hours
Sun Mar 27 16:00:00 EEST 2011 -8 hours
Sun Mar 27 15:00:00 EEST 2011 -9 hours
Sun Mar 27 14:00:00 EEST 2011 -10 hours
Sun Mar 27 13:00:00 EEST 2011 -11 hours
Sun Mar 27 12:00:00 EEST 2011 -12 hours
Sun Mar 27 11:00:00 EEST 2011 -13 hours
Sun Mar 27 10:00:00 EEST 2011 -14 hours
Sun Mar 27 09:00:00 EEST 2011 -15 hours
Sun Mar 27 08:00:00 EEST 2011 -16 hours
Sun Mar 27 07:00:00 EEST 2011 -17 hours
Sun Mar 27 06:00:00 EEST 2011 -18 hours
Sun Mar 27 05:00:00 EEST 2011 -19 hours
Sun Mar 27 04:00:00 EEST 2011 -20 hours <-- just after change
Sun Mar 27 02:00:00 EET 2011 -21 hours <-- just before change
Sun Mar 27 01:00:00 EET 2011 -22 hours
Sun Mar 27 00:00:00 EET 2011 -23 hours
Sat Mar 26 23:00:00 EET 2011 -24 hours
Observe that there is no 03:00:00-03:59:59 and March 27 is only 23
hours long that day. It is shorter than 24 hours. Using a 24 hour
calculation near midnight skips over that day completely.
With this table it should be obvious that date is behaving correctly
and the day that is shorter than 24 hours due to the conversion to DST
has caused -24 hours to skip completely over it.
Please see this FAQ entry for detailed explanation and hints on how to
avoid this problem.
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
Instead of doing calculations around DST I suggest using calculations
around noon. I am not aware of any location that changes DST at noon
which makes it a much safer time to do date calculations. The FAQ
entry provides examples. Or if possible use UTC which also avoids the
problem by never switching to DST.
Bob
Added tag(s) notabug and moreinfo.
Request was from
Bob Proulx <bob <at> proulx.com>
to
control <at> debbugs.gnu.org
.
(Tue, 29 Mar 2011 20:26:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Bob Proulx <bob <at> proulx.com>
:
You have taken responsibility.
(Thu, 28 Jul 2011 21:44:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Reicher, Igor, VF-DE" <igor.reicher <at> vodafone.com>
:
bug acknowledged by developer.
(Thu, 28 Jul 2011 21:44:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 8372-done <at> debbugs.gnu.org (full text, mbox):
Bob Proulx wrote:
> Please see this FAQ entry for detailed explanation and hints on how to
> avoid this problem.
>
> http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
Since there hasn't been any feedback on this bug since March I assume
that the answers provided successfully resolved the problem. Therefore
I am closing this bug report ticket. If not please feel free to
reopen it with additional information.
Bob
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 26 Aug 2011 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 302 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.