diff --git a/src/routes/api_v1.rs b/src/routes/api_v1.rs index a895739..aa90722 100644 --- a/src/routes/api_v1.rs +++ b/src/routes/api_v1.rs @@ -8,13 +8,22 @@ use serde::Serialize; /// Response for /love #[derive(Serialize)] struct InfoLove { - unix_epoch: u32, + unix_epoch: u64, + since: String, } #[get("/love")] pub async fn love() -> impl Responder { + let target = 1_605_576_600; + let current_time: u64 = Utc::now().timestamp().try_into().unwrap(); + HttpResponse::Ok().json(InfoLove { - unix_epoch: 1_605_576_600, + unix_epoch: target, + since: { + let duration_epoch = current_time - target; + let duration = Duration::from_secs(duration_epoch); + format_duration(duration).to_string() + }, }) }