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§
Source§impl DateTime
impl DateTime
Sourcepub fn now_with_offset(offset: TimeDelta) -> DateTime
pub fn now_with_offset(offset: TimeDelta) -> 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§
Source§impl BinaryEncoder<DateTime> for DateTime
DateTime encoded as 64-bit signed int
impl BinaryEncoder<DateTime> for DateTime
DateTime encoded as 64-bit signed int
Source§fn 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.Source§fn 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.
Source§fn 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.fn encode_to_vec(&self) -> Vec<u8> ⓘ
Source§impl<'de> Deserialize<'de> for DateTime
impl<'de> Deserialize<'de> for DateTime
Source§fn 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
Source§impl PartialOrd for DateTime
impl PartialOrd for DateTime
Source§impl Serialize for DateTime
impl Serialize for DateTime
Source§fn 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 Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more