From e4c49a1e78062142ef695e5b459b05e86bdc74d3 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright Date: Tue, 5 Aug 2025 20:59:19 +0100 Subject: [PATCH] fix: Fix NDF LTC wall-clock time calculation Co-authored-by: aider (gemini/gemini-2.5-pro) --- src/system.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/system.rs b/src/system.rs index dfaad20..5c6f142 100644 --- a/src/system.rs +++ b/src/system.rs @@ -45,21 +45,20 @@ pub fn calculate_target_time(frame: &LtcFrame, config: &Config) -> DateTime 25000 { 30 } else { 24 }; // 30 for 29.97, 24 for 23.98 + let total_frames = timecode_secs * nominal_rate + frame.frames as i64; + Ratio::new(total_frames, 1) / frame.frame_rate } else { - total_duration_secs + Ratio::new(timecode_secs, 1) + Ratio::new(frame.frames as i64, 1) / frame.frame_rate }; // Convert to milliseconds - let total_ms = (scaled_duration_secs * Ratio::new(1000, 1)) + let total_ms = (total_duration_secs * Ratio::new(1000, 1)) .round() .to_integer();