pub struct DateTime { /* private fields */ }
Expand description
A date/time value. This is a wrapper around the chrono type with extra functionality for obtaining ticks in OPC UA measurements, endtimes, epoch etc.
Implementations
sourceimpl DateTime
impl DateTime
sourcepub fn now_with_offset(offset: Duration) -> DateTime
pub fn now_with_offset(offset: Duration) -> DateTime
Constructs from the current time with an offset
sourcepub fn endtimes_ticks() -> i64
pub fn endtimes_ticks() -> i64
Returns the maximum tick value, corresponding to the end of time
sourcepub fn ymd_hms(
year: u16,
month: u16,
day: u16,
hour: u16,
minute: u16,
second: u16
) -> DateTime
pub fn ymd_hms(
year: u16,
month: u16,
day: u16,
hour: u16,
minute: u16,
second: u16
) -> DateTime
Constructs from a year, month, day, hour, minute, second
sourcepub fn ymd_hms_nano(
year: u16,
month: u16,
day: u16,
hour: u16,
minute: u16,
second: u16,
nanos: u32
) -> DateTime
pub fn ymd_hms_nano(
year: u16,
month: u16,
day: u16,
hour: u16,
minute: u16,
second: u16,
nanos: u32
) -> DateTime
Constructs from a year, month, day, hour, minute, second, nanosecond
sourcepub fn checked_ticks(&self) -> i64
pub fn checked_ticks(&self) -> i64
To checked ticks. Function returns 0 or MAX_INT64 if date exceeds valid OPC UA range
Trait Implementations
sourceimpl BinaryEncoder<DateTime> for DateTime
impl BinaryEncoder<DateTime> for DateTime
DateTime encoded as 64-bit signed int
sourcefn byte_len(&self) -> usize
fn byte_len(&self) -> usize
Returns the exact byte length of the structure as it would be if encode
were called.
This may be called prior to writing to ensure the correct amount of space is available. Read more
sourcefn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode> where
S: Write,
fn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode> where
S: Write,
Encodes the instance to the write stream.
sourcefn decode<S>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> Result<DateTime, StatusCode> where
S: Read,
fn decode<S>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> Result<DateTime, StatusCode> where
S: Read,
Decodes an instance from the read stream. The decoding options contains restrictions set by
the server / client on the length of strings, arrays etc. If these limits are exceeded the
implementation should return with a BadDecodingError
as soon as possible. Read more
fn encode_to_vec(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
sourceimpl<'de> Deserialize<'de> for DateTime
impl<'de> Deserialize<'de> for DateTime
sourcefn deserialize<D>(
deserializer: D
) -> Result<DateTime, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<DateTime, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialOrd<DateTime> for DateTime
impl PartialOrd<DateTime> for DateTime
sourcefn partial_cmp(&self, other: &DateTime) -> Option<Ordering>
fn partial_cmp(&self, other: &DateTime) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for DateTime
impl Serialize for DateTime
sourcefn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for DateTime
impl StructuralPartialEq for DateTime
Auto Trait Implementations
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more