Subject: | Infinite loop on March 21th 2010 |
For certain long, lat and altitudes DateTime-Event-Sunrise enters an
infinite loop while trying to figure out the time of sunset.
Example code that trigs the bug:
#!/usr/bin/perl
use DateTime;
use DateTime::Event::Sunrise;
my $dt = DateTime->new( year => 2010,
month => 3,
day => 21,
);
my $sunset = DateTime::Event::Sunrise ->sunset (
longitude =>'15.1429',
latitude =>'59.1312',
altitude => '-0.833',
iteration => '1'
);
my $tmp_rise = $sunset->next( $dt );
Results in an infinite loop (100% CPU on my and others machines)
outputting:
Sun never sets!!
at /usr/share/perl5/DateTime/Set.pm line 240
Sun never sets!!
at /usr/share/perl5/DateTime/Set.pm line 240
Sun never sets!!
at /usr/share/perl5/DateTime/Set.pm line 240
The patch included in the bug report #34770 from Jean Forget solves the
problem. https://rt.cpan.org/Public/Bug/Display.html?id=34770