diff --git a/giterated-daemon/src/backend/git/branches.rs b/giterated-daemon/src/backend/git/branches.rs index 799dd8e..0e56e38 100644 --- a/giterated-daemon/src/backend/git/branches.rs +++ b/giterated-daemon/src/backend/git/branches.rs @@ -61,7 +61,6 @@ impl GitBackend { }; let stale = chrono::Utc::now() - .naive_utc() .signed_duration_since(commit.time) .num_seconds() > stale_after.into(); @@ -172,7 +171,6 @@ impl GitBackend { let stale = if let Some(ref last_commit) = last_commit { chrono::Utc::now() - .naive_utc() .signed_duration_since(last_commit.time) .num_seconds() > stale_after.into() diff --git a/giterated-models/src/repository/mod.rs b/giterated-models/src/repository/mod.rs index 5573e31..e304fc3 100644 --- a/giterated-models/src/repository/mod.rs +++ b/giterated-models/src/repository/mod.rs @@ -1,7 +1,7 @@ use std::fmt::{Display, Formatter}; use std::str::FromStr; -use chrono::NaiveDateTime; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use crate::object::GiteratedObject; @@ -190,7 +190,7 @@ pub struct RepositoryTag { /// Signature of the tag author pub author: Option, /// Time the tag or pointed commit was created - pub time: Option, + pub time: Option>, /// Commit the tag is pointing to pub commit: Option, } @@ -403,7 +403,7 @@ pub struct Commit { /// Who committed the commit pub committer: CommitSignature, /// Time when the commit happened - pub time: chrono::NaiveDateTime, + pub time: chrono::DateTime, } /// Gets all info from [`git2::Commit`] for easy use @@ -427,7 +427,7 @@ impl From> for Commit { .collect::>(), author: commit.author().into(), committer: commit.committer().into(), - time: chrono::NaiveDateTime::from_timestamp_opt(commit.time().seconds(), 0).unwrap(), + time: chrono::DateTime::from_timestamp(commit.time().seconds(), 0).unwrap(), } } } @@ -437,7 +437,7 @@ impl From> for Commit { pub struct CommitSignature { pub name: Option, pub email: Option, - pub time: chrono::NaiveDateTime, + pub time: chrono::DateTime, } /// Converts the signature from git2 into something usable without explicit lifetimes. @@ -446,7 +446,7 @@ impl From> for CommitSignature { Self { name: signature.name().map(|name| name.to_string()), email: signature.email().map(|email| email.to_string()), - time: chrono::NaiveDateTime::from_timestamp_opt(signature.when().seconds(), 0).unwrap(), + time: chrono::DateTime::from_timestamp(signature.when().seconds(), 0).unwrap(), } } }