pub struct Datetime {
pub year: u16,
pub month: u8,
pub day: u8,
pub hour: u8,
pub minute: u8,
pub second: u8,
}Expand description
Wall-clock date/time read from the hardware RTC, fully decoded (binary,
24-hour). See ServiceContext::datetime.
Fields§
§year: u16§month: u8§day: u8§hour: u8§minute: u8§second: u8Implementations§
Source§impl Datetime
impl Datetime
Sourcepub fn from_epoch_secs(epoch: i64) -> Datetime
pub fn from_epoch_secs(epoch: i64) -> Datetime
Decode Unix epoch seconds into calendar fields (Howard Hinnant’s civil_from_days) - the inverse
of Datetime::epoch_secs. Used to render a stored epoch, such as the clock floor, as a date.
Sourcepub fn weekday(&self) -> u8
pub fn weekday(&self) -> u8
Day of week, 0 = Sunday .. 6 = Saturday (computed, not the RTC’s often-unreliable weekday register).
Sourcepub fn epoch_secs(&self) -> i64
pub fn epoch_secs(&self) -> i64
Seconds since the epoch (1970-01-01). Assumes the RTC reads UTC; if the hardware clock is set to local time the value is offset by the timezone (v1 has no timezone database).
Trait Implementations§
impl Copy for Datetime
impl Eq for Datetime
impl StructuralPartialEq for Datetime
Auto Trait Implementations§
impl Freeze for Datetime
impl RefUnwindSafe for Datetime
impl Send for Datetime
impl Sync for Datetime
impl Unpin for Datetime
impl UnsafeUnpin for Datetime
impl UnwindSafe for Datetime
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