Package: libtimedate-perl
Version: 1.1600-9
Severity: important
Tags: patch

Using Date::Format to format a date including the timezone as an
offset (%z) does not work correctly if the offset is 30 minutes.
I noticed the problem since I need VET (-4:30) and several mail
headers started to be very wrong.

A simple test shows

#!/usr/bin/perl 
use Date::Format;
print time2str("%Y-%m-%d %T %Z %z", $^T, "+0400")."\n";
print time2str("%Y-%m-%d %T %Z %z", $^T, "+0430")."\n";
print time2str("%Y-%m-%d %T %Z %z", $^T, "+0000")."\n";
print time2str("%Y-%m-%d %T %Z %z", $^T, "-0400")."\n";
print time2str("%Y-%m-%d %T %Z %z", $^T, "-0430")."\n";

$ perl ~/z.pl
2009-04-15 06:58:32 +0400 +0400
2009-04-15 07:28:32 +0430 +041800
2009-04-15 02:58:32 +0000 +0000
2009-04-14 22:58:32 -0400 -0400
2009-04-14 22:28:32 -0430 -041800

The problem is in function format_z in /usr/share/perl5/Date/Format.pm
line 239. I've replaced it with

sprintf("%+05d", int($o/3600)*100 + ($o-int($o/3600)*3600)/60 );

and it seems to work out ok.

Needless to say, any piece of software depending on Date::Format's %z
being run under timezone having a half-hour offset will break. In my case,
this breaks e-mail headings sent from Request Tracker.

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.28.9-1-core2 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libtimedate-perl depends on:
ii  perl                          5.10.0-19  Larry Wall's Practical Extraction 

libtimedate-perl recommends no packages.

libtimedate-perl suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to