AbsoluteTime

Struct AbsoluteTime 

Source
pub struct AbsoluteTime { /* private fields */ }
Expand description

An absolute time which are binded to the system’s clock and never be zero except when timer is reset.

Implementations§

Source§

impl AbsoluteTime

Source

pub const MAX_NS: i64 = 1_000_000_000i64

max nanoseconds

Source§

impl AbsoluteTime

Source

pub fn now() -> Self

Creates an instance with the current local time.

Source

pub fn new_time(time_sec: i64, time_nsec: i64) -> Option<Self>

Source

pub unsafe fn new_time_unchecked(time_sec: i64, time_nsec: i64) -> Self

Creates new instance for absolute time accepting the user input.

Automatically corrects the time_nsec value if it is larger than 999_999_999ns.

§Arguments

time_sec - i64 a seconds in absolute notation.

time_nsec - i64 nanoseconds of absolute seconds value. Should not be larger than 999_999_999 which is defined by const Self::MAX_NS. In case if it is larger, the nsec will be rounded and an extra secons will be added.

§Returns

An instance is returned. May panic on overflow.

Source

pub fn seconds_cmp(&self, other: &Self) -> Ordering

Compares only full seconds without nanoseconds fraction (subnano).

Source

pub fn add_sec(self, seconds: i64) -> Self

Source

pub fn reset_nsec(self) -> Self

Trait Implementations§

Source§

impl Add<RelativeTime> for AbsoluteTime

Source§

type Output = AbsoluteTime

The resulting type after applying the + operator.
Source§

fn add(self, rhs: RelativeTime) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<RelativeTime> for AbsoluteTime

Source§

fn add_assign(&mut self, rhs: RelativeTime)

Performs the += operation. Read more
Source§

impl Clone for AbsoluteTime

Source§

fn clone(&self) -> AbsoluteTime

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AbsoluteTime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for AbsoluteTime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<TZ: TimeZone> From<DateTime<TZ>> for AbsoluteTime

Convers the chrono DateTime into the AbsoluteTime using the TZ TimeZone taking the ns fraction of a second (subsec_nano) using timestamp_subsec_nanos function.

Source§

fn from(value: DateTime<TZ>) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for AbsoluteTime

Converts the Duration to RelativeTime taking the subsec_nanos for the time_nsec.

Source§

fn from(value: Duration) -> Self

Converts to this type from the input type.
Source§

impl ModeTimeType for AbsoluteTime

Source§

fn new(time_spec: timespec) -> Self
where Self: Sized,

Creates new instance from the two components: seconds and subnanoseconds of the seconds. Read more
Source§

fn get_sec(&self) -> i64

Returns the seconds without the nanoseconds fraction.
Source§

fn get_nsec(&self) -> i64

Returns the nanoseconds fraction from seconds, not a full time in nanoseconds.
Source§

fn is_value_valid(&self) -> bool

Verifies that the timer is not set to zero. For the RelativeTime it always returns true.
Source§

fn get_flags() -> TimerSetTimeFlags

Returns the TimerSetTimeFlags which are autoinitialized for both types. This flags should be passed to timer.
Source§

impl Ord for AbsoluteTime

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for AbsoluteTime

Source§

fn eq(&self, other: &AbsoluteTime) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for AbsoluteTime

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub<RelativeTime> for AbsoluteTime

Source§

type Output = AbsoluteTime

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: RelativeTime) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for AbsoluteTime

Source§

type Output = AbsoluteTime

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<RelativeTime> for AbsoluteTime

Source§

fn sub_assign(&mut self, rhs: RelativeTime)

Performs the -= operation. Read more
Source§

impl SubAssign for AbsoluteTime

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Copy for AbsoluteTime

Source§

impl Eq for AbsoluteTime

Source§

impl StructuralPartialEq for AbsoluteTime

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V