Skip Menu |
 

This queue is for tickets about the DateTime-Event-Sunrise CPAN distribution.

Report information
The Basics
Id: 34770
Status: resolved
Priority: 0/
Queue: DateTime-Event-Sunrise

People
Owner: J2N-FORGET [...] orange.fr
Requestors: J2N-FORGET [...] orange.fr
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.0501
Fixed in: 0.0502



Subject: Wrong sunset times around 21st March
Download (untitled) / with headers
text/plain 2.7k
I have tried to print the sunset times for Paris in March. And I noticed a hiccup on March 20, as if the Earth's rotation was chaotic. Then I tried a few other locations and I obtained som weird results. Here are the script and the result. -------------------------- #!/usr/bin/perl -w use strict; #use lib qw/tmp/; use DateTime; use DateTime::Event::Sunrise; coucher( 2.33, 48.83, 1); # Paris coucher(92.33, 48.83, 0); # sun never rises! sub coucher { my ($lon, $lat, $iter) = @_; print "longitude $lon, latitude $lat, iter $iter\n"; my $coucher = DateTime::Event::Sunrise->sunset(longitude => $lon, latitude => $lat, iteration => $iter, ); foreach (17..23) { my $day = DateTime->new(year => 2008, month => 3, day => $_, time_zone => 'UTC', locale => 'fr'); print "$_ March : sunset ", $coucher->next($day)->strftime("%H:%M:%S\n"); } } ---------------------------- longitude 2.33, latitude 48.83, iter 1 17 March : sunset 17:58:02 18 March : sunset 17:59:15 19 March : sunset 17:59:53 20 March : sunset 18:52:15 21 March : sunset 18:06:28 22 March : sunset 18:07:05 23 March : sunset 18:08:18 longitude 92.33, latitude 48.83, iter 0 17 March : sunset 11:56:40 18 March : sunset 11:58:02 19 March : sunset 11:59:15 20 March : sunset 11:59:53 Sun never rises!! at /home/j2n/perl/lib/site_perl/5.8.8/DateTime/Set.pm line 240 21 March : sunset 05:58:07 22 March : sunset 12:06:28 23 March : sunset 12:07:05 -------------------------------- Then, I looked for Paul Schlyter's code. I found that you made a mistake, confusing the variables for the Sun's right ascension and for its distance from Earth. Here is the patch with the bugfix. I had to change the test data in the 01basic.t file. Did you get these data from an external source (almanach, ephemeris, C-wrapper to Schlyter's code)? Or did you simply declare that the values on your system should be equal to the values on anyone else's machine? By the way, I have included also fixes for ticket 7605. Even if it is irrelevant, here is perl -v: Even if it is irrelevant, here is perl -v and uname -a: This is perl, v5.8.8 built for i686-linux Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. Linux localhost.localdomain 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 athlon i386 GNU/Linux
Subject: dt-e-sunrise.patch
Download dt-e-sunrise.patch
text/x-diff 22.7k

Message body is not shown because it is too large.



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.