pub struct Time {
pub hour: u8,
pub minute: u8,
pub second: u8,
pub offset: Option<TimeOffset>,
}
Expand description
A potentially timezone aware time.
Fields§
§hour: u8
The hour (0-23).
minute: u8
The minute (0-59).
second: u8
The second (0-59).
offset: Option<TimeOffset>
An optional timezone offset.
Implementations§
source§impl Time
impl Time
sourcepub fn from_hms(hour: u8, minute: u8, second: u8) -> Option<Self>
pub fn from_hms(hour: u8, minute: u8, second: u8) -> Option<Self>
Create a new time from hours, minutes, and seconds. Return None
if
the values are out of range.
sourcepub fn from_hms_offset(
hour: u8,
minute: u8,
second: u8,
offset: TimeOffset
) -> Option<Self>
pub fn from_hms_offset( hour: u8, minute: u8, second: u8, offset: TimeOffset ) -> Option<Self>
Create a new time from hours, minutes, seconds and an offset. Return
None
if the values are out of range.
sourcepub fn to_utc_seconds(&self) -> isize
pub fn to_utc_seconds(&self) -> isize
Return seconds in UTC.
Trait Implementations§
source§impl PartialEq for Time
impl PartialEq for Time
source§impl PartialOrd for Time
impl PartialOrd for Time
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Time
impl Eq for Time
impl StructuralEq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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