pub struct Time { /* private fields */ }Expand description
Represents a time of the day, an offset into the day from midnight.
Corresponds to a UTC of day in section 5.3.3 of ISO8601
Implementations§
source§impl Time
impl Time
sourcepub fn new(
second_of_day: u32,
nanoseconds: u32
) -> Result<Time, GreaterThanEqualToValueError<u32>>
pub fn new( second_of_day: u32, nanoseconds: u32 ) -> Result<Time, GreaterThanEqualToValueError<u32>>
Creates a Time from the specified seconds and nanoseconds,
The valid range of ‘second_of_day’ is 0..86400,
The valid range of ‘nanoseconds’ is 0..1_000_000_000
sourcepub fn from_seconds_f64(
seconds: f64
) -> Result<Time, GreaterThanEqualToValueError<f64>>
pub fn from_seconds_f64( seconds: f64 ) -> Result<Time, GreaterThanEqualToValueError<f64>>
Creates a Time from the specified fractional seconds, valid range 0..86400
pub fn from_hms( hours: u8, minutes: u8, seconds: u8 ) -> Result<Time, GreaterThanEqualToValueError<u8>>
pub fn from_hms_f64( hours: u8, minutes: u8, seconds: f64 ) -> Result<Time, GreaterThanEqualToValueError<f64>>
pub fn from_hms_millis( hours: u8, minutes: u8, seconds: u8, millis: u32 ) -> Result<Time, GreaterThanEqualToValueError<u32>>
sourcepub fn get_seconds(&self) -> u32
pub fn get_seconds(&self) -> u32
Returns the number of seconds into the “current day”
sourcepub fn get_nanoseconds(&self) -> u32
pub fn get_nanoseconds(&self) -> u32
Returns the number of fractional second nanoseconds
sourcepub fn as_duration(&self) -> Duration
pub fn as_duration(&self) -> Duration
Converts this time into a duration
sourcepub fn as_minutes(&self) -> u32
pub fn as_minutes(&self) -> u32
Returns the minute offset into the day represented by this time.
sourcepub fn as_hms(&self) -> (u32, u32, u32)
pub fn as_hms(&self) -> (u32, u32, u32)
Returns a triplet, (hours, minutes, seconds) representing this time
sourcepub fn get_secondsfrac(&self) -> f64
pub fn get_secondsfrac(&self) -> f64
Returns ONLY the fractional seconds component of the timestamp
sourcepub fn format<F: Format<Item = Self>>(&self, format: &F) -> String
pub fn format<F: Format<Item = Self>>(&self, format: &F) -> String
Formats this Time using the specified formatter
sourcepub fn parse_from<F: FormatParser<Item = Self>>(
format: &F,
string: &str
) -> Result<Self, FormatError>
pub fn parse_from<F: FormatParser<Item = Self>>( format: &F, string: &str ) -> Result<Self, FormatError>
Tries to parse a Time from the string using the specified Formatter
Trait Implementations§
source§impl Ord for Time
impl Ord for Time
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
self and other) and is used by the <=
operator. Read more