[Top][All Lists]

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

a bug in date concerning daylight saving time

From: Lao DanTong
Subject: a bug in date concerning daylight saving time
Date: Fri, 28 Sep 2007 17:09:32 -0300 (BRT)

Dear maintainers of coreutils,

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'

but no problem if time is in UTC:

$ ./date --date=2007-10-14 -u
Sun Oct 14 00:00:00 UTC 2007

taking an older version of date (the one on board slackware 10):

$ date --date=2007-10-14
Sun Oct 14 01:00:00 BRST 2007

it works as expected.

It looks like that some code introduced in date to prevent it from accepting wrong dates like 2007-02-31, broke it in the transition to DST.

date from coreutils 6.9:

$ ./date --date=2007-02-31
./date: invalid date `2007-02-31'

date from slackware-10:

$ date --date=2007-02-31
Sat Mar  3 00:00:00 BRT 2007

which is, by the way, a very consistent result!

May I suggest you to rollback to the way dates were treated as in the slackware-10 version, coreutils 5.2. I'll try to patch lib/getdate.c but I'm afraid I have neither time nor skills enough for the task.

Danton Nunes      |Informática, Consultoria e Serviços de Acesso à Internet
InterNexo Ltda.   |http://www.inexo.com.br/ e-mail:address@hidden
S.J.Campos,BRASIL |  PGP: 02 D1 E2 DF 21 EC 48 69 3F D5 4D 1B 5D 73 F4 B5

reply via email to

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