On Tue, 15 Jan 2008, [EMAIL PROTECTED] wrote:

I believe I have identified a bug in the GNU coreutils "date" utility when handling the PDT timezone.

I'm running Fedora 8 kernel 2.6.23.9-85.fc8, and the command "date - -version" reports: date (GNU coreutils) 6.9
[snip]

$ date -d"Tue Jan 14 08:25:26 PDT 2008" +%s
date: invalid date `Tue Jan 14 08:25:26 PDT 2008'

Note that EST, EDT and PST work fine, however, PDT is listed as invalid.

Odd, this seems to depend on your current timezone setting:

$ export TZ=UTC
$ date -d"Tue Jan 14 08:25:26 PDT 2008" +%s
1200324326

$ export TZ=America/Los_Angeles
$ date -d"Tue Jan 14 08:25:26 PDT 2008" +%s
date: invalid date `Tue Jan 14 08:25:26 PDT 2008'

or put more simply:

$ TZ=America/Los_Angeles date -d '12:00 PDT'
date: invalid date `12:00 PDT'

This report can be generalised to "using the time_zone_table entry corresponding to the local DST state *not* currently in effect gives an error".

A few more examples (which depend on today's date):

$ TZ=Europe/London date -d '12:00 BST'
date: invalid date `12:00 BST'

TZ=America/Chicago date -d '12:00 CDT'
date: invalid date `12:00 CDT'

TZ=America/New_York date -d '12:00 PDT'
Tue Jan 15 14:00:00 EST 2008

TZ=Pacific/Auckland date -d '12:00 NZST'
date: invalid date `12:00 NZST'

Although the coreutils documentation cautions about using ambiguous timezone labels like this, I don't see any mention of (or reason for) the error message you've found.


Cheers,
Phil


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to