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

Report information
The Basics
Id:
34770
Status:
resolved
Priority:
Low/Low

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

BugTracker
Severity:
Important
Broken in:
0.0501
Fixed in:
0.0502



Subject: Wrong sunset times around 21st March
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
diff -r -u -N DateTime-Event-Sunrise-0.0501/Changes DateTime-Event-Sunrise-0.0502/Changes --- DateTime-Event-Sunrise-0.0501/Changes 2004-03-31 17:02:26.000000000 +0200 +++ DateTime-Event-Sunrise-0.0502/Changes 2008-04-08 21:25:58.000000000 +0200 @@ -1,4 +1,10 @@ Revision history for Perl extension DateTime::Event::Sunrise. + +0.0502 + - fixed computation error visible on 20, 21 and 22 March + - improve object class check (ticket 7605) + - a few words about polar night and midnight sun + 0.0501 Wed Mar 31 2004 - added fix for DateTime-Set after 0.1402 - I had to remove one test (the span set test) I need to check diff -r -u -N DateTime-Event-Sunrise-0.0501/lib/DateTime/Event/Sunrise.pm DateTime-Event-Sunrise-0.0502/lib/DateTime/Event/Sunrise.pm --- DateTime-Event-Sunrise-0.0501/lib/DateTime/Event/Sunrise.pm 2004-03-31 17:18:45.000000000 +0200 +++ DateTime-Event-Sunrise-0.0502/lib/DateTime/Event/Sunrise.pm 2008-04-08 21:28:57.000000000 +0200 @@ -11,7 +11,7 @@ use Set::Infinite qw(inf $inf); use vars qw( $VERSION $RADEG $DEGRAD @ISA ); @ISA = qw( Exporter ); -$VERSION = '0.0501'; +$VERSION = '0.0502'; $RADEG = ( 180 / pi ); $DEGRAD = ( pi / 180 ); my $INV360 = ( 1.0 / 360.0 ); @@ -126,7 +126,7 @@ my $dt = shift; my $class = ref($dt); - if ( $class ne 'DateTime' ) { + if ( ! $dt->isa('DateTime') ) { croak("Dates need to be DateTime objects"); } my ( undef, $tmp_set ) = _sunrise( $self, $dt ); @@ -158,7 +158,7 @@ my $dt = shift; my $class = ref($dt); - if ( $class ne 'DateTime' ) { + if ( ! $dt->isa('DateTime') ) { croak("Dates need to be DateTime objects"); } my ( $tmp_rise, undef ) = _sunrise( $self, $dt ); @@ -190,7 +190,7 @@ my $dt = shift; my $class = ref($dt); - if ( $class ne 'DateTime' ) { + if ( ! $dt->isa('DateTime') ) { croak("Dates need to be DateTime objects"); } my ( $tmp_rise, $tmp_set ) = _sunrise( $self, $dt ); @@ -494,18 +494,25 @@ my ( $d, $lon, $lat, $altit, $h ) = @_; + # Compute local sidereal time of this moment my $sidtime = revolution( GMST0($d) + 180.0 + $lon ); - my ( $sRA, $sdec ) = sun_RA_dec($d); + # Compute Sun's RA + Decl + distance at this moment + my ( $sRA, $sdec, $sr ) = sun_RA_dec($d); + + # Compute time when Sun is at south - in hours UT my $tsouth = 12.0 - rev180( $sidtime - $sRA ) / $h; - my $sradius = 0.2666 / $sRA; + # Compute the Sun's apparent radius, degrees + my $sradius = 0.2666 / $sr; + + # Do correction to upper limb, if necessary if ($upper_limb) { $altit -= $sradius; } # Compute the diurnal arc that the Sun traverses to reach - # the specified altitude altit: + # the specified altitude altit: my $cost = ( sind($altit) - sind($lat) * sind($sdec) ) / @@ -639,7 +646,7 @@ # # _RETURN # - # Sun's Right Ascension (RA) and Declination (dec) + # Sun's Right Ascension (RA), Declination (dec) and distance (r) # # my ($d) = @_; @@ -662,7 +669,7 @@ my $RA = atan2d( $y, $x ); my $dec = atan2d( $z, sqrt( $x * $x + $y * $y ) ); - return ( $RA, $dec ); + return ( $RA, $dec, $r ); } # sun_RA_dec @@ -1021,6 +1028,13 @@ =back +=head3 Notes on polar locations + +If the location is beyond either polar circle, and if the date is +near either solstice, there can be midnight sun or polar night. +In this case, there is neither sunrise nor sunset, and +the module C<carp>s that the sun never rises or never sets. + =head2 next current previous contains as_list iterator See DateTime::Set. @@ -1107,6 +1121,8 @@ DateTime::SpanSet documentation +Paul Shlyter's homepage at http://stjarnhimlen.se/english.html + =cut 1; diff -r -u -N DateTime-Event-Sunrise-0.0501/MANIFEST DateTime-Event-Sunrise-0.0502/MANIFEST --- DateTime-Event-Sunrise-0.0501/MANIFEST 2004-03-31 17:03:21.000000000 +0200 +++ DateTime-Event-Sunrise-0.0502/MANIFEST 2008-03-31 22:10:48.000000000 +0200 @@ -5,4 +5,5 @@ lib/DateTime/Event/Sunrise.pm t/00load.t t/01basic.t +t/02March21.t META.yml Module meta-data (added by MakeMaker) diff -r -u -N DateTime-Event-Sunrise-0.0501/META.yml DateTime-Event-Sunrise-0.0502/META.yml --- DateTime-Event-Sunrise-0.0501/META.yml 2004-03-31 17:22:10.000000000 +0200 +++ DateTime-Event-Sunrise-0.0502/META.yml 2008-03-28 16:43:13.000000000 +0100 @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: DateTime-Event-Sunrise -version: 0.0501 +version: 0.0502 version_from: lib/DateTime/Event/Sunrise.pm installdirs: site requires: diff -r -u -N DateTime-Event-Sunrise-0.0501/t/01basic.t DateTime-Event-Sunrise-0.0502/t/01basic.t --- DateTime-Event-Sunrise-0.0501/t/01basic.t 2004-03-31 16:56:20.000000000 +0200 +++ DateTime-Event-Sunrise-0.0502/t/01basic.t 2008-03-28 16:42:19.000000000 +0100 @@ -34,23 +34,23 @@ my $tmp_rise = $sunrise->current($dt); my $tmp_set = $sunset->current($dt); -is ($tmp_rise->datetime, '2000-06-19T05:43:21', 'current sunrise'); -is ($tmp_set->datetime, '2000-06-19T20:03:08', 'current sunset'); +is ($tmp_rise->datetime, '2000-06-19T05:41:56', 'current sunrise'); +is ($tmp_set->datetime, '2000-06-19T20:04:33', 'current sunset'); is ( $sunrise->current( $tmp_rise )->set_time_zone( 'America/Los_Angeles' )->datetime, - '2000-06-19T05:43:21', 'current sunrise unchanged'); + '2000-06-19T05:41:56', 'current sunrise unchanged'); is ( $sunset->current( $tmp_set )->set_time_zone( 'America/Los_Angeles' )->datetime, - '2000-06-19T20:03:08', 'current sunset unchanged'); + '2000-06-19T20:04:33', 'current sunset unchanged'); is ( $sunrise->next( $tmp_rise )->set_time_zone( 'America/Los_Angeles' )->datetime, - '2000-06-20T05:43:31', 'next sunrise'); + '2000-06-20T05:42:07', 'next sunrise'); is ( $sunset->next( $tmp_set )->set_time_zone( 'America/Los_Angeles' )->datetime, - '2000-06-20T20:03:24', 'next sunset'); + '2000-06-20T20:04:49', 'next sunset'); is ( $sunrise->previous( $tmp_rise )->set_time_zone( 'America/Los_Angeles' )->datetime, - '2000-06-18T05:43:11', 'previous sunrise'); + '2000-06-18T05:41:46', 'previous sunrise'); is ( $sunset->previous( $tmp_set )->set_time_zone( 'America/Los_Angeles' )->datetime, - '2000-06-18T20:02:52', 'previous sunset'); + '2000-06-18T20:04:16', 'previous sunset'); is ( $sunrise->contains( $tmp_rise ), 1, 'is sunrise'); @@ -82,8 +82,8 @@ my $tmp_set1 = $sun->sunrise_sunset_span($dt); $tmp_set->set_time_zone('America/Los_Angeles'); -ok( $tmp_set1->start->datetime eq '2000-06-20T05:43:31'); -ok( $tmp_set1->end->datetime eq '2000-06-20T20:03:24'); +ok( $tmp_set1->start->datetime eq '2000-06-20T05:42:07'); +ok( $tmp_set1->end->datetime eq '2000-06-20T20:04:49'); use vars qw($long $lat $offset); @@ -165,122 +165,122 @@ } __DATA__ -Aberdeen, Scotland 57 9 N 2 9 W sunrise: 03:12 sunset: 21:08 -Adelaide, Australia 34 55 S 138 36 E sunrise: 06:52 sunset: 16:41 -Algiers, Algeria 36 50 N 3 0 E sunrise: 04:29 sunset: 19:10 -Amsterdam, Netherlands 52 22 N 4 53 E sunrise: 03:18 sunset: 20:06 -Ankara, Turkey 39 55 N 32 55 E sunrise: 04:19 sunset: 19:20 -Asuncion, Paraguay 25 15 S 57 40 W sunrise: 07:35 sunset: 18:09 -Athens, Greece 37 58 N 23 43 E sunrise: 04:02 sunset: 18:50 -Auckland, New_Zealand 36 52 S 174 45 E sunrise: 06:33 sunset: 16:11 -Bangkok, Thailand 13 45 N 100 30 E sunrise: 04:51 sunset: 17:47 -Barcelona, Spain 41 23 N 2 9 E sunrise: 04:18 sunset: 19:28 -Beijing, China 39 55 N 116 25 E sunrise: 03:45 sunset: 18:46 -Belem, Brazil 1 28 S 48 29 W sunrise: 06:14 sunset: 18:16 -Belfast, Northern_Ireland 54 37 N 5 56 W sunrise: 03:47 sunset: 21:03 -Belgrade, Yugoslavia 44 52 N 20 32 E sunrise: 03:51 sunset: 19:27 -Berlin, Germany 52 30 N 13 25 E sunrise: 02:43 sunset: 19:32 -Birmingham, England 52 25 N 1 55 W sunrise: 03:45 sunset: 20:33 -Bogota, Colombia 4 32 N 74 15 W sunrise: 06:47 sunset: 19:10 -Bombay, India 19 0 N 72 48 E sunrise: 04:32 sunset: 17:48 -Bordeaux, France 44 50 N 0 31 W sunrise: 04:16 sunset: 19:51 -Bremen, Germany 53 5 N 8 49 E sunrise: 02:58 sunset: 19:54 -Brisbane, Australia 27 29 S 153 8 E sunrise: 06:36 sunset: 17:01 -Bristol, England 51 28 N 2 35 W sunrise: 03:53 sunset: 20:30 -Brussels, Belgium 50 52 N 4 22 E sunrise: 03:28 sunset: 19:59 -Bucharest, Romania 44 25 N 26 7 E sunrise: 03:31 sunset: 19:03 -Budapest, Hungary 47 30 N 19 5 E sunrise: 03:46 sunset: 19:44 -Buenos_Aires, Argentina 34 35 S 58 22 W sunrise: 08:00 sunset: 17:50 -Cairo, Egypt 30 2 N 31 21 E sunrise: 04:53 sunset: 18:58 -Calcutta, India 22 34 N 88 24 E sunrise: 04:22 sunset: 17:53 -Canton, China 23 7 N 113 15 E sunrise: 04:42 sunset: 18:15 -Cape_Town, South_Africa 33 55 S 18 22 E sunrise: 06:51 sunset: 16:45 -Caracas, Venezuela 10 28 N 67 2 W sunrise: 06:07 sunset: 18:52 -Cayenne, French_Guiana 4 49 N 52 18 W sunrise: 06:18 sunset: 18:43 -Chihuahua, Mexico 28 37 N 106 5 W sunrise: 05:07 sunset: 19:05 -Chongqing, China 29 46 N 106 34 E sunrise: 04:53 sunset: 18:57 -Copenhagen, Denmark 55 40 N 12 34 E sunrise: 02:25 sunset: 19:57 -Cordoba, Argentina 31 28 S 64 10 W sunrise: 07:15 sunset: 17:21 -Dakar, Senegal 14 40 N 17 28 W sunrise: 05:41 sunset: 18:41 -Darwin, Australia 12 28 S 130 51 E sunrise: 05:36 sunset: 17:00 -Djibouti, Djibouti 11 30 N 43 3 E sunrise: 04:45 sunset: 17:33 -Dublin, Ireland 53 20 N 6 15 W sunrise: 03:56 sunset: 20:56 -Durban, South_Africa 29 53 S 30 53 E sunrise: 06:51 sunset: 17:04 -Edinburgh, Scotland 55 55 N 3 10 W sunrise: 03:26 sunset: 21:02 -Frankfurt, Germany 50 7 N 8 41 E sunrise: 03:15 sunset: 19:38 -Georgetown, Guyana 6 45 N 58 15 W sunrise: 06:39 sunset: 19:10 -Glasgow, Scotland 55 50 N 4 15 W sunrise: 03:31 sunset: 21:05 -Guatemala_City, Guatemala 14 37 N 90 31 W sunrise: 05:34 sunset: 18:33 -Guayaquil, Ecuador 2 10 S 79 56 W sunrise: 06:21 sunset: 18:21 -Hamburg, Germany 53 33 N 10 2 E sunrise: 02:50 sunset: 19:52 -Havana, Cuba 23 8 N 82 23 W sunrise: 05:44 sunset: 19:18 -Helsinki, Finland 60 10 N 25 0 E sunrise: 01:54 sunset: 20:49 -Hobart, Tasmania 42 52 S 147 19 E sunrise: 06:41 sunset: 15:42 -Iquique, Chile 20 10 S 70 7 W sunrise: 07:14 sunset: 18:09 -Irkutsk, Russia 52 30 N 104 20 E sunrise: 02:39 sunset: 19:29 -Jakarta, Indonesia 6 16 S 106 48 E sunrise: 06:01 sunset: 17:47 -Johannesburg, South_Africa 26 12 S 28 4 E sunrise: 05:54 sunset: 16:24 -Kingston, Jamaica 17 59 N 76 49 W sunrise: 05:32 sunset: 18:45 -Kinshasa, Congo 4 18 S 15 17 E sunrise: 06:04 sunset: 17:56 -La_Paz, Bolivia 16 27 S 68 22 W sunrise: 07:00 sunset: 18:09 -Leeds, England 53 45 N 1 30 W sunrise: 03:35 sunset: 20:40 -Lima, Peru 12 0 S 77 2 W sunrise: 06:27 sunset: 17:52 -Lisbon, Portugal 38 44 N 9 9 W sunrise: 05:12 sunset: 20:04 -Liverpool, England 53 25 N 3 0 W sunrise: 03:43 sunset: 20:44 -London, England 51 32 N 0 5 W sunrise: 03:42 sunset: 20:21 -Lyons, France 45 45 N 4 50 E sunrise: 03:50 sunset: 19:33 -Madrid, Spain 40 26 N 3 42 W sunrise: 04:44 sunset: 19:48 -Manchester, England 53 30 N 2 15 W sunrise: 03:39 sunset: 20:41 -Manila, Philippines 14 35 N 120 57 E sunrise: 05:28 sunset: 18:27 -Marseilles, France 43 20 N 5 20 E sunrise: 03:58 sunset: 19:22 -Mazatlan, Mexico 23 12 N 106 25 W sunrise: 05:20 sunset: 18:54 -Mecca, Saudi_Arabia 21 29 N 39 45 E sunrise: 04:39 sunset: 18:05 -Melbourne, Australia 37 47 S 144 58 E sunrise: 06:35 sunset: 16:08 -Mexico_City, Mexico 19 26 N 99 7 W sunrise: 05:59 sunset: 19:17 -Milan, Italy 45 27 N 9 10 E sunrise: 03:34 sunset: 19:15 -Montevideo, Uruguay 34 53 S 56 10 W sunrise: 07:52 sunset: 17:40 -Moscow, Russia 55 45 N 37 36 E sunrise: 02:44 sunset: 20:17 -Munich, Germany 48 8 N 11 35 E sunrise: 03:13 sunset: 19:17 -Nagasaki, Japan 32 48 N 129 57 E sunrise: 04:12 sunset: 18:31 -Nagoya, Japan 35 7 N 136 56 E sunrise: 04:38 sunset: 19:09 -Nairobi, Kenya 1 25 S 36 55 E sunrise: 05:32 sunset: 17:35 -Nanjing_Nanking, China 32 3 N 118 53 E sunrise: 03:58 sunset: 18:13 -Naples, Italy 40 50 N 14 15 E sunrise: 03:31 sunset: 18:37 +Aberdeen, Scotland 57 9 N 2 9 W sunrise: 03:09 sunset: 21:11 +Adelaide, Australia 34 55 S 138 36 E sunrise: 06:51 sunset: 16:42 +Algiers, Algeria 36 50 N 3 0 E sunrise: 04:27 sunset: 19:11 +Amsterdam, Netherlands 52 22 N 4 53 E sunrise: 03:15 sunset: 20:08 +Ankara, Turkey 39 55 N 32 55 E sunrise: 04:18 sunset: 19:21 +Asuncion, Paraguay 25 15 S 57 40 W sunrise: 07:34 sunset: 18:10 +Athens, Greece 37 58 N 23 43 E sunrise: 04:01 sunset: 18:52 +Auckland, New_Zealand 36 52 S 174 45 E sunrise: 06:32 sunset: 16:13 +Bangkok, Thailand 13 45 N 100 30 E sunrise: 04:50 sunset: 17:48 +Barcelona, Spain 41 23 N 2 9 E sunrise: 04:16 sunset: 19:29 +Beijing, China 39 55 N 116 25 E sunrise: 03:44 sunset: 18:47 +Belem, Brazil 1 28 S 48 29 W sunrise: 06:13 sunset: 18:17 +Belfast, Northern_Ireland 54 37 N 5 56 W sunrise: 03:44 sunset: 21:06 +Belgrade, Yugoslavia 44 52 N 20 32 E sunrise: 03:49 sunset: 19:29 +Berlin, Germany 52 30 N 13 25 E sunrise: 02:40 sunset: 19:35 +Birmingham, England 52 25 N 1 55 W sunrise: 03:42 sunset: 20:36 +Bogota, Colombia 4 32 N 74 15 W sunrise: 06:46 sunset: 19:11 +Bombay, India 19 0 N 72 48 E sunrise: 04:31 sunset: 17:49 +Bordeaux, France 44 50 N 0 31 W sunrise: 04:14 sunset: 19:53 +Bremen, Germany 53 5 N 8 49 E sunrise: 02:55 sunset: 19:57 +Brisbane, Australia 27 29 S 153 8 E sunrise: 06:35 sunset: 17:02 +Bristol, England 51 28 N 2 35 W sunrise: 03:51 sunset: 20:33 +Brussels, Belgium 50 52 N 4 22 E sunrise: 03:26 sunset: 20:01 +Bucharest, Romania 44 25 N 26 7 E sunrise: 03:29 sunset: 19:05 +Budapest, Hungary 47 30 N 19 5 E sunrise: 03:44 sunset: 19:46 +Buenos_Aires, Argentina 34 35 S 58 22 W sunrise: 07:58 sunset: 17:51 +Cairo, Egypt 30 2 N 31 21 E sunrise: 04:52 sunset: 19:00 +Calcutta, India 22 34 N 88 24 E sunrise: 04:21 sunset: 17:54 +Canton, China 23 7 N 113 15 E sunrise: 04:40 sunset: 18:16 +Cape_Town, South_Africa 33 55 S 18 22 E sunrise: 06:50 sunset: 16:46 +Caracas, Venezuela 10 28 N 67 2 W sunrise: 06:06 sunset: 18:53 +Cayenne, French_Guiana 4 49 N 52 18 W sunrise: 06:17 sunset: 18:44 +Chihuahua, Mexico 28 37 N 106 5 W sunrise: 05:05 sunset: 19:06 +Chongqing, China 29 46 N 106 34 E sunrise: 04:52 sunset: 18:58 +Copenhagen, Denmark 55 40 N 12 34 E sunrise: 02:22 sunset: 20:00 +Cordoba, Argentina 31 28 S 64 10 W sunrise: 07:14 sunset: 17:22 +Dakar, Senegal 14 40 N 17 28 W sunrise: 05:40 sunset: 18:42 +Darwin, Australia 12 28 S 130 51 E sunrise: 05:35 sunset: 17:01 +Djibouti, Djibouti 11 30 N 43 3 E sunrise: 04:44 sunset: 17:34 +Dublin, Ireland 53 20 N 6 15 W sunrise: 03:54 sunset: 20:59 +Durban, South_Africa 29 53 S 30 53 E sunrise: 06:50 sunset: 17:06 +Edinburgh, Scotland 55 55 N 3 10 W sunrise: 03:23 sunset: 21:04 +Frankfurt, Germany 50 7 N 8 41 E sunrise: 03:13 sunset: 19:40 +Georgetown, Guyana 6 45 N 58 15 W sunrise: 06:38 sunset: 19:11 +Glasgow, Scotland 55 50 N 4 15 W sunrise: 03:28 sunset: 21:08 +Guatemala_City, Guatemala 14 37 N 90 31 W sunrise: 05:32 sunset: 18:34 +Guayaquil, Ecuador 2 10 S 79 56 W sunrise: 06:20 sunset: 18:22 +Hamburg, Germany 53 33 N 10 2 E sunrise: 02:47 sunset: 19:55 +Havana, Cuba 23 8 N 82 23 W sunrise: 05:43 sunset: 19:19 +Helsinki, Finland 60 10 N 25 0 E sunrise: 01:50 sunset: 20:53 +Hobart, Tasmania 42 52 S 147 19 E sunrise: 06:40 sunset: 15:44 +Iquique, Chile 20 10 S 70 7 W sunrise: 07:13 sunset: 18:10 +Irkutsk, Russia 52 30 N 104 20 E sunrise: 02:37 sunset: 19:31 +Jakarta, Indonesia 6 16 S 106 48 E sunrise: 06:00 sunset: 17:48 +Johannesburg, South_Africa 26 12 S 28 4 E sunrise: 05:53 sunset: 16:25 +Kingston, Jamaica 17 59 N 76 49 W sunrise: 05:31 sunset: 18:46 +Kinshasa, Congo 4 18 S 15 17 E sunrise: 06:03 sunset: 17:57 +La_Paz, Bolivia 16 27 S 68 22 W sunrise: 06:59 sunset: 18:10 +Leeds, England 53 45 N 1 30 W sunrise: 03:32 sunset: 20:42 +Lima, Peru 12 0 S 77 2 W sunrise: 06:26 sunset: 17:53 +Lisbon, Portugal 38 44 N 9 9 W sunrise: 05:10 sunset: 20:06 +Liverpool, England 53 25 N 3 0 W sunrise: 03:40 sunset: 20:46 +London, England 51 32 N 0 5 W sunrise: 03:40 sunset: 20:23 +Lyons, France 45 45 N 4 50 E sunrise: 03:49 sunset: 19:35 +Madrid, Spain 40 26 N 3 42 W sunrise: 04:43 sunset: 19:49 +Manchester, England 53 30 N 2 15 W sunrise: 03:37 sunset: 20:44 +Manila, Philippines 14 35 N 120 57 E sunrise: 05:27 sunset: 18:28 +Marseilles, France 43 20 N 5 20 E sunrise: 03:56 sunset: 19:24 +Mazatlan, Mexico 23 12 N 106 25 W sunrise: 05:19 sunset: 18:55 +Mecca, Saudi_Arabia 21 29 N 39 45 E sunrise: 04:38 sunset: 18:07 +Melbourne, Australia 37 47 S 144 58 E sunrise: 06:33 sunset: 16:09 +Mexico_City, Mexico 19 26 N 99 7 W sunrise: 05:57 sunset: 19:18 +Milan, Italy 45 27 N 9 10 E sunrise: 03:33 sunset: 19:17 +Montevideo, Uruguay 34 53 S 56 10 W sunrise: 07:50 sunset: 17:42 +Moscow, Russia 55 45 N 37 36 E sunrise: 02:42 sunset: 20:20 +Munich, Germany 48 8 N 11 35 E sunrise: 03:11 sunset: 19:19 +Nagasaki, Japan 32 48 N 129 57 E sunrise: 04:11 sunset: 18:32 +Nagoya, Japan 35 7 N 136 56 E sunrise: 04:36 sunset: 19:11 +Nairobi, Kenya 1 25 S 36 55 E sunrise: 05:31 sunset: 17:36 +Nanjing_Nanking, China 32 3 N 118 53 E sunrise: 03:57 sunset: 18:14 +Naples, Italy 40 50 N 14 15 E sunrise: 03:29 sunset: 18:39 Newcastle-on-Tyne, England 54 58 N 1 37 W 03:27 sunset: 20:49 -Odessa, Ukraine 46 27 N 30 48 E sunrise: 04:04 sunset: 19:52 -Osaka, Japan 34 32 N 135 30 E sunrise: 04:45 sunset: 19:13 -Oslo, Norway 59 57 N 10 42 E sunrise: 01:53 sunset: 20:44 -Panama_City, Panama 8 58 N 79 32 W sunrise: 06:00 sunset: 18:39 -Paramaribo, Suriname 5 45 N 55 15 W sunrise: 06:29 sunset: 18:56 -Paris, France 48 48 N 2 20 E sunrise: 03:47 sunset: 19:57 -Perth, Australia 31 57 S 115 52 E sunrise: 06:16 sunset: 16:19 -Plymouth, England 50 25 N 4 5 W sunrise: 04:04 sunset: 20:31 -Port_Moresby, Papua_New_Guinea 9 25 S 147 8 E sunrise: 05:25 sunset: 17:00 -Prague, Czech_Republic 50 5 N 14 26 E sunrise: 02:52 sunset: 19:15 -Rangoon, Myanmar 16 50 N 96 0 E sunrise: 05:03 sunset: 18:11 -Reykjavik, Iceland 64 4 N 21 58 W sunrise: 01:57 sunset: 23:01 -Rio_de_Janeiro, Brazil 22 57 S 43 12 W sunrise: 07:32 sunset: 18:16 -Rome, Italy 41 54 N 12 27 E sunrise: 03:35 sunset: 18:48 -Salvador, Brazil 12 56 S 38 27 W sunrise: 06:54 sunset: 18:16 -Santiago, Chile 33 28 S 70 45 W sunrise: 07:46 sunset: 17:42 -St_Petersburg, Russia 59 56 N 30 18 E sunrise: 02:35 sunset: 21:25 -Sao_Paulo, Brazil 23 31 S 46 31 W sunrise: 06:47 sunset: 17:28 -Shanghai, China 31 10 N 121 28 E sunrise: 04:50 sunset: 19:00 -Singapore, Singapore 1 14 N 103 55 E sunrise: 05:00 sunset: 17:11 -Sofia, Bulgaria 42 40 N 23 20 E sunrise: 03:48 sunset: 19:07 -Stockholm, Sweden 59 17 N 18 3 E sunrise: 02:31 sunset: 21:07 -Sydney, Australia 34 0 S 151 0 E sunrise: 07:01 sunset: 16:54 -Tananarive, Madagascar 18 50 S 47 33 E sunrise: 06:21 sunset: 17:21 -Teheran, Iran 35 45 N 51 45 E sunrise: 04:17 sunset: 18:52 -Tokyo, Japan 35 40 N 139 45 E sunrise: 04:25 sunset: 18:59 -Tripoli, Libya 32 57 N 13 12 E sunrise: 03:59 sunset: 18:18 -Venice, Italy 45 26 N 12 20 E sunrise: 03:22 sunset: 19:02 -Veracruz, Mexico 19 10 N 96 10 W sunrise: 05:47 sunset: 19:05 -Vienna, Austria 48 14 N 16 20 E sunrise: 03:54 sunset: 19:58 -Vladivostok, Russia 43 10 N 132 0 E sunrise: 03:32 sunset: 18:55 -Warsaw, Poland 52 14 N 21 0 E sunrise: 03:14 sunset: 20:00 -Wellington, New_Zealand 41 17 S 174 47 E sunrise: 06:46 sunset: 15:58 -Zurich, Switzerland 47 21 N 8 31 E sunrise: 03:29 sunset: 19:26 +Odessa, Ukraine 46 27 N 30 48 E sunrise: 04:02 sunset: 19:54 +Osaka, Japan 34 32 N 135 30 E sunrise: 04:44 sunset: 19:15 +Oslo, Norway 59 57 N 10 42 E sunrise: 01:50 sunset: 20:47 +Panama_City, Panama 8 58 N 79 32 W sunrise: 05:59 sunset: 18:40 +Paramaribo, Suriname 5 45 N 55 15 W sunrise: 06:27 sunset: 18:57 +Paris, France 48 48 N 2 20 E sunrise: 03:45 sunset: 19:59 +Perth, Australia 31 57 S 115 52 E sunrise: 06:15 sunset: 16:21 +Plymouth, England 50 25 N 4 5 W sunrise: 04:02 sunset: 20:33 +Port_Moresby, Papua_New_Guinea 9 25 S 147 8 E sunrise: 05:24 sunset: 17:01 +Prague, Czech_Republic 50 5 N 14 26 E sunrise: 02:50 sunset: 19:17 +Rangoon, Myanmar 16 50 N 96 0 E sunrise: 05:02 sunset: 18:12 +Reykjavik, Iceland 64 4 N 21 58 W sunrise: 01:50 sunset: 23:08 +Rio_de_Janeiro, Brazil 22 57 S 43 12 W sunrise: 07:31 sunset: 18:17 +Rome, Italy 41 54 N 12 27 E sunrise: 03:33 sunset: 18:50 +Salvador, Brazil 12 56 S 38 27 W sunrise: 06:53 sunset: 18:17 +Santiago, Chile 33 28 S 70 45 W sunrise: 07:45 sunset: 17:44 +St_Petersburg, Russia 59 56 N 30 18 E sunrise: 02:31 sunset: 21:29 +Sao_Paulo, Brazil 23 31 S 46 31 W sunrise: 06:46 sunset: 17:29 +Shanghai, China 31 10 N 121 28 E sunrise: 04:49 sunset: 19:02 +Singapore, Singapore 1 14 N 103 55 E sunrise: 04:59 sunset: 17:12 +Sofia, Bulgaria 42 40 N 23 20 E sunrise: 03:47 sunset: 19:09 +Stockholm, Sweden 59 17 N 18 3 E sunrise: 02:28 sunset: 21:10 +Sydney, Australia 34 0 S 151 0 E sunrise: 06:59 sunset: 16:55 +Tananarive, Madagascar 18 50 S 47 33 E sunrise: 06:20 sunset: 17:22 +Teheran, Iran 35 45 N 51 45 E sunrise: 04:15 sunset: 18:53 +Tokyo, Japan 35 40 N 139 45 E sunrise: 04:24 sunset: 19:01 +Tripoli, Libya 32 57 N 13 12 E sunrise: 03:57 sunset: 18:20 +Venice, Italy 45 26 N 12 20 E sunrise: 03:20 sunset: 19:04 +Veracruz, Mexico 19 10 N 96 10 W sunrise: 05:46 sunset: 19:06 +Vienna, Austria 48 14 N 16 20 E sunrise: 03:52 sunset: 20:00 +Vladivostok, Russia 43 10 N 132 0 E sunrise: 03:30 sunset: 18:56 +Warsaw, Poland 52 14 N 21 0 E sunrise: 03:12 sunset: 20:03 +Wellington, New_Zealand 41 17 S 174 47 E sunrise: 06:45 sunset: 15:59 +Zurich, Switzerland 47 21 N 8 31 E sunrise: 03:27 sunset: 19:27 1; diff -r -u -N DateTime-Event-Sunrise-0.0501/t/02March21.t DateTime-Event-Sunrise-0.0502/t/02March21.t --- DateTime-Event-Sunrise-0.0501/t/02March21.t 1970-01-01 01:00:00.000000000 +0100 +++ DateTime-Event-Sunrise-0.0502/t/02March21.t 2008-03-28 17:12:52.000000000 +0100 @@ -0,0 +1,30 @@ +use strict; +use POSIX qw(floor ceil); +use Test::More; +use DateTime; +use DateTime::Event::Sunrise; + +my @tests = split "\n", <<'TEST'; +2.33 48.83 1 20 18:04:48 +2.33 48.83 1 21 18:06:19 +2.33 48.83 1 22 18:07:50 +92.33 48.83 0 20 12:03:17 +92.33 48.83 0 21 12:04:48 +92.33 48.83 0 22 12:06:19 +TEST + +plan (tests => scalar @tests); + +foreach (@tests) { + my ($lon, $lat, $iter, $dd, $res) = split ' ', $_; + my $sunset = DateTime::Event::Sunrise->sunset(longitude => $lon, + latitude => $lat, + iteration => $iter, + ); + my $day = DateTime->new(year => 2008, month => 3, day => $dd, time_zone => 'UTC'); + + is ($sunset->next($day)->strftime("%H:%M:%S"), $res); + +} + +


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

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