pub struct UtcTime {
pub seconds: u32,
pub fraction: u32,
pub quality: TimeQuality,
}Expand description
IEC 61850 Timestamp as encoded on the wire: 32-bit seconds since 1970-01-01 00:00:00
UTC, a 24-bit binary fraction of a second, and a quality octet. Eight octets.
Fields§
§seconds: u32Seconds since the Unix epoch.
fraction: u32Fraction of a second in units of 2⁻²⁴ s (only the low 24 bits are significant).
quality: TimeQualityQuality.
Implementations§
Source§impl UtcTime
impl UtcTime
Sourcepub const fn from_unix(
seconds: u32,
nanos: u32,
quality: TimeQuality,
) -> UtcTime
pub const fn from_unix( seconds: u32, nanos: u32, quality: TimeQuality, ) -> UtcTime
Build from Unix seconds and nanoseconds within the second.
A nanos of a second or more carries into seconds rather than wrapping the
fraction: masking it off would turn a caller’s off-by-one into a timestamp a whole
second wrong, silently, in the one field a protection engineer reads first.
Sourcepub const fn from_unix_nanos(nanos: u64, quality: TimeQuality) -> UtcTime
pub const fn from_unix_nanos(nanos: u64, quality: TimeQuality) -> UtcTime
Build from whole Unix nanoseconds (saturating at the 32-bit second limit).
Sourcepub const fn to_unix_nanos(self) -> u64
pub const fn to_unix_nanos(self) -> u64
Whole Unix nanoseconds.
Sourcepub const fn from_octets(o: [u8; 8]) -> UtcTime
pub const fn from_octets(o: [u8; 8]) -> UtcTime
Decode from the eight wire octets.
Trait Implementations§
impl Copy for UtcTime
impl Eq for UtcTime
impl StructuralPartialEq for UtcTime
Auto Trait Implementations§
impl Forget for UtcTime
impl Freeze for UtcTime
impl Move for UtcTime
impl RefUnwindSafe for UtcTime
impl Send for UtcTime
impl Sync for UtcTime
impl Unpin for UtcTime
impl UnsafeUnpin for UtcTime
impl UnwindSafe for UtcTime
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