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
AbsoluteTime::from(LocalTime::now()); AbsoluteTime::from(Duration::from_sec(1)); AbsoluteTime::from(10); AbsoluteTime::from((10, 46000)); AbsoluteTime::new_time(10, 46000);Implementations§
Source§impl AbsoluteTime
impl AbsoluteTime
pub fn new_time(time_sec: i64, time_nsec: i64) -> Option<Self>
Sourcepub unsafe fn new_time_unchecked(time_sec: i64, time_nsec: i64) -> Self
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.
Sourcepub fn seconds_cmp(&self, other: &Self) -> Ordering
pub fn seconds_cmp(&self, other: &Self) -> Ordering
Compares only full seconds without nanoseconds fraction (subnano).
pub fn add_sec(self, seconds: i64) -> Self
pub fn reset_nsec(self) -> Self
Trait Implementations§
Source§impl Add<Duration> for AbsoluteTime
impl Add<Duration> for AbsoluteTime
Source§impl Add<RelativeTime> for AbsoluteTime
impl Add<RelativeTime> for AbsoluteTime
Source§type Output = AbsoluteTime
type Output = AbsoluteTime
+ operator.Source§impl AddAssign<Duration> for AbsoluteTime
impl AddAssign<Duration> for AbsoluteTime
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+= operation. Read moreSource§impl AddAssign<RelativeTime> for AbsoluteTime
impl AddAssign<RelativeTime> for AbsoluteTime
Source§fn add_assign(&mut self, rhs: RelativeTime)
fn add_assign(&mut self, rhs: RelativeTime)
+= operation. Read moreSource§impl Clone for AbsoluteTime
impl Clone for AbsoluteTime
Source§fn clone(&self) -> AbsoluteTime
fn clone(&self) -> AbsoluteTime
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AbsoluteTime
impl Debug for AbsoluteTime
Source§impl Display for AbsoluteTime
impl Display for AbsoluteTime
Source§impl From<(i64, i64)> for AbsoluteTime
Converts the tuple (i64, i64) (seconds, nsec) to AbsoluteTime ignoring
the subsec_nanos fraction and setting it to zero.
impl From<(i64, i64)> for AbsoluteTime
Converts the tuple (i64, i64) (seconds, nsec) to AbsoluteTime ignoring
the subsec_nanos fraction and setting it to zero.
Source§impl From<AbsoluteTime> for Duration
impl From<AbsoluteTime> for Duration
Source§fn from(value: AbsoluteTime) -> Self
fn from(value: AbsoluteTime) -> Self
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.
impl<TZ: TimeZone> From<DateTime<TZ>> for AbsoluteTime
Convers the chrono DateTimeTZ TimeZone taking the ns fraction of a second (subsec_nano)
using timestamp_subsec_nanos function.
Source§impl From<Duration> for AbsoluteTime
Converts the Duration to AbsoluteTime taking the subsec_nanos
for the time_nsec.
impl From<Duration> for AbsoluteTime
Converts the Duration to AbsoluteTime taking the subsec_nanos
for the time_nsec.
Source§impl From<i64> for AbsoluteTime
Converts the i64 (seconds) to AbsoluteTime ignoring
the subsec_nanos fraction and setting it to zero.
impl From<i64> for AbsoluteTime
Converts the i64 (seconds) to AbsoluteTime ignoring
the subsec_nanos fraction and setting it to zero.
Source§impl From<timespec> for AbsoluteTime
impl From<timespec> for AbsoluteTime
Source§impl From<u128> for AbsoluteTime
Converts the u128 (MSB:seconds|LSB:nanosec) to AbsoluteTime by
separationg MSB seconds from nanoseconds
impl From<u128> for AbsoluteTime
Converts the u128 (MSB:seconds|LSB:nanosec) to AbsoluteTime by separationg MSB seconds from nanoseconds
Source§impl From<u64> for AbsoluteTime
Converts the u64 (seconds) to AbsoluteTime ignoring
the subsec_nanos fraction and setting it to zero.
impl From<u64> for AbsoluteTime
Converts the u64 (seconds) to AbsoluteTime ignoring
the subsec_nanos fraction and setting it to zero.
Source§impl ModeTimeType for AbsoluteTime
impl ModeTimeType for AbsoluteTime
Source§fn get_nsec(&self) -> i64
fn get_nsec(&self) -> i64
Source§fn is_value_valid(&self) -> bool
fn is_value_valid(&self) -> bool
Source§fn get_flags() -> TimerSetTimeFlags
fn get_flags() -> TimerSetTimeFlags
Source§impl Ord for AbsoluteTime
impl Ord for AbsoluteTime
Source§impl PartialEq for AbsoluteTime
impl PartialEq for AbsoluteTime
Source§impl PartialOrd for AbsoluteTime
impl PartialOrd for AbsoluteTime
Source§impl Sub<Duration> for AbsoluteTime
impl Sub<Duration> for AbsoluteTime
Source§impl Sub<RelativeTime> for AbsoluteTime
impl Sub<RelativeTime> for AbsoluteTime
Source§type Output = AbsoluteTime
type Output = AbsoluteTime
- operator.Source§impl Sub for AbsoluteTime
impl Sub for AbsoluteTime
Source§impl SubAssign<Duration> for AbsoluteTime
impl SubAssign<Duration> for AbsoluteTime
Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-= operation. Read moreSource§impl SubAssign<RelativeTime> for AbsoluteTime
impl SubAssign<RelativeTime> for AbsoluteTime
Source§fn sub_assign(&mut self, rhs: RelativeTime)
fn sub_assign(&mut self, rhs: RelativeTime)
-= operation. Read moreSource§impl SubAssign for AbsoluteTime
impl SubAssign for AbsoluteTime
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more