Skip to content

Commit

Permalink
copyright: fix chrono deprecation
Browse files Browse the repository at this point in the history
and use the recommended alternative. it has been deprecated since chrono
0.4.27[0]

0: https://github.com/chronotope/chrono/releases/tag/v0.4.27
1: chronotope/chrono#1175

Signed-off-by: Fabian Grünbichler <debian@fabian.gruenbichler.email>
  • Loading branch information
Fabian Grünbichler committed Oct 25, 2023
1 parent 7e25919 commit 50151b7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/debian/copyright.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cargo::core::manifest;
use chrono::{DateTime, Datelike, NaiveDateTime, Utc};
use chrono::{Datelike, NaiveDateTime, TimeZone, Utc};
use git2::Repository;
use regex;
use tempfile;
Expand Down Expand Up @@ -318,19 +318,19 @@ fn copyright_fromgit(repo_url: &str) -> Result<String> {
let first_commit = repo.find_commit(first_id)?;
let latest_commit = repo.find_commit(latest_id)?;

let first_year = DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(first_commit.time().seconds(), 0)
.ok_or(anyhow::Error::msg("lo"))?,
Utc,
)
.year();

let latest_year = DateTime::<Utc>::from_utc(
NaiveDateTime::from_timestamp_opt(latest_commit.time().seconds(), 0)
.ok_or(anyhow::Error::msg("lo"))?,
Utc,
)
.year();
let first_year = Utc
.from_utc_datetime(
&NaiveDateTime::from_timestamp_opt(first_commit.time().seconds(), 0)
.ok_or(anyhow::Error::msg("lo"))?,
)
.year();

let latest_year = Utc
.from_utc_datetime(
&NaiveDateTime::from_timestamp_opt(latest_commit.time().seconds(), 0)
.ok_or(anyhow::Error::msg("lo"))?,
)
.year();

let notice = match first_year.cmp(&latest_year) {
Ordering::Equal => format!("{}", first_year),
Expand Down

0 comments on commit 50151b7

Please sign in to comment.