summaryrefslogtreecommitdiff
path: root/src/clock.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-09-12 00:31:08 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-09-12 00:31:08 -0400
commit5d76d0712e07040d9aeeebccb189d75636a07c7a (patch)
tree246eb2a68e23fef378686191c818d19ce0374071 /src/clock.rs
parent74ef9102a62f713f36f6f8412732be9d837d8d2c (diff)
Consolidate the (now) two definitions of DateTime.
Diffstat (limited to 'src/clock.rs')
-rw-r--r--src/clock.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/clock.rs b/src/clock.rs
index 84fcaf6..7757925 100644
--- a/src/clock.rs
+++ b/src/clock.rs
@@ -4,14 +4,16 @@ use axum::{
middleware::Next,
response::Response,
};
-use chrono::{DateTime, Utc};
+use chrono::Utc;
+
+pub type DateTime = chrono::DateTime<chrono::Utc>;
/// Extractor that provides the "current time" for a request. This time is calculated
/// once per request, even if the extractor is used in multiple places. This requires
/// the [middleware] function to be installed with [axum::middleware::from_fn] around
/// the current route.
#[derive(Clone)]
-pub struct RequestedAt(pub DateTime<Utc>);
+pub struct RequestedAt(pub DateTime);
impl RequestedAt {
fn now() -> Self {