bug-coreutils
[Top][All Lists]
Advanced

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

Re: bug in date (coreutils-6.12)


From: Bob Proulx
Subject: Re: bug in date (coreutils-6.12)
Date: Thu, 4 Sep 2008 23:03:20 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

David Chin wrote:
> Eli Rykoff <address@hidden> told me about this, and I verified with
> coreutils-6.12 compiled with gcc-4.3.0 on Fedora Core 9.
> coreutils-6.10 which comes with Fedora Core 9 also has this bug.

Thank you for your report.  However I do not see any bug here.

> To reproduce, do this:
>      date -d "2006-04-02 02:30:00"

You didn't say but I assume you are seeing this following output and
are confused by it?  This is the expected output in a US timezone.

  date: invalid date `2006-04-02 02:30:00'

First, you didn't specify a timezone.  My timezone is US/Mountain and
that is an invalid date in my timezone.  Let me assume that you are
using a US timezone.  If you check your calender you will find that
daylight savings changed on that date and there wasn't a 2:30 on that
day.  Because Using zdump to output the timezone data is helpful here.

  $ zdump -v US/Mountain | grep 2006
  US/Mountain  Sun Apr  2 08:59:59 2006 UTC = Sun Apr  2 01:59:59 2006 MST 
isdst=0 gmtoff=-25200
  US/Mountain  Sun Apr  2 09:00:00 2006 UTC = Sun Apr  2 03:00:00 2006 MDT 
isdst=1 gmtoff=-21600
  US/Mountain  Sun Oct 29 07:59:59 2006 UTC = Sun Oct 29 01:59:59 2006 MDT 
isdst=1 gmtoff=-21600
  US/Mountain  Sun Oct 29 08:00:00 2006 UTC = Sun Oct 29 01:00:00 2006 MST 
isdst=0 gmtoff=-25200

This shows that on my system MDT begins on Apr 2 03:00:00 2006 MDT
with the last second before being Apr 2 01:59:59 2006 MST and
therefore "2006-04-02 02:30:00" cannot be a valid time in the US.  It
may be a valid time elsewhere in another timezone.  (I should have
asked how such a date string was generated in the first place given
that it is an invalid string.)

Of course there is no trouble at all in the UTC timezone.

  $ date -u -d "2006-04-02 02:30:00 UTC"
  Sun Apr  2 02:30:00 UTC 2006

> As a comparison, do this:
>     date -d "2006-04-01 02:30:00"

Sure.  That was the day before and that day *did* have a 2:30am MST.
And the day after would be okay too.

Now you know why UTC has so much going for it and why I am not a fan
of DST.  :-)

And a fun time was had by all with time, dates and calendars.  :-)

Hope that helps,
Bob




reply via email to

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