mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-09 02:42:02 +00:00
fix: Account for drop-frame LTC in time calculation
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
parent
d13ffdc057
commit
22dc01e80f
4 changed files with 14 additions and 8 deletions
|
|
@ -32,7 +32,7 @@ pub fn start_serial_thread(
|
|||
|
||||
let reader = std::io::BufReader::new(port);
|
||||
let re = Regex::new(
|
||||
r"\[(LOCK|FREE)\]\s+(\d{2}):(\d{2}):(\d{2})[:;](\d{2})\s+\|\s+([\d.]+)fps",
|
||||
r"\[(LOCK|FREE)\]\s+(\d{2}):(\d{2}):(\d{2})([:;])(\d{2})\s+\|\s+([\d.]+)fps",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
@ -60,11 +60,12 @@ mod tests {
|
|||
use super::*;
|
||||
use std::sync::mpsc;
|
||||
use crate::sync_logic::LtcState;
|
||||
use num_rational::Ratio;
|
||||
use regex::Regex;
|
||||
|
||||
fn get_ltc_regex() -> Regex {
|
||||
Regex::new(
|
||||
r"\[(LOCK|FREE)\]\s+(\d{2}):(\d{2}):(\d{2})[:;](\d{2})\s+\|\s+([\d.]+)fps",
|
||||
r"\[(LOCK|FREE)\]\s+(\d{2}):(\d{2}):(\d{2})([:;])(\d{2})\s+\|\s+([\d.]+)fps",
|
||||
).unwrap()
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +120,7 @@ mod tests {
|
|||
assert_eq!(st.free_count, 1);
|
||||
let received_frame = rx.try_recv().unwrap();
|
||||
assert_eq!(received_frame.status, "FREE");
|
||||
assert_eq!(received_frame.frame_rate, 29.97);
|
||||
assert_eq!(received_frame.frame_rate, Ratio::new(30000, 1001));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue