CelestialCalendar 1.0.0 · unreleased development @ 67a7c4c79a4a4a6aa7e703c9e6f0039ae34bee82
Loading...
Searching...
No Matches
astro::julian_day Namespace Reference

Classes

struct  Times
 Modelled UT1 and TT at the same instant, in Julian days. More...

Enumerations

enum class  Scale : uint8_t { UTC , UT1 }
 The explicitly declared scale of a civil datetime. More...

Functions

auto ut1_to_jd (const calendar::Datetime &ut1_dt) -> double
 Convert UT1 datetime to julian day number.
auto jd_to_ut1 (const double jd) -> calendar::Datetime
 Convert julian day number to UT1 datetime.
auto tt_to_jde (const calendar::Datetime &tt_dt) -> double
 Converts a TT datetime to julian ephemeris day number.
auto jde_to_tt (const double jde) -> calendar::Datetime
 Converts a julian ephemeris day number to TT datetime.
auto civil_to_tt (const calendar::Datetime &civil_dt, const Scale scale, const astro::delta_t::Model model=astro::delta_t::DEFAULT_MODEL) -> calendar::Datetime
 Convert one explicitly scaled civil datetime to TT, with strict modern UTC admission.
auto resolve_times (const calendar::Datetime &civil_dt, const Scale scale, const astro::delta_t::Model model=astro::delta_t::DEFAULT_MODEL) -> Times
 Resolve UT1 and TT without additional civil-year or derived-TT admission policy.
auto jde_to_ut1 (const double jde) -> calendar::Datetime
 Converts a julian ephemeris day number to UT1 datetime.
auto ut1_to_jde (const calendar::Datetime &ut1_dt) -> double
 Converts a UT1 datetime to julian ephemeris day number.
auto jde_to_utc (const double jde) -> calendar::Datetime
 Converts a julian ephemeris day number to UTC datetime.
auto utc_to_jde (const calendar::Datetime &utc_dt) -> double
 Converts a UTC datetime to julian ephemeris day number.
auto utc_year_start_jde (const std::chrono::year year) -> double
 Return the JDE(TT) of January 1 at 00:00 UTC in a calendar year.
auto validate_annual_year (const int32_t year) -> void
 Validate a Gregorian year for an annual (whole-year) query.
auto utc_year_jde_window (const int32_t year) -> std::array< double, 2 >
 Return the half-open UTC year window expressed as JDE(TT) bounds.
constexpr auto jde_to_jm (const double jde) -> double
 Converts a julian ephemeris day number to julian millennium.
constexpr auto jm_to_jde (const double jm) -> double
 Converts a julian millennium to julian ephemeris day number.
constexpr auto jde_to_jc (const double jde) -> double
 Converts a julian ephemeris day number to julian century.
constexpr auto jc_to_jde (const double jc) -> double
 Converts a julian century to julian ephemeris day number.

Variables

constexpr double J2000
 The julian day number of 2000-01-01, 12:00:00.0 (noon).
constexpr double DAYS_PER_JULIAN_CENTURY
 The number of days in one Julian century (36525 days).

Enumeration Type Documentation

◆ Scale

enum class astro::julian_day::Scale : uint8_t
strong

The explicitly declared scale of a civil datetime.

Enumerator
UTC 
UT1 

Function Documentation

◆ civil_to_tt()

auto astro::julian_day::civil_to_tt ( const calendar::Datetime & civil_dt,
const Scale scale,
const astro::delta_t::Model model = astro::delta_t::DEFAULT_MODEL )->calendar::Datetime
inlinenodiscard

Convert one explicitly scaled civil datetime to TT, with strict modern UTC admission.

Parameters
civil_dtA valid civil datetime, without an inserted leap second.
scaleUTC from 1972-01-01, or explicitly labelled UT1.
modelDelta T model for UT1 input; UTC-to-TT does not evaluate Delta T.
Returns
The TT datetime. Future UTC holds the last known TAI-minus-UTC table entry.
Exceptions
std::invalid_argumentFor invalid input, model-domain rejection or an unrepresentable shift.

