Skip Menu |
 

This queue is for tickets about the FAQ-OMatic CPAN distribution.

Report information
The Basics
Id: 124560
Status: new
Priority: 0/
Queue: FAQ-OMatic

People
Owner: Nobody in particular
Requestors: bitcardbmw [...] lsmod.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.719
Fixed in: (no value)



Subject: timelocal should be called with 4-digit year
Download (untitled) / with headers
text/plain 201b
man Time::Local says Whenever possible, use an absolute four digit year instead. With a detailed explanation about ambiguity of 2-digit years above that. Please review/test/merge the attached patch
Subject: fix.patch
Download fix.patch
text/x-diff 1.5k
Index: FAQ-OMatic-2.721/lib/FAQ/OMatic/Item.pm =================================================================== --- FAQ-OMatic-2.721.orig/lib/FAQ/OMatic/Item.pm +++ FAQ-OMatic-2.721/lib/FAQ/OMatic/Item.pm @@ -349,7 +349,6 @@ sub compactDateToSecs { } $hr = 0 if ($hr == 12); # noon/midnight $hr += 12 if ($ampm eq 'p'); # am/pm - $yr -= 1900; # year is biased in struct require Time::Local; # LastModified: keys were represented in local time, not GMT. Index: FAQ-OMatic-2.721/lib/FAQ/OMatic/Log.pm =================================================================== --- FAQ-OMatic-2.721.orig/lib/FAQ/OMatic/Log.pm +++ FAQ-OMatic-2.721/lib/FAQ/OMatic/Log.pm @@ -42,7 +42,7 @@ sub adddays { my $date = shift; # YYYY-MM-DD my $daydiff = shift; # int my ($year,$mo,$day) = split('-',$date); - my (@localt) = (0,0,9,$day,$mo-1,$year-1900); + my (@localt) = (0,0,9,$day,$mo-1,$year); # I use 9:00 AM because 24 hours before midnight 1997-04-07 is # 11 pm 1997-04-05, which is not what I meant. Darn DST. Watch # out for that. @@ -67,11 +67,11 @@ sub subTwoDays { my $day2 = shift; # YYYY-MM-DD my ($y,$m,$d) = split('-', $day1); - my @localt = (0,0,9,$d,$m-1,$y-1900); + my @localt = (0,0,9,$d,$m-1,$y); my $unixt1 = Time::Local::timelocal(@localt); my ($y2,$m2,$d2) = split('-', $day2); - my @localt2 = (0,0,9,$d2,$m2-1,$y2-1900); + my @localt2 = (0,0,9,$d2,$m2-1,$y2); my $unixt2 = Time::Local::timelocal(@localt2); return round(($unixt1 - $unixt2)/86400);


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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