Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
astronomy_conversions.hpp File Reference

Julian Date / MJD / JDN and simple lunar helpers. More...

Go to the source code of this file.

Classes

struct  time_shield::MoonPhaseSineCosine
 sin/cos helper for the Moon phase angle. More...
 

Namespaces

namespace  time_shield
 Main namespace for the Time Shield library.
 

Functions

jd_t time_shield::fts_to_jd (fts_t ts) noexcept
 Convert Unix timestamp (floating seconds) to Julian Date (JD).
 
jd_t time_shield::ts_to_jd (ts_t ts) noexcept
 Convert Unix timestamp (seconds) to Julian Date (JD).
 
jd_t time_shield::gregorian_to_jd (double day, int64_t month, int64_t year) noexcept
 Convert Gregorian date (with optional fractional day) to Julian Date (JD).
 
jd_t time_shield::gregorian_to_jd (uint32_t day, uint32_t month, uint32_t year, uint32_t hour, uint32_t minute, uint32_t second=0, uint32_t millisecond=0) noexcept
 Convert Gregorian date/time components to Julian Date (JD).
 
mjd_t time_shield::fts_to_mjd (fts_t ts) noexcept
 Convert Unix timestamp (floating seconds) to Modified Julian Date (MJD).
 
mjd_t time_shield::ts_to_mjd (ts_t ts) noexcept
 Convert Unix timestamp (seconds) to Modified Julian Date (MJD).
 
jdn_t time_shield::gregorian_to_jdn (uint32_t day, uint32_t month, uint32_t year) noexcept
 Convert Gregorian date to Julian Day Number (JDN).
 
double time_shield::moon_phase_jd_approx (fts_t ts) noexcept
 Get lunar phase in range [0..1) using a simple Julian Day approximation.
 
double time_shield::moon_phase (fts_t ts) noexcept
 Get lunar phase in range [0..1) using the geocentric MoonPhase calculator.
 
MoonPhaseSineCosine time_shield::moon_phase_sincos (fts_t ts) noexcept
 Get sin/cos of the lunar phase angle (continuous signal without wrap-around).
 
double time_shield::moon_illumination (fts_t ts) noexcept
 Get illuminated fraction in range [0..1] using the geocentric MoonPhase calculator.
 
double time_shield::moon_age_days_jd_approx (fts_t ts) noexcept
 Get lunar age in days (~0..29.53) using a simple Julian Day approximation.
 
double time_shield::moon_age_days (fts_t ts) noexcept
 Get lunar age in days (~0..29.53).
 
astronomy::MoonQuarterInstants time_shield::moon_quarters (fts_t ts) noexcept
 Quarter instants around the provided timestamp.
 
bool time_shield::is_new_moon_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the new moon window (default \pm12h).
 
bool time_shield::is_full_moon_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the full moon window (default \pm12h).
 
bool time_shield::is_first_quarter_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the first quarter window (default \pm12h).
 
bool time_shield::is_last_quarter_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the last quarter window (default \pm12h).
 

Detailed Description

Julian Date / MJD / JDN and simple lunar helpers.

JD epoch used here:

  • Unix epoch (1970-01-01 00:00:00 UTC) is JD 2440587.5

Notes:

  • JD and MJD are returned as double (jd_t/mjd_t).
  • These functions are intended for utility/analytics, not for high-precision astronomy.

Definition in file astronomy_conversions.hpp.