diff options
author | Lukasz Woznicki <lukasz.woznicki@softwareag.com> | 2022-02-10 00:08:29 +0000 |
---|---|---|
committer | Lukasz Woznicki <lukasz.woznicki@softwareag.com> | 2022-02-11 14:43:33 +0000 |
commit | 0a4e9be259af0125c44394cb0e1463f85d1c7930 (patch) | |
tree | 8f73f7c4747bd2621ef5350b20b14867216d1a73 /crates/core/tedge_mapper/src/sm_c8y_mapper/http_proxy.rs | |
parent | 195e81d86bceaa1c55cde0a5a91868bfe2326963 (diff) |
Use 'time' instead of 'chrono' due to CVE for c8y_smartrest and all dependent crates
Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
Diffstat (limited to 'crates/core/tedge_mapper/src/sm_c8y_mapper/http_proxy.rs')
-rw-r--r-- | crates/core/tedge_mapper/src/sm_c8y_mapper/http_proxy.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/core/tedge_mapper/src/sm_c8y_mapper/http_proxy.rs b/crates/core/tedge_mapper/src/sm_c8y_mapper/http_proxy.rs index cababb50..4013bc0a 100644 --- a/crates/core/tedge_mapper/src/sm_c8y_mapper/http_proxy.rs +++ b/crates/core/tedge_mapper/src/sm_c8y_mapper/http_proxy.rs @@ -5,7 +5,6 @@ use crate::sm_c8y_mapper::json_c8y::{ use crate::sm_c8y_mapper::mapper::SmartRestLogEvent; use async_trait::async_trait; use c8y_smartrest::smartrest_deserializer::SmartRestJwtResponse; -use chrono::{DateTime, Local}; use mqtt_channel::{Connection, PubChannel, StreamExt, Topic, TopicFilter}; use reqwest::Url; use std::time::Duration; @@ -13,6 +12,7 @@ use tedge_config::{ C8yUrlSetting, ConfigSettingAccessor, ConfigSettingAccessorStringExt, DeviceIdSetting, MqttPortSetting, TEdgeConfig, }; +use time::{format_description, OffsetDateTime}; use tracing::{error, info, instrument}; const RETRY_TIMEOUT_SECS: u64 = 60; @@ -200,16 +200,18 @@ impl JwtAuthHttpProxy { /// Make a POST request to /event/events and return the event id from response body. /// The event id is used to upload the binary. fn create_log_event(&self) -> C8yCreateEvent { - let local: DateTime<Local> = Local::now(); + let local = OffsetDateTime::now_utc(); let c8y_managed_object = C8yManagedObject { id: self.end_point.c8y_internal_id.clone(), }; C8yCreateEvent::new( - c8y_managed_object.to_owned(), + c8y_managed_object, "c8y_Logfile", - &local.format("%Y-%m-%dT%H:%M:%SZ").to_string(), + &local + .format(&format_description::well_known::Rfc3339) + .unwrap(), "software-management", ) } |