Skip to content

Commit

Permalink
node-data: fix deprecated use of `chrono::NaiveDateTime::from_timesta…
Browse files Browse the repository at this point in the history
…mp_opt`
  • Loading branch information
Eduardo Leegwater Simões authored and herr-seppia committed Mar 8, 2024
1 parent 87e2c44 commit adc2868
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions node-data/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,9 @@ pub struct Header {

impl std::fmt::Debug for Header {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let timestamp = chrono::NaiveDateTime::from_timestamp_opt(
self.timestamp as i64,
0,
)
.map_or_else(
|| "unknown".to_owned(),
|v| {
chrono::DateTime::<chrono::Utc>::from_naive_utc_and_offset(
v,
chrono::Utc,
)
.to_rfc2822()
},
);
let timestamp =
chrono::DateTime::from_timestamp(self.timestamp as i64, 0)
.map_or_else(|| "unknown".to_owned(), |v| v.to_rfc2822());

f.debug_struct("Header")
.field("version", &self.version)
Expand Down

0 comments on commit adc2868

Please sign in to comment.