pub struct JulianDate { /* private fields */ }Expand description
Julian date representation for astronomical calculations.
Follows the SPA algorithm described in Reda & Andreas (2003). Supports both Julian Date (JD) and Julian Ephemeris Date (JDE) calculations.
Implementations§
Source§impl JulianDate
impl JulianDate
Sourcepub fn from_datetime<Tz: TimeZone>(
datetime: &DateTime<Tz>,
delta_t: f64,
) -> Result<Self>
pub fn from_datetime<Tz: TimeZone>( datetime: &DateTime<Tz>, delta_t: f64, ) -> Result<Self>
Creates a new Julian date from a timezone-aware chrono DateTime.
This function properly handles timezone-aware datetimes by converting the entire datetime to UTC for accurate Julian Date calculations. Solar calculations require proper handling of the Earth’s rotation relative to the Sun, which is referenced to Universal Time.
§Arguments
datetime- Timezone-aware date and timedelta_t- ΔT in seconds (difference between TT and UT1)
§Returns
Julian date or error if the date is invalid
§Errors
Returns error if the date/time components are invalid (e.g., invalid month, day, hour).
Sourcepub fn from_utc(
year: i32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: f64,
delta_t: f64,
) -> Result<Self>
pub fn from_utc( year: i32, month: u32, day: u32, hour: u32, minute: u32, second: f64, delta_t: f64, ) -> Result<Self>
Creates a new Julian date from year, month, day, hour, minute, and second in UTC.
§Arguments
year- Year (can be negative for BCE years)month- Month (1-12)day- Day of month (1-31)hour- Hour (0-23)minute- Minute (0-59)second- Second (0-59, can include fractional seconds)delta_t- ΔT in seconds (difference between TT and UT1)
§Returns
Julian date or error if the date is invalid
§Errors
Returns error if any date/time component is outside valid ranges (month 1-12, day 1-31, hour 0-23, minute 0-59, second 0-59.999).
§Example
let jd = JulianDate::from_utc(2023, 6, 21, 12, 0, 0.0, 69.0).unwrap();
assert!(jd.julian_date() > 2_460_000.0);Sourcepub fn from_utc_simple(
year: i32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: f64,
) -> Result<Self>
pub fn from_utc_simple( year: i32, month: u32, day: u32, hour: u32, minute: u32, second: f64, ) -> Result<Self>
Sourcepub const fn julian_date(&self) -> f64
pub const fn julian_date(&self) -> f64
Sourcepub fn julian_ephemeris_day(&self) -> f64
pub fn julian_ephemeris_day(&self) -> f64
Sourcepub fn julian_century(&self) -> f64
pub fn julian_century(&self) -> f64
Calculates the Julian Century (JC) from J2000.0.
JC = (JD - 2451545.0) / 36525
§Returns
Julian centuries since J2000.0 epoch
Sourcepub fn julian_ephemeris_century(&self) -> f64
pub fn julian_ephemeris_century(&self) -> f64
Calculates the Julian Ephemeris Century (JCE) from J2000.0.
JCE = (JDE - 2451545.0) / 36525
§Returns
Julian ephemeris centuries since J2000.0 epoch
Sourcepub fn julian_ephemeris_millennium(&self) -> f64
pub fn julian_ephemeris_millennium(&self) -> f64
Calculates the Julian Ephemeris Millennium (JME) from J2000.0.
JME = JCE / 10
§Returns
Julian ephemeris millennia since J2000.0 epoch
Trait Implementations§
Source§impl Clone for JulianDate
impl Clone for JulianDate
Source§fn clone(&self) -> JulianDate
fn clone(&self) -> JulianDate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more