pub fn time_system_offset(
jd: f64,
fd: f64,
time_system_src: TimeSystem,
time_system_dst: TimeSystem,
) -> f64Expand description
Compute the offset between two time systems at a given Epoch.
The offset (in seconds) is computed as: time_system_offset = time_system_destination - time_system_source
The value returned is the number of seconds that must be added to the source time system at given the input epoch instant to get the equivalent instant in the destination time system.
Conversions are accomplished using SOFA C library calls.
ยงArguments
jd: Julian date of epochfd: Fractional day of epochtime_system_src: Source time systemtime_system_dst: Destination time system
Returns: offset (float): Offset between soruce and destination time systems in seconds.
Example:
use brahe::constants::MJD_ZERO;
use brahe::eop::*;
use brahe::time::{time_system_offset, TimeSystem};
// Initialize Global EOP
let eop = FileEOPProvider::from_default_file(EOPType::StandardBulletinA, true, EOPExtrapolation::Zero).unwrap();
set_global_eop_provider(eop);
// Get offset between GPS and TAI. This should be 19 seconds.
let offset = time_system_offset(58909.0 + MJD_ZERO, 0.0, TimeSystem::GPS, TimeSystem::TAI);
assert_eq!(offset, 19.0);
// Get offset between GPS time and UT1 for 0h 2020-03-01
let offset = time_system_offset(58909.0 + MJD_ZERO, 0.0, TimeSystem::GPS, TimeSystem::UT1);