mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
feat: display clock delta history in UI
Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
This commit is contained in:
parent
7738d14097
commit
b803de93de
3 changed files with 9 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ struct ApiStatus {
|
|||
ntp_active: bool,
|
||||
interfaces: Vec<String>,
|
||||
hardware_offset_ms: i64,
|
||||
clock_delta_history: Vec<i64>,
|
||||
}
|
||||
|
||||
// AppState to hold shared data
|
||||
|
|
@ -76,6 +77,8 @@ async fn get_status(data: web::Data<AppState>) -> impl Responder {
|
|||
.map(|ifa| ifa.ip().to_string())
|
||||
.collect();
|
||||
|
||||
let clock_delta_history: Vec<i64> = state.clock_delta_history.iter().cloned().collect();
|
||||
|
||||
HttpResponse::Ok().json(ApiStatus {
|
||||
ltc_status,
|
||||
ltc_timecode,
|
||||
|
|
@ -89,6 +92,7 @@ async fn get_status(data: web::Data<AppState>) -> impl Responder {
|
|||
ntp_active,
|
||||
interfaces,
|
||||
hardware_offset_ms: hw_offset_ms,
|
||||
clock_delta_history,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -215,6 +219,7 @@ mod tests {
|
|||
assert_eq!(resp.ltc_timecode, "01:02:03:04");
|
||||
assert_eq!(resp.frame_rate, "25.00fps");
|
||||
assert_eq!(resp.hardware_offset_ms, 10);
|
||||
assert_eq!(resp.clock_delta_history, vec![4, 5, 6]);
|
||||
}
|
||||
|
||||
#[actix_web::test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue