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 now() -> 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 PartialOrd for Time32
impl PartialOrd for Time32
impl Copy for Time32
impl StructuralPartialEq 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)