macro_rules! from_mjd_f {
($mjd:expr, on=$scale:expr) => { ... };
($mjd:expr) => { ... };
}Expand description
Builds a TAI Dt from a floating-point Modified Julian Date.
Equivalent to Dt::from_mjd_f.
When an on arg is provided and it’s not Scale::TAI
then a time scale conversion is performed equivalent to on ->
Scale::TAI.
There is no target= on this macro — the returned Dt’s
target is set from on (or TAI when omitted), as
from_mjd_f does. Chain
.target(…) if needed.
MJD and JD relate by JD = MJD + 2_400_000.5.
§Defaults
| Omitted | Default |
|---|---|
on | Scale::TAI |
§Forms
from_mjd_f!(mjd)
from_mjd_f!(mjd, on=s)§Examples
use deep_time::{Dt, Scale, days_f, macros::from_mjd_f};
// 60_961.25
let a = from_mjd_f!(60_961.25);
let b = from_mjd_f!(60_961.25, on=Scale::TAI);
let c = from_mjd_f!(60_961.0, on=Scale::UTC);
assert_eq!(a, Dt::from_mjd_f(60_961.25, Scale::TAI));
assert_eq!(b, a);
assert_eq!(c, Dt::from_mjd_f(60_961.0, Scale::UTC));
assert_eq!(a.to_mjd_floor(), (60_961, days_f!(0.25)));
// -1_000.25 as -1_001 + 0.75 day
let neg = from_mjd_f!(-1_000.25);
assert_eq!(neg, Dt::from_mjd_f(-1_000.25, Scale::TAI));
assert_eq!(neg.to_mjd_floor(), (-1_001, days_f!(0.75)));