macro_rules! from_fs {
($fs:expr, $frac:expr, on=$scale:expr, target=$target:expr) => { ... };
($fs:expr, $frac:expr, target=$target:expr, on=$scale:expr) => { ... };
($fs:expr, on=$scale:expr, target=$target:expr) => { ... };
($fs:expr, target=$target:expr, on=$scale:expr) => { ... };
($fs:expr, $frac:expr, on=$scale:expr) => { ... };
($fs:expr, $frac:expr, target=$target:expr) => { ... };
($fs:expr, on=$scale:expr) => { ... };
($fs:expr, target=$target:expr) => { ... };
($fs:expr, $frac:expr) => { ... };
($fs:expr) => { ... };
}Expand description
Builds a Dt from whole femtoseconds and an optional signed
fractional remainder in attoseconds.
Sugar for Dt::from_fs. Does not perform
time-scale conversion.
The fractional remainder is already in attoseconds (one femtosecond is 1000 attoseconds) — there is no smaller named unit macro.
§Defaults
| Omitted | Default |
|---|---|
| fraction | 0 |
on and target | both Scale::TAI |
only on=s | target=s |
only target=t | on=TAI |
§Forms
from_fs!(fs)
from_fs!(fs, frac)
from_fs!(fs, on=s)
from_fs!(fs, target=t)
from_fs!(fs, on=s, target=t)
from_fs!(fs, target=t, on=s)
from_fs!(fs, frac, on=s)
from_fs!(fs, frac, target=t)
from_fs!(fs, frac, on=s, target=t)
from_fs!(fs, frac, target=t, on=s)§Examples
use deep_time::{Dt, Scale, from_fs};
// 1.3 fs → whole femtoseconds + 300 attoseconds remainder
let a = from_fs!(1);
let b = from_fs!(1, 300);
let c = from_fs!(-1, -300, on=Scale::TAI);
let d = from_fs!(0, on=Scale::UTC);
let e = from_fs!(1, on=Scale::TAI, target=Scale::UTC);
let f = from_fs!(1, target=Scale::UTC);
assert_eq!(a, Dt::from_fs(1, 0, Scale::TAI, Scale::TAI));
assert_eq!(b, Dt::from_fs(1, 300, Scale::TAI, Scale::TAI));
assert_eq!(c, Dt::from_fs(-1, -300, Scale::TAI, Scale::TAI));
assert_eq!(d, Dt::from_fs(0, 0, Scale::UTC, Scale::UTC));
assert_eq!(e, Dt::from_fs(1, 0, Scale::TAI, Scale::UTC));
assert_eq!(f, e);
let signed = from_fs!(-1, -300);
let floor = from_fs!(-2, 700);
assert_eq!(signed, floor);
assert_eq!(signed, Dt::from_fs(-1, -300, Scale::TAI, Scale::TAI));