aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/database/types.rs8
3 files changed, 6 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock
index f211f99..91f7432 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1143,7 +1143,7 @@ dependencies = [
[[package]]
name = "rocket_test"
-version = "0.2.1"
+version = "0.2.2"
dependencies = [
"chrono",
"rocket",
diff --git a/Cargo.toml b/Cargo.toml
index 515f4ba..09c8487 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rocket_test"
-version = "0.2.1"
+version = "0.2.2"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
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
)
}
}