pub struct Time32 { /* private fields */ }Expand description
32 Bit Fixed Precision Time Format, storing 16 bits of Seconds, and 16 bits
of Fractional Seconds. This is the equivalent of Q16.16, and is semantically
equivalent to the NTP Short Format if using the epoch::NTP_EPOCH.
The 16-bit seconds field can resolve a little over 18 hours, and the 16-bit fractional seconds field can resolve a little over 15 microseconds.
Implementations§
Source§impl Time32
impl Time32
pub const fn new(epoch: Epoch, seconds: u16, fractional_seconds: u16) -> Self
pub fn new_f64(epoch: Epoch, seconds: f64) -> Self
pub const fn get_seconds(&self) -> u16
pub const fn get_fractional_seconds(&self) -> u16
pub fn as_f64(&self) -> f64
pub fn try_from_iso8601(val: &str) -> Result<Self, FormatError>
pub fn as_only_seconds(&self) -> Self
pub fn as_only_fractional(&self) -> Self
pub fn as_epoch(&self, other: Epoch) -> Self
Methods from Deref<Target = FixedU32>§
pub const E: FixedU32
pub const PI: FixedU32
pub const ONE_HALF: FixedU32
pub const RESOLUTION: FixedU32
pub fn trunc(&self) -> u16
pub fn whole(&self) -> u16
pub fn fract(&self) -> u16
pub fn raw_value(&self) -> u32
pub fn as_f64(&self) -> f64
pub fn is_zero(&self) -> bool
Trait Implementations§
Source§impl AddAssign<Duration> for &mut Time32
impl AddAssign<Duration> for &mut Time32
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreSource§impl AddAssign<Duration> for Time32
impl AddAssign<Duration> for Time32
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+= operation. Read moreSource§impl From<&UTCDateTime> for Time32
impl From<&UTCDateTime> for Time32
Source§fn from(value: &UTCDateTime) -> Self
fn from(value: &UTCDateTime) -> Self
Converts to this type from the input type.
Source§impl From<&mut UTCDateTime> for Time32
impl From<&mut UTCDateTime> for Time32
Source§fn from(value: &mut UTCDateTime) -> Self
fn from(value: &mut UTCDateTime) -> Self
Converts to this type from the input type.
Source§impl From<UTCDateTime> for Time32
impl From<UTCDateTime> for Time32
Source§fn from(value: UTCDateTime) -> Self
fn from(value: UTCDateTime) -> Self
Converts to this type from the input type.
Source§impl Ord for Time32
impl Ord for Time32
Source§impl PartialOrd for Time32
impl PartialOrd for Time32
impl Copy for Time32
impl Eq for Time32
Auto Trait Implementations§
impl Freeze for Time32
impl RefUnwindSafe for Time32
impl Send for Time32
impl Sync for Time32
impl Unpin for Time32
impl UnwindSafe for Time32
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