use local timestamp for log
This commit is contained in:
parent
fa75cf3169
commit
b2e84d727c
@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS "user_trip" (
|
||||
CREATE TABLE IF NOT EXISTS "log" (
|
||||
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"msg" text NOT NULL,
|
||||
"created_at" text NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "location" (
|
||||
|
@ -1,10 +1,11 @@
|
||||
use chrono::{DateTime, Local, NaiveDateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{FromRow, SqlitePool};
|
||||
|
||||
#[derive(FromRow, Debug, Serialize, Deserialize)]
|
||||
pub struct Log {
|
||||
pub msg: String,
|
||||
pub created_at: String,
|
||||
pub created_at: NaiveDateTime,
|
||||
}
|
||||
|
||||
impl Log {
|
||||
@ -40,8 +41,10 @@ LIMIT 1000
|
||||
<description>An RSS feed with activities from app.rudernlinz.at</description>"#,
|
||||
);
|
||||
for log in Self::last(db).await {
|
||||
let utc_time: DateTime<Utc> = DateTime::from_utc(log.created_at, Utc);
|
||||
let local_time = utc_time.with_timezone(&Local);
|
||||
ret.push_str("<item><title>");
|
||||
ret.push_str(&format!("({}) {}", log.created_at, log.msg));
|
||||
ret.push_str(&format!("({}) {}", local_time, log.msg));
|
||||
ret.push_str("</title></item>");
|
||||
}
|
||||
ret.push_str("</channel>");
|
||||
|
Loading…
Reference in New Issue
Block a user