diff --git a/standards/smi/src/v2.rs b/standards/smi/src/v2.rs index 45a5aa87..fed080f9 100644 --- a/standards/smi/src/v2.rs +++ b/standards/smi/src/v2.rs @@ -3,8 +3,6 @@ use alloc::string::ToString; use core::convert::TryInto; -use chrono::TimeZone; - use rasn::{ prelude::*, types::{Integer, ObjectIdentifier, OctetString, Oid, Utf8String}, @@ -29,22 +27,19 @@ pub type Opaque = crate::v1::Opaque; #[rasn(delegate, tag(application, 6))] pub struct Counter64(pub u64); -pub const ORG: &'static Oid = Oid::ISO_IDENTIFIED_ORGANISATION; -pub const DOD: &'static Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD; -pub const INTERNET: &'static Oid = crate::v1::INTERNET; -pub const DIRECTORY: &'static Oid = crate::v1::DIRECTORY; -pub const MGMT: &'static Oid = crate::v1::MGMT; -pub const EXPERIMENTAL: &'static Oid = crate::v1::EXPERIMENTAL; -pub const PRIVATE: &'static Oid = crate::v1::PRIVATE; -pub const ENTERPRISES: &'static Oid = crate::v1::ENTERPRISES; -pub const SECURITY: &'static Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SECURITY; -pub const SNMP_V2: &'static Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2; -pub const SNMP_DOMAINS: &'static Oid = - Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2_DOMAINS; -pub const SNMP_PROXIES: &'static Oid = - Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2_PROXIES; -pub const SNMP_MODULES: &'static Oid = - Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2_MODULES; +pub const ORG: &Oid = Oid::ISO_IDENTIFIED_ORGANISATION; +pub const DOD: &Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD; +pub const INTERNET: &Oid = crate::v1::INTERNET; +pub const DIRECTORY: &Oid = crate::v1::DIRECTORY; +pub const MGMT: &Oid = crate::v1::MGMT; +pub const EXPERIMENTAL: &Oid = crate::v1::EXPERIMENTAL; +pub const PRIVATE: &Oid = crate::v1::PRIVATE; +pub const ENTERPRISES: &Oid = crate::v1::ENTERPRISES; +pub const SECURITY: &Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SECURITY; +pub const SNMP_V2: &Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2; +pub const SNMP_DOMAINS: &Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2_DOMAINS; +pub const SNMP_PROXIES: &Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2_PROXIES; +pub const SNMP_MODULES: &Oid = Oid::ISO_IDENTIFIED_ORGANISATION_DOD_INTERNET_SNMP_V2_MODULES; const FULL_DATE_FORMAT: &str = "%Y%m%d%H%MZ"; const SHORT_DATE_FORMAT: &str = "%y%m%d%H%MZ"; @@ -117,10 +112,10 @@ impl Decode for ExtUtcTime { let string = Utf8String::from_utf8_lossy(&bytes); - if let Ok(time) = chrono::Utc.datetime_from_str(&string, FULL_DATE_FORMAT) { - Ok(Self(time)) - } else if let Ok(time) = chrono::Utc.datetime_from_str(&string, SHORT_DATE_FORMAT) { - Ok(Self(time)) + if let Ok(time) = chrono::DateTime::parse_from_str(&string, FULL_DATE_FORMAT) { + Ok(Self(time.into())) + } else if let Ok(time) = chrono::DateTime::parse_from_str(&string, SHORT_DATE_FORMAT) { + Ok(Self(time.into())) } else { (error)() }