Struct TimeNanosecond
pub struct TimeNanosecond { /* private fields */ }
Represents a single point in a civil day, to nanosecond precision.
Implementations
impl TimeNanosecond
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).
const fn nanosecond(self) -> i64Returns the nanosecond value.
The value returned is guaranteed to be in the range specified by
CivilDayNanosecond.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
secondsisi64::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 whennanosecondsis negative enough to result in the time wrapping around at0.const fn to_time(&self) -> TimeConverts this nanosecond representation of a civil time into the components of a civil time.
The subsecond component is preserved in the returned
Time.
Trait Implementations
impl Clone for TimeNanosecond
fn clone(&self) -> Self
impl Copy for TimeNanosecond
impl Debug for TimeNanosecond
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for TimeNanosecond
impl Ord for TimeNanosecond
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for TimeNanosecond
fn eq(&self, other: &Self) -> bool
impl PartialOrd for TimeNanosecond
fn partial_cmp(&self, other: &Self) -> Option<Ordering>