Skip to content

Commit

Permalink
Bump chrono from 0.4.28 to 0.4.30 (#4065)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Sep 12, 2023
1 parent 8c0de1a commit 77fb3be
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 35 deletions.
42 changes: 12 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions oximeter/db/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl From<DbDatumType> 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<S>(
Expand All @@ -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)
}
}
Expand Down
10 changes: 7 additions & 3 deletions oximeter/db/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)),
Expand Down

0 comments on commit 77fb3be

Please sign in to comment.