Struct TimeSecond
pub struct TimeSecond { /* private fields */ }
Represents a single point in a civil day, to second precision.
Implementations
impl TimeSecond
const fn new(second: i32) -> Result<TimeSecond, RangeError>Creates a new civil time from a given second value.
The value must correspond to the number of seconds elapsed since the start of a civil day. It cannot exceed the length of a civil day (in seconds).
const fn constant(second: i32) -> TimeSecondCreates a new civil time from a given second value.
This panics when
secondexceeds the maximum number of seconds in a single civil day.const fn second(self) -> i32Returns the second value.
The value returned is guaranteed to be in the range specified by
CivilDaySecond.const fn overflowing_add(self, seconds: i32) -> Result<(TimeSecond, i32), RangeError>Adds the given number of seconds to this civil time and returns the resulting civil time with any overflowing amount in units of civil days.
This returns an error when integer overflow occurs. For example, when
secondsisi32::MAXand this civil time is any time other than midnight.Note that the number of days returned may exceed the range supported by
UnixEpochDay. Moreover, the number of days returned may be negative. This occurs only whensecondsis negative enough to result in the time wrapping around at0.const fn to_time(&self) -> TimeConverts this second representation of a civil time into the components of a civil time.
The subsecond component on the
Timereturned is always0.
Trait Implementations
impl Clone for TimeSecond
fn clone(&self) -> Self
impl Copy for TimeSecond
impl Debug for TimeSecond
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for TimeSecond
impl Ord for TimeSecond
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for TimeSecond
fn eq(&self, other: &Self) -> bool
impl PartialOrd for TimeSecond
fn partial_cmp(&self, other: &Self) -> Option<Ordering>