diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-11-12 19:24:02 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2022-11-12 19:24:48 +0300 |
commit | 3094bd96dfba5139e558b6f78cea089ca74fcc3f (patch) | |
tree | 817f762e755cbc77b0d2fdc10d9ba2cb696ba98c /version-helper | |
parent | 37cb63614033f5ef915e920f7d1d521b68b5f882 (diff) |
version-helper: Update for deprecated chrono functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/978>
Diffstat (limited to 'version-helper')
-rw-r--r-- | version-helper/Cargo.toml | 2 | ||||
-rw-r--r-- | version-helper/src/lib.rs | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/version-helper/Cargo.toml b/version-helper/Cargo.toml index 971eb87e0..69b0a1d1a 100644 --- a/version-helper/Cargo.toml +++ b/version-helper/Cargo.toml @@ -13,4 +13,4 @@ edition = "2021" rust-version = "1.63" [dependencies] -chrono = { version = "0.4.19", default-features = false, features = ["std", "clock"] } +chrono = { version = "0.4.23", default-features = false, features = ["std", "clock"] } diff --git a/version-helper/src/lib.rs b/version-helper/src/lib.rs index ccd90f633..cc7455d78 100644 --- a/version-helper/src/lib.rs +++ b/version-helper/src/lib.rs @@ -85,10 +85,12 @@ fn cargo_mtime_date(crate_dir: path::PathBuf) -> Option<chrono::DateTime<chrono: let metadata = fs::metadata(&cargo_toml).ok()?; let mtime = metadata.modified().ok()?; let unix_time = mtime.duration_since(SystemTime::UNIX_EPOCH).ok()?; - let dt = chrono::Utc.timestamp(unix_time.as_secs().try_into().ok()?, 0); + let dt = chrono::Utc + .timestamp_opt(unix_time.as_secs().try_into().ok()?, 0) + .latest()?; // FIXME: Work around https://github.com/rust-lang/cargo/issues/10285 - if dt.date().year() < 2015 { + if dt.date_naive().year() < 2015 { return None; } |