diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-07-26 03:40:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-26 01:40:09 +0000 |
| commit | 67de67a1062eae7bbd9bc1ac228f75263f5ac104 (patch) | |
| tree | de8ce9153b3c7f0662cc91bb4877c9db09d41e77 /cli | |
| parent | 28f6c400051a91d4125e7b589821655581ae49fa (diff) | |
chore: update chrono dependency (#19943)
Pulled from https://github.com/denoland/deno/pull/19747
Authored-by: Cooper Benson <skycoop@gmail.com>
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/Cargo.toml | 2 | ||||
| -rw-r--r-- | cli/util/time.rs | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 604f9dfbe..2306d4333 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -60,7 +60,7 @@ base32 = "=0.4.0" base64.workspace = true bincode = "=1.3.3" cache_control.workspace = true -chrono = { version = "=0.4.22", default-features = false, features = ["std"] } +chrono = { version = "=0.4.26", default-features = false, features = ["std"] } clap = { version = "=4.3.3", features = ["string"] } clap_complete = "=4.3.1" clap_complete_fig = "=4.3.1" diff --git a/cli/util/time.rs b/cli/util/time.rs index 9c5b48b57..5c1a89d48 100644 --- a/cli/util/time.rs +++ b/cli/util/time.rs @@ -14,9 +14,10 @@ pub fn utc_now() -> chrono::DateTime<chrono::Utc> { let now = std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .expect("system time before Unix epoch"); - let naive = chrono::NaiveDateTime::from_timestamp( + let naive = chrono::NaiveDateTime::from_timestamp_opt( now.as_secs() as i64, now.subsec_nanos(), - ); + ) + .unwrap(); chrono::DateTime::from_utc(naive, chrono::Utc) } |