◆ jc_to_jde()

auto astro::julian_day::jc_to_jde ( const double jc) ->double
nodiscardconstexpr

Converts a julian century to julian ephemeris day number.

Parameters
jcThe julian century since J2000.
Returns
The julian ephemeris day number, which is based on TT.

◆ jd_to_ut1()

auto astro::julian_day::jd_to_ut1 ( const double jd) ->calendar::Datetime
inlinenodiscard

Convert julian day number to UT1 datetime.

Parameters
jdThe julian day number.
Returns
The datetime in UT1.
Exceptions
std::invalid_argumentif jd is not finite, beyond the year_month_day-representable years, or the estimated gregorian year is < 401.
Note
ut1_to_jd(32767-12-31, fraction ≈ 1) rounds up to exactly the upper bound 13689325.5, which this function rejects — a 1-ulp round-trip break callers must expect.
See also
ERFA v2.0.1 src/jd2cal.c, eraJd2cal.

◆ jde_to_jc()

auto astro::julian_day::jde_to_jc ( const double jde) ->double
nodiscardconstexpr

Converts a julian ephemeris day number to julian century.

Parameters
jdeThe julian ephemeris day number, which is based on TT.
Returns
The julian century since J2000.

◆ jde_to_jm()

auto astro::julian_day::jde_to_jm ( const double jde) ->double
nodiscardconstexpr

Converts a julian ephemeris day number to julian millennium.

Parameters
jdeThe julian ephemeris day number, which is based on TT.
Returns
The julian millennium since J2000.
See also
ERFA v2.0.1 erfam.h, ERFA_DJM.

◆ jde_to_tt()

auto astro::julian_day::jde_to_tt ( const double jde) ->calendar::Datetime
inlinenodiscard

Converts a julian ephemeris day number to TT datetime.

Parameters
jdeThe julian ephemeris day number, which is based on TT (not UT1).
Returns
The date and time, in TT.

◆ jde_to_ut1()

auto astro::julian_day::jde_to_ut1 ( const double jde) ->calendar::Datetime
inlinenodiscard

Converts a julian ephemeris day number to UT1 datetime.

Parameters
jdeThe julian ephemeris day number, which is based on TT.
Returns
The date and time, in UT1.

◆ jde_to_utc()

auto astro::julian_day::jde_to_utc ( const double jde) ->calendar::Datetime
inlinenodiscard

Converts a julian ephemeris day number to UTC datetime.

Parameters
jdeThe julian ephemeris day number, which is based on TT.
Returns
The date and time, in UTC.
Note
Before modern UTC (1972-01-01) this degrades to UT1; see astro::leap_second::tt_to_utc.

◆ jm_to_jde()

auto astro::julian_day::jm_to_jde ( const double jm) ->double
nodiscardconstexpr

Converts a julian millennium to julian ephemeris day number.

Parameters
jmThe julian millennium since J2000.
Returns
The julian ephemeris day number, which is based on TT.
See also
ERFA v2.0.1 erfam.h, ERFA_DJM.

◆ resolve_times()

auto astro::julian_day::resolve_times ( const calendar::Datetime & civil_dt,
const Scale scale,
const astro::delta_t::Model model = astro::delta_t::DEFAULT_MODEL )->Times
inlinenodiscard

Resolve UT1 and TT without additional civil-year or derived-TT admission policy.

Parameters
civil_dtA valid civil datetime on the declared scale.
scaleUTC from 1972-01-01, or explicitly labelled UT1.
modelThe selected Delta T model.
Returns
Both scales; UT1 input passes through without a reverse conversion.
Exceptions
std::invalid_argumentFor invalid input, model-domain rejection or an unrepresentable shift.
Note
Model guards apply at the evaluation instant: UT1 for the forward shift, TT for the reverse. Algo4 UT1 input can derive TT beyond its TT-evaluation end; reversing that TT may fail.

◆ tt_to_jde()

