Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.

X Report information
Id: 45067
Status: resolved
Left: 0 min
Priority: 0/0
Queue: TimeDate

Owner: Nobody
Requestors: emhn [...] usb.ve
Cc:
AdminCc:

Severity: (no value)
Broken in: (no value)
Fixed in: (no value)




X History Display mode: Brief headersFull headers
#   Wed Apr 15 18:00:51 2009 emhn[...]usb.ve - Ticket created  
CC: Graham Barr <gbarr[...]pobox.com>
Subject: Date::Format with %z gives wrong results for half-hour timezones
Date: Wed, 15 Apr 2009 17:30:01 -0430
To: bug-timedate[...]rt.cpan.org
From: Ernesto Hernández-Novich <emhn[...]usb.ve>
[text/plain 1.1k]
Using Date::Format to format a date including the timezone as an offset
(%z) does not work correctly if the offset is not an even number of
hours. I noticed the problem since I run my systems using VET (-4:30)
and several mail Date: headers built with Date::Format broke.

print time2str("%Z %z", $^T, "-0430")

gives

-0430 -041800

instead of

-0430 -0430

The bug is in line 239 of Date/Format.pm in function format_z, and I've
fixed it with

sprintf("%+03d%02d", int($o / 3600), int(abs($o) % 3600) / 60);

It also works for timezones with other weird offsets like

+1245 (Catham Islands)
+0545 (Kathmandu)

and I even tried with things like -0417. Attached a simple test for the bug.

This bus is breaking RequestTracker 3.6 and 3.8 if the system runs on
any timezone that's not a round number of hours.

This bug is also reported in Debian BTS [1].

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524136
--
Prof. Ernesto Hernández-Novich - MYS-220C
Geek by nature, Linux by choice, Debian of course.
If you can't aptitude it, it isn't useful or doesn't exist.
GPG Key Fingerprint = 438C 49A2 A8C7 E7D7 1500 C507 96D6 A3D6 2F4C 85E3


[application/x-perl 529b]
#   Sat Sep 19 12:09:03 2009 GBARR - Status changed from 'new' to 'resolved'