Time from ratio

This commit is contained in:
Quaternions 2024-09-16 14:06:30 -07:00
parent daa86f7228
commit 0d8ab36031

View File

@ -52,6 +52,17 @@ impl From<Planar64> for Time{
Time((value*Planar64::raw(1_000_000_000)).to_bits().to_bits().digits()[0] as i64)
}
}
impl<Num,Den,N1,T1> From<Ratio<Num,Den>> for Time
where
Num:core::ops::Mul<Planar64,Output=N1>,
N1:Divide<Den,Output=T1>,
T1:Fix<Planar64>,
{
#[inline]
fn from(value:Ratio<Num,Den>)->Self{
Time((value*Planar64::raw(1_000_000_000)).divide().fix().to_bits().to_bits().digits()[0] as i64)
}
}
impl std::fmt::Display for Time{
#[inline]
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{