Commit | Line | Data |
---|---|---|
21c4e167 H |
1 | #!/usr/bin/env perl |
2 | use strict; | |
3 | use warnings; | |
4 | use Astro::MoonPhase; | |
5 | ||
6 | ### | |
7 | use locale; | |
8 | #use POSIX qw(strftime localtime); | |
9 | ||
10 | #use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR); | |
11 | ||
12 | #I18N::Langinfo->import(qw(langinfo CODESET)); | |
13 | #my $codeset = langinfo(CODESET()); # note the () | |
14 | ### | |
15 | ||
16 | my $seconds_since_1970 = time(); | |
17 | ||
18 | my ( $MoonPhase, | |
19 | $MoonIllum, | |
20 | $MoonAge, | |
21 | $MoonDist, | |
22 | $MoonAng, | |
23 | $SunDist, | |
24 | $SunAng ) = phase($seconds_since_1970); | |
25 | ||
26 | my @info = phase($seconds_since_1970); | |
27 | print "@info\n"; | |
28 | ||
29 | my @phases = phasehunt(); | |
30 | print "New Moon = ", scalar(localtime($phases[0])), "\n"; | |
31 | print "First quarter = ", scalar(localtime($phases[1])), "\n"; | |
32 | print "Full moon = ", scalar(localtime($phases[2])), "\n"; | |
33 | print "Last quarter = ", scalar(localtime($phases[3])), "\n"; | |
34 | print "New Moon = ", scalar(localtime($phases[4])), "\n"; | |
35 | ||
36 | ||
37 | my @name = ("New Moon", "First quarter", "Full moon", "Last quarter"); | |
38 | my ($phase, @times) = phaselist(time(), (time()+60*60*24*365)); | |
39 | ||
40 | while (@times) { | |
41 | printf "%-14s= %s\n", $name[$phase], scalar localtime shift @times; | |
42 | #printf "%-14s= %s\n", $name[$phase], scalar shift @times; | |
43 | $phase = ($phase + 1) % 4; | |
44 | } | |
45 |