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) -> i64

Returns 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 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.

const fn to_time(&self) -> Time

Converts 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>

impl StructuralPartialEq for TimeNanosecond

Auto Trait Implementations

impl Freeze for TimeNanosecond

impl RefUnwindSafe for TimeNanosecond

impl Send for TimeNanosecond

impl Sync for TimeNanosecond

impl Unpin for TimeNanosecond

impl UnsafeUnpin for TimeNanosecond

impl UnwindSafe for TimeNanosecond

Blanket Implementations

impl<T> Any for TimeNanosecond where T: 'static + ?Sized,

impl<T> Borrow<T> for TimeNanosecond where T: ?Sized,

impl<T> BorrowMut<T> for TimeNanosecond where T: ?Sized,

impl<T> CloneToUninit for TimeNanosecond where T: Clone,

impl<T> From<T> for TimeNanosecond

impl<T> ToOwned for TimeNanosecond where T: Clone,

impl<T, U> Into<U> for TimeNanosecond where U: From<T>,

impl<T, U> TryFrom<U> for TimeNanosecond where U: Into<T>,

impl<T, U> TryInto<U> for TimeNanosecond where U: TryFrom<T>,