Skip to content

Commit

Permalink
Appease Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
luckysori committed Apr 24, 2024
1 parent e0588e8 commit 3b5bfe8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions p2pd-oracle-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern crate reqwest;
extern crate secp256k1_zkp;
extern crate serde;

use chrono::{DateTime, NaiveDateTime, SecondsFormat, Utc};
use chrono::{DateTime, SecondsFormat, Utc};
use dlc_manager::error::Error as DlcManagerError;
use dlc_manager::Oracle;
use dlc_messages::oracle_msgs::{OracleAnnouncement, OracleAttestation};
Expand Down Expand Up @@ -132,10 +132,9 @@ fn parse_event_id(event_id: &str) -> Result<(String, DateTime<Utc>), DlcManagerE
let timestamp: i64 = timestamp_str
.parse()
.map_err(|_| DlcManagerError::OracleError("Invalid timestamp format".to_string()))?;
let naive_date_time = NaiveDateTime::from_timestamp_opt(timestamp, 0).ok_or_else(|| {
let date_time = DateTime::<Utc>::from_timestamp(timestamp, 0).ok_or_else(|| {
DlcManagerError::InvalidParameters(format!("Invalid timestamp {} in event id", timestamp))
})?;
let date_time = DateTime::from_naive_utc_and_offset(naive_date_time, Utc);
Ok((asset_id.to_string(), date_time))
}

Expand Down

0 comments on commit 3b5bfe8

Please sign in to comment.