Raku Land

DateTime::Julian

Actions Status

DateTime::Julian

Provides a DateTime::Julian class (a subclass of Raku's class DateTime) that is instantiated by either a Julian Date (JD) or a Modified Julian Date (MJD).

SYNOPSIS

use DateTime::Julian; my $jd = nnnn.nnnn; # Julian Date for some event my $mjd = nnnn.nnnn; # Modified Julian Date for some event my $utc = DateTime::Julian.new: :julian-date($jd); my $utc2 = DateTime::Julian.new: :modified-julian-date($mjd);

DESCRIPTION

Module DateTime::Julian defines a class (inherited from a Raku DateTime class) that is instantiated from a Julian Date or a Modified Julian Date.

Following are some pertinent definitions from Wikipedia topic Julian day:

The following methods and routines were developed from the descriptions of code in References 1 and 2. The author of Ref. 3 has been very helpful with this author's questions about astronomy and the implementation of astronomical routines.

The main purpose of this module is to simplify time and handling for this author who still finds Julian dates to be somewhat mysterious, but absolutely necessary for dealing with astronomy and predicting object positions, especially the Sun and Moon, for local observation and producing astronomical almanacs.

This module will play a major supporting role in this author's planned Raku module Astro::Almanac;

Class DateTime::Julian methods

method new

new(:$julian-date, :$modified-julian-date) {...}

If both arguments are entered, the Julian Date is used. If neither is entered, an exception is thrown.

Note that currently none of the ordinary DateTime new methods can be used for instantiation, but that could be done if someone can justify it.

method J2000

method MJD0

method POSIX0

Class DateTime::Julian subroutines

sub jcal2gcal

sub gcal2jcal

Notes

  1. A proleptic calendar, according to Wikipedia, "is a calendar that is applied to dates before its introduction."

References

  1. Astronomy on the Personal Computer, Oliver Montenbruck and Thomas Pfleger, Springer, 2000.

  2. Celestial Calculations: A Gentle Introduction to Computational Astronomy, J. L. Lawrence, The MIT Press, 2019.

  3. Astro::Montenbruck, Sergey Krushinsky, CPAN.

  4. Mapping Time: The Calendar and Its History, E. G. Richards, Oxford University Press, 2000.

  5. Date Algorithms (Version 5), Peter Baum, Aesir Research, 2020, https://researchgate.net/publication/316558298.

AUTHOR

Tom Browder tbrowder@cpan.org

COPYRIGHT AND LICENSE

Copyright © 2021 Tom Browder