develooper Front page | perl.perl5.porters | Postings from March 2006

New Time::Local failure

Thread Next
From:
Rafael Garcia-Suarez
Date:
March 23, 2006 04:39
Subject:
New Time::Local failure
Message ID:
20060323133918.004b36da@grubert.mandriva.com
I just upgraded bleadperl to Time::Local 1.12.

However, due to this chunk :

@@ -159,9 +162,7 @@
     local ($Min{Day}, $Min{Sec}) = _zoneadjust($Min{Day}, $Min{Sec}, $MinInt);
     my $ref_t = &timegm;

-    # Calculate first guess with a one-day delta to avoid localtime overflow
-    my $delta = ($_[5] < 100)? 86400 : -86400;
-    my $loc_t = _timegm(localtime( $ref_t + $delta )) - $delta;
+    my $loc_t = _timegm(localtime($ref_t));

     # Is there a timezone offset from GMT or are we done
     my $zone_off = $ref_t - $loc_t
End

one test fails now for me :

[rafael@grubert t]$ ./perl harness ../lib/Time/Local.t 
../lib/Time/Local....NOK 133# Test 133 got: "80000bde" (../lib/Time/Local.t at line 167)
#     Expected: "7fffffff" (0x7fffffff round trip through localtime then timelocal)
#  ../lib/Time/Local.t line 167 is:     ok(sprintf('%x', timelocal(localtime(0x7fffffff))), sprintf('%x', 0x7fffffff),
../lib/Time/Local....FAILED test 133                                         
        Failed 1/135 tests, 99.26% okay
Failed Test         Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
../lib/Time/Local.t              135    1   0.74%  133
Failed 1/1 test scripts, 0.00% okay. 1/135 subtests failed, 99.26% okay.

(Note that the T::L tests also fail for me with 5.8.8.)
I vaguely remember a thread about it. So I wonder what to
do about this reversion -- should I re-revert it ? Probably
a more robust solution is needed. The Changes file notes about
this :

- Reverted an earlier change that slightly extended the range of
values for which timelocal worked (by about a day in either direction)
because it could cause an incorrect answer for certain epoch values on
the date of a DST change.  Reported by Gisle Aas.

-- 
Hey, I did blah blah blah blah 1000 packages blah blah blah
LD_ASSUME_KERNEL blah blah blah blah hang blah blah blah rpm bug.
Here's my /var/lib/rpm database, it's only 100 Mb. Fix the rpm bug now!
    -- Jeff Johnson in rpm-devel

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About