diff --git a/src/db/user.rs b/src/db/user.rs index f0baa80..2390175 100644 --- a/src/db/user.rs +++ b/src/db/user.rs @@ -1,5 +1,5 @@ use diesel::{prelude::*, insert_into, update}; -use chrono::{NaiveDateTime, Local}; +use chrono::{NaiveDateTime, Utc}; use crate::{logging::{LogLevel, log}, db::{connect, get_hashed_uid}}; #[derive(Insertable, Selectable, Queryable, Debug, Clone, Default)] @@ -103,7 +103,7 @@ pub fn regen_fake_id(user_id: &u64, new_fake_id: i64) { } let mut conn = conn.unwrap(); let uid: String = get_hashed_uid(user_id); - let now: NaiveDateTime = Local::now().naive_local(); + let now: NaiveDateTime = Utc::now().naive_utc(); let _ = conn.transaction(|c| { let sql = update(user) diff --git a/src/handlers.rs b/src/handlers.rs index abe6d9b..5485a73 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -3,7 +3,7 @@ use serde::ser::StdError; use poise::serenity_prelude::ChannelId; use poise::serenity_prelude::{self as serenity}; use rand::seq::SliceRandom; -use chrono::{NaiveDateTime, Local}; +use chrono::{NaiveDateTime, Utc}; use crate::{logging::{LogLevel, log}, config::CORE_CFG, db::user::*}; @@ -36,7 +36,7 @@ pub async fn handle_msg(ctx: &serenity::Context, msg: &serenity::Message) -> Res return Ok(()) } - let now: NaiveDateTime = Local::now().naive_local(); + let now: NaiveDateTime = Utc::now().naive_utc(); if usr.when_generated.timestamp() + 86400 < now.timestamp() { let fid: i64 = rand::thread_rng().gen_range(10000000..=99999999); log(LogLevel::Info, "event_handlers", "handle_msg", format!("Regenerate fake ID {}", fid).as_str());