aboutsummaryrefslogtreecommitdiff
path: root/src/database/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/types.rs')
-rw-r--r--src/database/types.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/database/types.rs b/src/database/types.rs
index 429efb8..96efd7b 100644
--- a/src/database/types.rs
+++ b/src/database/types.rs
@@ -1,15 +1,15 @@
use serde::{Serialize, Deserialize};
-use std::time::SystemTime;
+use chrono::Utc;
#[derive(Deserialize, Serialize, Copy, Clone, Debug)]
// Date is the seconds from UNIX_EPOCH
pub struct Date(u64);
impl Date {
pub fn now() -> Date {
+ // Get the current time in utc as seconds
+ let time = Utc::now().timestamp().try_into().unwrap_or(0);
Date(
- SystemTime::now()
- .duration_since(SystemTime::UNIX_EPOCH).unwrap()
- .as_secs()
+ time
)
}
}