DateTime::Astro(3pm)
πΈ NAME πΈ
Okay so bestie, welcome to DateTime::Astro(3pm) β the User Contributed Perl Documentation page for DateTime::Astro. The NAME-line vibe is literally: DateTime::Astro - Functions For Astromical Calendars. Yes, "Astromical" is spelled like that on the page, and we are respecting the icon ππ
periodt.
β¨ DESCRIPTION β¨
So DateTime::Astro implements functions used in astronomical calendars, like the calculation of lunar longitudea and solar longitude. (Yes, "longitudea" is the original's spelling β I'm not fixing it, I'm preserving the artifact π
.)
This module is best used in environments where a C compiler and the MPFR arbitrary precision math library is installed. It can fallback to using Math::BigInt, but that would pretty much render it useless because of its speed and loss of accuracy that may creep up while doing Perl to C struct conversions.
π DISCLAIMER π
Vibe check: this module works, but there are several caveats you should be aware of:
π¨ MPFR Is Required / PurePerl Version Not Functional π¨
There /is/ a HALF BAKED Pure Perl implmentation bundled with this distribution, but at this point please consider it UNUSABLE. This sort of calculation requires the speed and efficiency of a C library anyway.
As such, no cap, you HAVE to have MPFR installed correctly in your system. Please consult your local package manager, or http://mpfr.org.
Patches to make the pure perl version work better is always welcome.
β° 17 solar terms are still off by ~ 5 minutes β°
I've tried very hard to correctly calculate the solar term dates with this module, but I still get 17 instances in about 130 years worth of solar terms, where the dates are off by an average of about 5 minutes β and these usually fall at right about midnight, causing day-based comparisons to be off by 1.
I'm sure there's something that's causing a round off somwhere. If you're up to it, please see xt/101_solar_terms.t and see if you can fix it for me!
π οΈ FUNCTIONS π οΈ
Okay bestie, here's the full function roster, in the exact order the page gives them. I'm keeping every signature character-for-character, even the ones with no description. π
BACKEND()β Returns'XS'or'PP', noting the current backend.dt_from_moment($moment)β Given a moment (days since rd + fractional seconds), returns aDateTimeobject in UTC.dynamical_moment($moment)β Computes the moment value from the given moemnt (the page's spelling, not mine π), taking into account the ephemeris correction.dynamical_moment_from_dt($dt)β Computes the moment value from aDateTimeobject, taking into account the ephemeris correction.ephemeris_correction($moment)β Computes the ephemeris correction on a given moment.gregorian_components_from_rd($rd_days)β Computes year, month, date from RD value.gregorian_year_from_rd($rd_days)β Computes year from RD value.julian_centuries($dt)β Computes the julian centuries for givenDateTimeobject.julian_centuries_from_moment($moment)β Computes the julian centuries for given moment.lunar_phase($dt)β Computes the lunar phase for givenDateTimeobject.lunar_phase_from_moment($moment)β Computes the lunar phase for given moment.polynomial($x, ...)β Computes the polynomical expression using$xas the variable. The left most argument is the constant, and each successive argument is the coefficient for the next power of$x.ymd_seconds_from_moment($moment)β Computes the gregorian components (year, month, day) from the RD date, and the number of seconds from the fractional part.lunar_longitude($dt)β Returns the Moon's longitude on the given date$dt.lunar_longitude_from_moment($moment)β Returns the Moon's longitude on the given moment$moment.moment($dt)β Returns the date$dtexpressed in moment.nth_new_moon($n)β Returns the$n-th new moon, in$moment.
Currently the new moons dates are accurate to about within +/- 60 seconds of the actual new moon for modern dates.
For older dates, the accuraccy degrades a bit to about +/- 5 minutes.
new_moon_after($dt)β No description in the original β just the name/signature as listed.new_moon_before($dt)β No description in the original β just the name/signature as listed.solar_longitude($dt)β Returns the Sun's longitude on the given date$dt.solar_longitude_from_moment($moment)β Returns the Sun's longitude on the given moment$moment.new_moon_after_from_momentβ No description in the original β just the name as listed.new_moon_before_from_momentβ No description in the original β just the name as listed.solar_longitude_afterβ No description in the original β just the name as listed.solar_longitude_after_from_momentβ No description in the original β just the name as listed.solar_longitude_beforeβ No description in the original β just the name as listed.solar_longitude_before_from_momentβ No description in the original β just the name as listed.
π CONSTANTS π
MEAN_SYNODIC_MONTHβ Mean time (in moment) between new moons.MEAN_TROPICAL_YEARβ Mean time (in moment) between a full year (time for the Earth to go around the sun).
π LICENSE π
This library is available under Artistic License v2, and is:
Copyright (C) 2012 Daisuke Maki C<< <daisuke@endeworks.jp> >>
π AUTHOR π
Daisuke Maki β "<daisuke@endeworks.jp>".
π And that's the whole DateTime::Astro(3pm) page, bestie! Cute footer sign-off: source/version is perl v5.42.2, date is 2026-02-15, and the manual is DateTime::Astro(3pm) β slay, bye! π
β¨π«Ά
π¦ where this page comes from
- alpine 3.24: perl-datetime-astro-doc 1.04-r1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms