Skip Menu |

This queue is for tickets about the Astro-MoonPhase CPAN distribution.

Report information
The Basics
Id: 45698
Status: new
Priority: 0/
Queue: Astro-MoonPhase

People
Owner: Nobody in particular
Requestors: ais [...] aber.ac.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in Astro-MoonPhase
Date: Mon, 4 May 2009 17:31:14 +0100 (BST)
To: bug-Astro-MoonPhase [...] rt.cpan.org
From: "Adrian D. Shaw" <ais [...] aber.ac.uk>
BUG REPORT ========== Version: Astro-MoonPhase 0.60 Perl v5.8.8 built for i486-linux-gnu-thread-multi Ubuntu Hardy Heron (kernel 2.6.24-23-generic) phase() reports incorrect value for moon's age. (take care not to confuse the variable $MoonAge in the function with the returned value $mage, which becomes $MoonAge in the code below, as recommended in the documentation) CODE TO REPRODUCE BUG ===================== #!/usr/bin/perl use Astro::MoonPhase; ( $MoonPhase, $MoonIllum, $MoonAge, # THIS IS NOT ACCURATE! (around 20 hours out) $MoonDist, $MoonAng, $SunDist, $SunAng ) = Astro::MoonPhase::phase(); print "\nAge: $MoonAge\n"; @name = ("New moon", "First quarter", "Full moon", "Last quarter"); @days = qw( Sunday Monday Tuesday Wednesday Thursday Friday Saturday ); @months = qw( January February March April May June July August September October November December ); ($phase, @times) = phaselist(time()-(86400*14), time()+(86400*21)); # 2 weeks before now, 3 weeks after now while (@times) { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(shift @times); $hour=sprintf("%2d", $hour); # Convert to string $hour=~tr/ /0/; # Pad with 0 if necessary $min=sprintf("%2d", $min); $min=~tr/ /0/; $mday=sprintf("%2d", $mday); $mday=~tr/ /0/; print "$name[$phase] : $days[$wday] $mday $months[$mon] $hour:$min\n"; $phase= ($phase + 1) % 4; } EXAMPLE OUTPUT ============== $ date Mon May 4 17:12:57 BST 2009 $ perl mooncalctestbug.pl Age: 10.3284281552693 New moon : Saturday 25 April 04:24 First quarter : Friday 01 May 21:44 Full moon : Saturday 09 May 05:01 Last quarter : Sunday 17 May 08:27 New moon : Sunday 24 May 13:12 The age calculated from the difference between new moon and current time should be something a little over 9.5 in the above example. The New Moon time given by the module appears to be correct, when compared to tables. Adrian Shaw (ais@aber.ac.uk)