| 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | |
| 5 | my $period = int(27.321661*24*60*60); #Period of moon rotation in seconds |
| 6 | $period = 2571720; |
| 7 | my $newmoon = 366382697; #Some newmoon in history |
| 8 | my $fullmoon = 365613152; #Some fullmoon in history (14-15d after newmoon) |
| 9 | $fullmoon = 1106645520; |
| 10 | my $now = time(); |
| 11 | |
| 12 | while($fullmoon < $now) { |
| 13 | $fullmoon += $period; |
| 14 | } |
| 15 | $fullmoon = int($fullmoon); |
| 16 | |
| 17 | my $fullmoon_remaining = ($fullmoon-$now)/60/60/24; |
| 18 | |
| 19 | print "$fullmoon = ".localtime($fullmoon)." = ".$fullmoon_remaining." days remaining\n"; |
| 20 | #1254629460 |
| 21 | |