From fcde98d1a1b5d422307ee8f7446c19bf9ef3bbbf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 13:53:30 +0000 Subject: [PATCH] Bump chrono from 0.4.26 to 0.4.27 (#27) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rob Ede --- .vscode/settings.json | 2 ++ Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/util.rs | 6 ++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f8e24d0..0c0de97 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,8 @@ { "cSpell.words": [ "byteorder", + "chrono", + "datetime", "extn", "itertools", "memchr", diff --git a/Cargo.lock b/Cargo.lock index 94c6b45..3690ce4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,15 +55,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "winapi", + "windows-targets", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8bcb030..34d6721 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] byteorder = "1" -chrono = { version = "0.4.26", default-features = false, features = ["clock", "serde"] } +chrono = { version = "0.4.27", default-features = false, features = ["clock", "serde"] } const-oid = { version = "0.9", features = ["std", "db"] } ct-sct = "0.1" der = { version = "0.7", features = ["std"] } diff --git a/src/util.rs b/src/util.rs index 562b4d5..44f2ea5 100644 --- a/src/util.rs +++ b/src/util.rs @@ -2,6 +2,7 @@ use std::io::Read; +use chrono::TimeZone as _; use const_oid::{ db::{rfc5280, rfc5912, Database, DB}, ObjectIdentifier, @@ -53,10 +54,7 @@ pub(crate) fn duration_since_now_fmt(time: x509_cert::time::Time) -> String { let ts = time.to_unix_duration().as_secs() as i64; - let date = DateTime::::from_utc( - chrono::NaiveDateTime::from_timestamp_opt(ts, 0).unwrap(), - Utc, - ); + let date = Utc.from_utc_datetime(&chrono::NaiveDateTime::from_timestamp_opt(ts, 0).unwrap()); let now = Utc::now(); let duration = if now > date { now - date } else { date - now };