[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a bug in date concerning daylight saving time
From: |
John Cowan |
Subject: |
Re: a bug in date concerning daylight saving time |
Date: |
Fri, 28 Sep 2007 18:04:46 -0400 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Lao DanTong scripsit:
> I found what is likely to be a bug in date. It does not recognise as valid
> the date when clock jumps one hour due to DST. here in Brazil we use this
> rule:
>
> Rule Brazil 2007 max - Oct Sun>=8 0:00 1:00 S
> Rule Brazil 2008 max - Feb Sun>=15 0:00 0 -
>
> so DST will start next October, 14. date says that --date=2007-10-14 is
> not a valid date:
>
> $ ./date --version
> date (GNU coreutils) 6.9
> ...
> $ ./date --date=2007-10-14
> ./date: invalid date `2007-10-14'
That looks exactly right to me. 2007-10-14 means 2007-10-14T00:00:00, but
that second does not exist in any timezone observing the "Brazil" rules:
time jumps directly from 2007-10-13T23:59:59 to 2007-10-14T01:00:00.
Internal evidence shows that the timezone in your examples is
America/Sao_Paulo, but this rule set also applies to America/Campo_Grande
and America/Cuiaba, the only other two Brazilian time zones currently
observing DST.
Maybe you want to argue that dates without times should mean the first
second of the day rather than 00:00:00.
> but no problem if time is in UTC:
>
> $ ./date --date=2007-10-14 -u
> Sun Oct 14 00:00:00 UTC 2007
Naturally, since 2007-10-14T00:00:00 of course exists in UTC.
--
On the Semantic Web, it's too hard to prove John Cowan address@hidden
you're not a dog. --Bill de hOra http://www.ccil.org/~cowan