change when_generated to use UTC

This commit is contained in:
Hay1tsme 2023-11-16 22:53:27 -05:00
parent 0f25a2dfea
commit e18212fd09
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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());