pub struct UT1(/* private fields */);Expand description
Universal Time UT1, based on Earth’s rotation angle.
Internally stores time as a split Julian Date for full precision.
Implementations§
Source§impl UT1
impl UT1
Sourcepub fn new(seconds: i64, nanos: u32) -> UT1
pub fn new(seconds: i64, nanos: u32) -> UT1
Creates UT1 from Unix timestamp components.
Converts seconds and nanoseconds since Unix epoch (1970-01-01 00:00:00) to a split Julian Date representation.
Sourcepub fn from_julian_date(jd: JulianDate) -> UT1
pub fn from_julian_date(jd: JulianDate) -> UT1
Creates UT1 from a Julian Date.
Sourcepub fn to_julian_date(&self) -> JulianDate
pub fn to_julian_date(&self) -> JulianDate
Returns the underlying Julian Date.
Sourcepub fn add_seconds(&self, seconds: f64) -> UT1
pub fn add_seconds(&self, seconds: f64) -> UT1
Adds seconds to this UT1 instant. Negative values subtract.
Trait Implementations§
Source§impl From<JulianDate> for UT1
Converts a Julian Date to UT1.
impl From<JulianDate> for UT1
Converts a Julian Date to UT1.
Source§fn from(jd: JulianDate) -> UT1
fn from(jd: JulianDate) -> UT1
Converts to this type from the input type.
Source§impl FromStr for UT1
Parses UT1 from an ISO 8601 string.
impl FromStr for UT1
Parses UT1 from an ISO 8601 string.
Accepts formats like “2000-01-01T12:00:00” or “2000-01-01T12:00:00.123”.
Source§impl ToTAIWithOffset for UT1
impl ToTAIWithOffset for UT1
Source§impl ToTTWithDeltaT for UT1
impl ToTTWithDeltaT for UT1
Source§impl ToUTCViaTAI for UT1
impl ToUTCViaTAI for UT1
Source§impl ToUTCWithDUT1 for UT1
impl ToUTCWithDUT1 for UT1
Source§fn to_utc_with_dut1(&self, dut1_seconds: f64) -> Result<UTC, TimeError>
fn to_utc_with_dut1(&self, dut1_seconds: f64) -> Result<UTC, TimeError>
Convert UT1 to UTC by subtracting the adjusted DUT1 offset.
The conversion:
- Determines which JD component has larger magnitude (for precision)
- Adjusts DUT1 for any nearby leap second boundaries
- Subtracts the adjusted DUT1 from the smaller-magnitude component
- Preserves the original JD component ordering
The leap second adjustment ensures correct behavior at discontinuities where the UTC scale gains an extra second.
impl Copy for UT1
impl StructuralPartialEq for UT1
Auto Trait Implementations§
impl Freeze for UT1
impl RefUnwindSafe for UT1
impl Send for UT1
impl Sync for UT1
impl Unpin for UT1
impl UnsafeUnpin for UT1
impl UnwindSafe for UT1
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more