From 2e5d031d1c642f99d405dcbefe3efac41d5eb346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Garc=C3=ADa=20Amor?= Date: Wed, 6 Nov 2024 13:40:49 +0100 Subject: [PATCH] Fixes chrono warnings (#49) --- Cargo.toml | 2 +- src/api/get_snapshot.rs | 2 +- src/server.rs | 4 ++-- src/storage/sqlite.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f1530c1..b9f5a9c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ clap = { version = "^4.5.6", features = ["string"] } log = "^0.4.17" env_logger = "^0.11.5" rusqlite = { version = "0.32", features = ["bundled"] } -chrono = { version = "^0.4.22", features = ["serde"] } +chrono = { version = "^0.4.38", features = ["serde"] } [dev-dependencies] actix-rt = "2" diff --git a/src/api/get_snapshot.rs b/src/api/get_snapshot.rs index 1776ef5..e5a4dc5 100644 --- a/src/api/get_snapshot.rs +++ b/src/api/get_snapshot.rs @@ -89,7 +89,7 @@ mod test { Snapshot { version_id, versions_since: 3, - timestamp: Utc.ymd(2001, 9, 9).and_hms(1, 46, 40), + timestamp: Utc.with_ymd_and_hms(2001, 9, 9, 1, 46, 40).unwrap(), }, snapshot_data.clone(), ) diff --git a/src/server.rs b/src/server.rs index b0c6517..e880778 100644 --- a/src/server.rs +++ b/src/server.rs @@ -921,7 +921,7 @@ mod test { Snapshot { version_id: version_ids[2], versions_since: 2, - timestamp: Utc.ymd(2001, 9, 9).and_hms(1, 46, 40), + timestamp: Utc.with_ymd_and_hms(2001, 9, 9, 1, 46, 40).unwrap(), }, vec![1, 2, 3], )?; @@ -997,7 +997,7 @@ mod test { Snapshot { version_id: snapshot_version_id, versions_since: 3, - timestamp: Utc.ymd(2001, 9, 9).and_hms(1, 46, 40), + timestamp: Utc.with_ymd_and_hms(2001, 9, 9, 1, 46, 40).unwrap(), }, data.clone(), )?; diff --git a/src/storage/sqlite.rs b/src/storage/sqlite.rs index ad5bf7d..3e05b3c 100644 --- a/src/storage/sqlite.rs +++ b/src/storage/sqlite.rs @@ -150,7 +150,7 @@ impl StorageTxn for Txn { ) { (Some(ts), Some(vs), Some(v)) => Some(Snapshot { version_id: v.0, - timestamp: Utc.timestamp(ts, 0), + timestamp: Utc.timestamp_opt(ts, 0).unwrap(), versions_since: vs, }), _ => None,