Devices can request current time with a precision to the millisecond
This commit is contained in:
central_backend/src
1
central_backend/src/server/devices_api/mod.rs
Normal file
1
central_backend/src/server/devices_api/mod.rs
Normal file
@ -0,0 +1 @@
|
||||
pub mod utils_controller;
|
15
central_backend/src/server/devices_api/utils_controller.rs
Normal file
15
central_backend/src/server/devices_api/utils_controller.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use crate::server::custom_error::HttpResult;
|
||||
use crate::utils::time_utils::time_millis;
|
||||
use actix_web::HttpResponse;
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
pub struct CurrTime {
|
||||
time_ms: u128,
|
||||
}
|
||||
|
||||
/// Get current time
|
||||
pub async fn curr_time() -> HttpResult {
|
||||
Ok(HttpResponse::Ok().json(CurrTime {
|
||||
time_ms: time_millis(),
|
||||
}))
|
||||
}
|
Reference in New Issue
Block a user