pub const J2000_EPOCH: f64 = 2_451_545.0;
pub struct MarsEpoch {
pub julian_date: f64,
}
impl MarsEpoch {
pub fn j2000() -> Self {
Self {
julian_date: J2000_EPOCH,
}
}
pub fn from_jd(jd: f64) -> Self {
Self { julian_date: jd }
}
pub fn centuries_since_j2000(&self) -> f64 {
(self.julian_date - J2000_EPOCH) / 36525.0
}
pub fn days_since_j2000(&self) -> f64 {
self.julian_date - J2000_EPOCH
}
pub fn sols_since_j2000(&self) -> f64 {
self.days_since_j2000() * 86400.0 / crate::SOL_S
}
pub fn advance_sols(&mut self, sols: f64) {
self.julian_date += sols * crate::SOL_S / 86400.0;
}
pub fn advance_seconds(&mut self, seconds: f64) {
self.julian_date += seconds / 86400.0;
}
pub fn mars_year(&self) -> i32 {
let msd = super::calendar::MarsSolDate::from_julian_date(self.julian_date);
msd.mars_year
}
pub fn ls_deg(&self) -> f64 {
let msd = super::calendar::MarsSolDate::from_julian_date(self.julian_date);
msd.ls_deg()
}
}