pub struct TimeSecond { /* private fields */ }Expand description
Represents a single point in a civil day, to second precision.
Implementations§
Source§impl TimeSecond
impl TimeSecond
Sourcepub const fn new(second: i32) -> Result<TimeSecond, RangeError>
pub 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).
Sourcepub const fn constant(second: i32) -> TimeSecond
pub const fn constant(second: i32) -> TimeSecond
Creates a new civil time from a given second value.
This panics when second exceeds the maximum number of seconds in a
single civil day.
Sourcepub const fn second(self) -> i32
pub const fn second(self) -> i32
Returns the second value.
The value returned is guaranteed to be in the range specified by
CivilDaySecond.
Sourcepub const fn overflowing_add(
self,
seconds: i32,
) -> Result<(TimeSecond, i32), RangeError>
pub 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
seconds is i32::MAX and 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 when seconds is
negative enough to result in the time wrapping around at 0.
Trait Implementations§
Source§impl Clone for TimeSecond
impl Clone for TimeSecond
Source§fn clone(&self) -> TimeSecond
fn clone(&self) -> TimeSecond
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more