pub struct TimeNanosecond { /* private fields */ }Expand description
Represents a single point in a civil day, to nanosecond precision.
Implementations§
Source§impl TimeNanosecond
impl TimeNanosecond
Sourcepub const fn new(nanosecond: i64) -> Result<TimeNanosecond, RangeError>
pub const fn new(nanosecond: i64) -> Result<TimeNanosecond, RangeError>
Creates a new civil time from a given nanosecond value.
The value must correspond to the number of nanoseconds elapsed since the start of a civil day. It cannot exceed the length of a civil day (in nanoseconds).
Sourcepub const fn nanosecond(self) -> i64
pub const fn nanosecond(self) -> i64
Returns the nanosecond value.
The value returned is guaranteed to be in the range specified by
CivilDayNanosecond.
Sourcepub const fn overflowing_add(
self,
nanoseconds: i64,
) -> Result<(TimeNanosecond, i64), RangeError>
pub const fn overflowing_add( self, nanoseconds: i64, ) -> Result<(TimeNanosecond, i64), RangeError>
Adds the given number of nanoseconds 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 i64::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 nanoseconds is
negative enough to result in the time wrapping around at 0.