worstead has asked for the wisdom of the Perl Monks concerning the following question:

Astro::Sunrise gives me an error of "Sun never sets!!" each year for leap years, e.g. March 19 2012, but not for other dates. Any suggestions? Thank you.
#!/usr/bin/perl -w # use Astro::Sunrise; $y=2012; $m=03; $d=19; $long=-86; $lati=37 $Zone=-5; $DST=1; $ALT=-0.8333; ($sunrise, $sunset)=sunrise($y,$m,$d,$long,$lati,$Zone,$DST,$ALT,1); print $sunrise,"\n"; print $sunset,"\n";

Replies are listed 'Best First'.
Re: Astro::Sunrise error
by GrandFather (Saint) on Jun 17, 2009 at 02:03 UTC
Re: Astro::Sunrise error
by thunders (Priest) on Jun 17, 2009 at 04:25 UTC
    It seems to be an error in the Module's recently added iterator feature, it's definitely worth filing a bug. I found that if I leave off the last argument to sunrise, I get an answer for that date.
    ($sunrise, $sunset)=sunrise($y,$m,$d,$long,$lati,$Zone,$DST,$ALT); 07:51 19:52
    That seems to be about three minutes off for both sunrise and sunset from what I get at this page: http://aa.usno.navy.mil/data/docs/RS_OneDay.php

    Assuming that site is correct, it may still be close enough for your purposes.

    Update: corrected some numbers above.