auto astro::julian_day::tt_to_jde ( const calendar::Datetime & tt_dt) ->double
inlinenodiscard

Converts a TT datetime to julian ephemeris day number.

Parameters
tt_dtThe date and time (TT).
Returns
The julian ephemeris day number, which is based on TT (not UT1).

◆ ut1_to_jd()

auto astro::julian_day::ut1_to_jd ( const calendar::Datetime & ut1_dt) ->double
inlinenodiscard

Convert UT1 datetime to julian day number.

Parameters
ut1_dtThe datetime in UT1.
Returns
The julian day number.
Exceptions
std::invalid_argumentif the gregorian year is < 1.
Note
Years 1-400 convert forward, but sit below jd_to_ut1's year-401 bound — round-trips only close from 401-01-01 onwards.
See also
ERFA v2.0.1 src/cal2jd.c, eraCal2jd.

◆ ut1_to_jde()

auto astro::julian_day::ut1_to_jde ( const calendar::Datetime & ut1_dt) ->double
inlinenodiscard

Converts a UT1 datetime to julian ephemeris day number.

Parameters
ut1_dtThe date and time, in UT1.
Returns
The julian ephemeris day number, which is based on TT.
Exceptions
std::invalid_argumentIf the datetime is invalid, the TT shift leaves the representable years, or the converted TT year is below 1; see ut1_to_jd.

◆ utc_to_jde()

auto astro::julian_day::utc_to_jde ( const calendar::Datetime & utc_dt) ->double
inlinenodiscard

Converts a UTC datetime to julian ephemeris day number.

Parameters
utc_dtThe date and time, in UTC.
Returns
The julian ephemeris day number, which is based on TT.
Exceptions
std::invalid_argumentIf a pre-1972 datetime is invalid, the UTC-to-TT shift leaves the representable years, or the converted TT year is below 1; see astro::leap_second::utc_to_tt and ut1_to_jd.
Note
Before modern UTC (1972-01-01) this degrades to UT1; see astro::leap_second::utc_to_tt.

◆ utc_year_jde_window()

auto astro::julian_day::utc_year_jde_window ( const int32_t year) ->std::array< double, 2 >
inlinenodiscard

Return the half-open UTC year window expressed as JDE(TT) bounds.

Parameters
yearGregorian year in [1, 32766], leaving the next January 1 representable.
Returns
Inclusive start and exclusive end, in that order.
Exceptions
std::invalid_argumentIf the year leaves [1, 32766].
Note
Before 1972 the UTC conversion uses UT1; see utc_to_jde.

◆ utc_year_start_jde()

auto astro::julian_day::utc_year_start_jde ( const std::chrono::year year) ->double
inlinenodiscard

Return the JDE(TT) of January 1 at 00:00 UTC in a calendar year.

Parameters
yearGregorian year in [1, 32767].
Returns
The UTC year boundary expressed in TT.
Exceptions
std::invalid_argumentIf the calendar year is invalid or below 1; see ut1_to_jd.
Note
Before 1972 this uses the UT1 substitute from utc_to_jde.
See also
utc_to_jde

◆ validate_annual_year()

auto astro::julian_day::validate_annual_year ( const int32_t year) ->void
inline

Validate a Gregorian year for an annual (whole-year) query.

Parameters
yearThe original integer year.
Exceptions
std::invalid_argumentIf year leaves [1, 32766].
Note
The ceiling sits one below std::chrono::year::max() so the next January 1 stays representable.

Variable Documentation

◆ DAYS_PER_JULIAN_CENTURY

double astro::julian_day::DAYS_PER_JULIAN_CENTURY
inlineconstexpr

The number of days in one Julian century (36525 days).

See also
ERFA v2.0.1 erfam.h, ERFA_DJC.

◆ J2000

double astro::julian_day::J2000
inlineconstexpr

The julian day number of 2000-01-01, 12:00:00.0 (noon).

See also
ERFA v2.0.1 erfam.h, ERFA_DJ00.