[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7223: DATE 8.5 and back -- Invalid date with specific dates
From: |
Eric Blake |
Subject: |
bug#7223: DATE 8.5 and back -- Invalid date with specific dates |
Date: |
Fri, 15 Oct 2010 16:46:25 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4 |
On 10/15/2010 02:53 PM, Lucien Raven wrote:
This problem was reproduced in several versions of 'date', and the oldest one I
could reproduce the problem was 6.10.
But it doesn´t happen in older ones (tried on 'date' 5.97)
Thanks for the report. However, this is intentional.
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
PS: The dates correspond to the third Sunday of October.
Which is where daylight savings rules come into effect, as mentioned in
the FAQ. Depending on the hour of the day in which you run your command
(since you didn't pin an exact hour in the date you were writing), you
may have very well handed date an invalid time, in the one-hour window
where the clocks jump around.
And reading the NEWS file:
* Major changes in release 6.0 (2006-08-15) [unstable]
...
date: a command like date -d '2006-04-23 21 days ago' would print
the wrong date in some time zones. (see the test for an example)
you did indeed isolate some changes where date learned to better respect
invalid times due to daylight savings, but where older coreutils didn't
complain about your usage.
Meanwhile, you can resolve your issue by pinning the timezone and/or the
hour to something other than the default of your timezone settings:
$ date +%Y --date='20101017 +Z'
2010
$ date +%Y --date='20101017 12:00'
2010
(By the way, what timezone are you in? I could not reproduce failure in
my timezone:
$ TZ=America/Denver date +%Y --date='20101017'
2010
)
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org