Skip to content

Commit

Permalink
Don't use deprecated functions from chrono.
Browse files Browse the repository at this point in the history
  - `chrono::NaiveDateTime::from_timestamp_opts` is deprecated and
    replaced by `DateTime::from_timestamp`.  Use the later.
  • Loading branch information
nwalfield committed Jul 9, 2024
1 parent 61001d1 commit 6cf200a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ use libc::{

use chrono::{
DateTime,
NaiveDateTime,
TimeZone,
Utc,
};

Expand Down Expand Up @@ -1995,12 +1993,11 @@ fn dump_packets(pkts: &[u8]) -> Result<()> {
// treats it as an absolute time. As we're going
// for bug-for-bug compatibility here, we do the
// same.
let t = NaiveDateTime::from_timestamp_opt(
let t = DateTime::from_timestamp(
d.as_secs() as i64, 0)
// This is just compatibility, debugging
// output. Fallback to the unix epoch.
.unwrap_or_default();
let t = Utc::from_utc_datetime(&Utc, &t);
output.push(format!(" {}(0x{:08x})",
t.format("%c"),
d.as_secs()));
Expand Down

0 comments on commit 6cf200a

Please sign in to comment.