Miyagawa-kun,
G'morning.
On Monday, April 8, 2002, at 07:44 , Tatsuhiko Miyagawa wrote:
> libwww-perl-5.64 date test passes with 5.7.2 or earlier, but fails
> with bleedperl. Here's a snippet of the code and its output.
^^^^^^^^^y'mean "bread" here.
Or is this a feminine perl which turns $0 into this every few
days a month :-?
> This is due to that Time::Local::localtime() uses 'integer' in the
> calculation, thus breaks floating point seconds into
> integer. Simplified test script as follows:
>
> use Time::Local;
> use Test::More 'no_plan';
>
> my $t = timelocal('01.234', 0, 0, 1, 1, 99);
> is $t, 917794801.234;
I've modified your test to be compatible with older perl and got these.
use strict;
use Test;
BEGIN{ plan tests => 1 };
use Time::Local;
my $expected = 917794801.234;
my $t = timelocal(1.234, 0, 0, 1, 1, 99);
ok($t, $expected) or warn "$t != $expected";
__END__
> perl5.00503 ./miyagawa.t
1..1
ok 1
> perl5.6.1 ./miyagawa.t
1..1
ok 1
> perl5.7.3 ./miyagawa.t
1..1
not ok 1
# Test 1 got: '917794801' (./miyagawa.t at line 8)
# Expected: '917794801.234'
917794801 != 917794801.234 at ./miyagawa.t line 8.
Yep. Time::Local needs a fix. Let me have a look at lib/Time/Local.pm
while jhi is sound asleep.
Dan the Floating Man