diff options
author | Jean Forget <J2N-FORGET@orange.fr> | 2014-04-03 07:25:57 +0200 |
---|---|---|
committer | Jean Forget <J2N-FORGET@orange.fr> | 2014-04-03 07:25:57 +0200 |
commit | 076fddb511d3eed3e5eb111a27055ce5fe5a068a (patch) | |
tree | c3db4a70a20b1956e2cc571aaf7fe559d0b79e0b /lib/DateTime/Event/Sunrise.pm | |
parent | 7334e5dc83abf25614c4aeb9a52dae543ee6bb57 (diff) |
A bit more documentation for the "is_polar_day" and "is_polar_night" methods.
Diffstat (limited to 'lib/DateTime/Event/Sunrise.pm')
-rw-r--r-- | lib/DateTime/Event/Sunrise.pm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/DateTime/Event/Sunrise.pm b/lib/DateTime/Event/Sunrise.pm index 9e30cac..068f57d 100644 --- a/lib/DateTime/Event/Sunrise.pm +++ b/lib/DateTime/Event/Sunrise.pm @@ -979,6 +979,28 @@ DateTime::Event::Sunrise - Perl DateTime extension for computing the sunrise/sun say $dt_yapc_na_rise, ' ', $dt_yapc_na_set; } + # If you deal with a polar location + my $sun_in_Halley = DateTime::Event::Sunrise->new( + longitude => -26.65, # 26°39'W + latitude => -75.58, # 75°35'S + precise => 1, + ); + my $Alex_arrival = DateTime->new(year => 2006, # approximate date, not necessarily the exact one + month => 1, + day => 15, + time_zone => 'Antarctica/Rothera'); + say $Alex_arrival->strftime("Alex Gough (a Perl programmer) arrived at Halley Base on %Y-%m-%d."); + if ($sun_in_Halley->is_polar_day($Alex_arrival)) { + say "It would be days, maybe weeks, before the sun would set."; + } + elsif ($sun_in_Halley->is_polar_night($Alex_arrival)) { + say "It would be days, maybe weeks, before the sun would rise."; + } + else { + my $sunset = $sun_in_Halley->sunset_datetime($Alex_arrival); + say $sunset->strftime("And he saw his first antarctic sunset at %H:%M:%S."); + } + =head1 DESCRIPTION This module will computes the time of sunrise and sunset for a given date |