From 3a2dc1f2741f7bf4d72c1cbe0fd1993af157ceaa Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Sun, 25 Feb 2024 20:50:50 +0100 Subject: Closes #5. Eta works --- src/requests/start.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/requests/start.rs') diff --git a/src/requests/start.rs b/src/requests/start.rs index d07177e..3afbe3a 100644 --- a/src/requests/start.rs +++ b/src/requests/start.rs @@ -121,12 +121,18 @@ async fn status_socket( } } -fn get_eta(msg: &str, uuid: &str) -> Result { +fn get_eta(msg: &str, uuid: &str) -> Result { let spl: Vec<&str> = msg.split('_').collect(); if (spl[0] != "eta") || (spl[2] != uuid) { return Err(Error::WsResponse); }; - Ok(spl[1].parse()?) + let input: u64 = spl[1].parse()?; + + let sec = input % 60; + let min = (input / 60) % 60; + let hou = (input / (60 * 60)) % 60; + + Ok(format!("{hou:0>2}:{min:0>2}:{sec:0>2}")) } fn verify_response(res: &str, org_uuid: &str) -> Result { -- cgit v1.2.3