NAME
DateTime::Util::Astro::Sun - Functions To Calculate Solar Data
SYNOPSIS
use DateTime::Util::Astro::Sun qw(solar_longitude);
my $longitude = solar_longitude($dt);
DESCRIPTION
This module provides functions to calculate solar data, but its main focus is to provide just enough functionality that allows us to create lunisolar calendars and other DateTime related modules.
This module is a *straight* port from "Calendrical Calculations" [1] -- and therefore there are places where things can probably be "fixed" so that they look more like Perl, as well as places where we could leverage the DateTime functionalities better. If you see things that doesn't quite look right (in Perl), that's probably because of that.
Notes On Accuracy
Before you use this module, please be aware that this module was originally created solely for the purpose of creating a lunisolar calendar for the DateTime project (http://datetime.perl.org).
We used [1] as basis for our calculations. While for most purposes the results are accurate enough, you should note that the calculations from this book are approximations.
Obviously we would like to make this module as good as possible, but there's only so much you can do in the accuracy department. However, having GMP and Math::BigInt::GMP may help a little bit.
This module by default uses Perl's arbitrary precision calculation module Math::BigFloat. However, this adds a fair amount of overhead, and you will see a noticeable difference in execution speed. This is true even if you use GMP.
If you are willing to trade accuracy for speed, you may override the class variable from DateTime::Util::Calc to toggle off the use of Math::BigFloat:
use DateTime::Util::Astro::Sun qw(solar_longitude);
local $DateTime::Util::Calc::NoBigFloat = 1;
my $x = solnar_longitude($dt);
FUNCTIONS
solar_longitude($dt)
Given a DateTime object $dt, calculates the solar longitude at that time.
AUTHOR
Daisuke Maki <daisuke@cpan.org>
REFERENCES
[1] Edward M. Reingold, Nachum Dershowitz
"Calendrical Calculations (Millenium Edition)", 2nd ed.
Cambridge University Press, Cambridge, UK 2002
SEE ALSO
DateTime DateTime::Event::Lunar DateTime::Event::SolarTerm DateTime::Util::Astro::Common DateTime::Util::Astro::Moon