From 77fb3beee738ce3d54474cb899182730aac4b647 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 07:19:38 -0700 Subject: [PATCH] Bump chrono from 0.4.28 to 0.4.30 (#4065) --- Cargo.lock | 42 ++++++++++++---------------------------- oximeter/db/src/model.rs | 5 +++-- oximeter/db/src/query.rs | 10 +++++++--- 3 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e1c52ee0a7..f6883ed551 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -919,16 +919,15 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.28" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", "windows-targets 0.48.5", ] @@ -1157,7 +1156,7 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ - "time 0.3.27", + "time", "version_check", ] @@ -6581,7 +6580,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.27", + "time", "yasna", ] @@ -7491,7 +7490,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros", - "time 0.3.27", + "time", ] [[package]] @@ -7779,7 +7778,7 @@ dependencies = [ "hostname", "slog", "slog-json", - "time 0.3.27", + "time", ] [[package]] @@ -7820,7 +7819,7 @@ dependencies = [ "serde", "serde_json", "slog", - "time 0.3.27", + "time", ] [[package]] @@ -7855,7 +7854,7 @@ dependencies = [ "slog", "term", "thread_local", - "time 0.3.27", + "time", ] [[package]] @@ -8432,17 +8431,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.27" @@ -8817,7 +8805,7 @@ dependencies = [ "radix_trie", "rand 0.8.5", "thiserror", - "time 0.3.27", + "time", "tokio", "tracing", "trust-dns-proto", @@ -8882,7 +8870,7 @@ dependencies = [ "futures-util", "serde", "thiserror", - "time 0.3.27", + "time", "tokio", "toml 0.5.11", "tracing", @@ -9321,7 +9309,7 @@ dependencies = [ "git2", "rustc_version 0.4.0", "rustversion", - "time 0.3.27", + "time", ] [[package]] @@ -9429,12 +9417,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -9975,7 +9957,7 @@ checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ "bit-vec", "num-bigint", - "time 0.3.27", + "time", ] [[package]] diff --git a/oximeter/db/src/model.rs b/oximeter/db/src/model.rs index ce38d5e229..f915917b27 100644 --- a/oximeter/db/src/model.rs +++ b/oximeter/db/src/model.rs @@ -224,7 +224,7 @@ impl From for DatumType { // nanoseconds in our case. We opt for strings here, since we're using that anyway in the // input/output format for ClickHouse. mod serde_timestamp { - use chrono::{DateTime, TimeZone, Utc}; + use chrono::{naive::NaiveDateTime, DateTime, Utc}; use serde::{self, Deserialize, Deserializer, Serializer}; pub fn serialize( @@ -245,7 +245,8 @@ mod serde_timestamp { D: Deserializer<'de>, { let s = String::deserialize(deserializer)?; - Utc.datetime_from_str(&s, crate::DATABASE_TIMESTAMP_FORMAT) + NaiveDateTime::parse_from_str(&s, crate::DATABASE_TIMESTAMP_FORMAT) + .map(|naive_date| naive_date.and_utc()) .map_err(serde::de::Error::custom) } } diff --git a/oximeter/db/src/query.rs b/oximeter/db/src/query.rs index 524ead0da5..847765951e 100644 --- a/oximeter/db/src/query.rs +++ b/oximeter/db/src/query.rs @@ -685,7 +685,7 @@ mod tests { use crate::FieldSchema; use crate::FieldSource; use crate::TimeseriesName; - use chrono::TimeZone; + use chrono::NaiveDateTime; use std::convert::TryFrom; #[test] @@ -844,10 +844,14 @@ mod tests { fn test_time_range() { let s = "2021-01-01 01:01:01.123456789"; let start_time = - Utc.datetime_from_str(s, crate::DATABASE_TIMESTAMP_FORMAT).unwrap(); + NaiveDateTime::parse_from_str(s, crate::DATABASE_TIMESTAMP_FORMAT) + .unwrap() + .and_utc(); let e = "2021-01-01 01:01:02.123456789"; let end_time = - Utc.datetime_from_str(e, crate::DATABASE_TIMESTAMP_FORMAT).unwrap(); + NaiveDateTime::parse_from_str(e, crate::DATABASE_TIMESTAMP_FORMAT) + .unwrap() + .and_utc(); let range = TimeRange { start: Some(Timestamp::Inclusive(start_time)), end: Some(Timestamp::Exclusive(end_time)),