jforget/Astro-Sunrise
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
-*- encoding: utf-8; indent-tabs-mode: nil -*-
Astro::Sunrise version 1.00
===========================
This module commpute the sunrise and sunset for a given day.
NAME
Astro::Sunrise - Perl extension for computing the sunrise/sunset on a given day
SYNOPSIS
# When will the sun rise on YAPC::Europe 2015?
use Astro::Sunrise;
my ($sunrise, $sunset) = sunrise( { year => 2015, month => 9, day => 2, # YAPC::EU starts on 2nd September 2015
lon => -3.6, lat => 37.17, # Granada is 37°10'N, 3°36'W
tz => 1, dst => 1 } ); # This is still summer, therefore DST
# When does the sun rise today in Salt Lake City (home to YAPC::NA 2015)?
use Astro::Sunrise;
use DateTime;
$sunrise_today = sun_rise( { lon => -111.88, lat => 40.75 } ); # 40°45'N, 111°53'W
# And when does it set tomorrow at Salt Lake City?
use Astro::Sunrise;
use DateTime;
$sunset_tomorrow = sun_set( { lat => 40.75, # 40°45'N,
lon => -111.88, # 111°53'W
alt => -0.833, # standard value for the sun altitude at sunset
offset => 1 } ); # day offset up to tomorrow
INSTALLATION
The simplest way to install the module is by using your favorite
utility: CPAN shell, cpanplus, cpanminus, dist-zilla, etc.
To install this module from a cloned git repository or from a tarball
type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
This module requires these other modules and libraries:
Math::Trig
POSIX
Carp
The following module is recommended:
DateTime.pm
COPYRIGHT AND LICENCE
Copyright (C) 2000--2003, 2013, 2015, 2017--2019, 2021, 2023 Ron Hill
and Jean Forget, all rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl 5.16.3. For more details, see the full
text of the licenses in the LICENSE file.
This program is distributed in the hope that it will be useful, but it
is provided “as is” and without any express or implied warranties. For
details, see the full text of the licenses in the file LICENSE.
Based on a public domain C program sunriset.c (c) Paul Schlyter, 1989, 1992
FURTHER DOCUMENTATION
The distribution contains a "doc" subdirectory with a text giving the
astronomical context of this module. This text has a French and an English
versions. Beware, it is a work in progress.