From a6523bf1052c7abb1a18008ac75a077b6e033cf8 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Fri, 18 Jul 2025 12:50:53 +0100 Subject: [PATCH 01/18] CD/CI git build workflow and unit testing + dependabot intergration for security updates --- .github/dependabot.yml | 6 +++ .github/workflows/build.yml | 70 ++++++++++++++++++++++++++++ .gitignore | 19 +++++++- Cargo.toml | 4 +- README.md | 7 ++- src/sync_logic.rs | 91 ++++++++++++++++++++++++++++++++----- 6 files changed, 182 insertions(+), 15 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ff82f28 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" # Location of Cargo.toml + schedule: + interval: "weekly" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..596ae03 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +name: Build for Raspberry Pi + +on: + push: + branches: + - main + pull_request: + branches: + - main + +env: + CARGO_TERM_COLOR: always + # Target for 64-bit Raspberry Pi (Raspberry Pi OS) + RUST_TARGET: aarch64-unknown-linux-gnu + +jobs: + build: + name: Build for aarch64 + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ env.RUST_TARGET }} + + + + - name: Install cross-compilation dependencies + run: | + sudo dpkg --add-architecture arm64 + # Configure sources for ARM64 packages - all ARM64 packages come from ports.ubuntu.com + sudo tee /etc/apt/sources.list.d/arm64.list > /dev/null <<'EOF' + deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse + deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe multiverse + deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse + deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted universe multiverse + EOF + # Modify existing sources to exclude arm64 architecture + sudo sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list + sudo apt-get update -y + # Install build tools and cross-compilation libraries for Raspberry Pi 5 + sudo apt-get install -y gcc-aarch64-linux-gnu libudev-dev:arm64 pkg-config cmake libudev-dev + # Ensure pkg-config can find ARM64 libraries + sudo apt-get install -y libpkgconf3:arm64 + - name: Install Rust dependencies + run: cargo fetch --target ${{ env.RUST_TARGET }} + - name: Build release binary + run: cargo build --release --target ${{ env.RUST_TARGET }} + env: + # Set linker for the target + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + # Configure pkg-config for cross-compilation + PKG_CONFIG_ALLOW_CROSS: 1 + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_LIBDIR: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_SYSROOT_DIR: / + PKG_CONFIG_ALLOW_SYSTEM_LIBS: 1 + PKG_CONFIG_ALLOW_SYSTEM_CFLAGS: 1 + # Add library path for the cross-compiler's linker + RUSTFLAGS: -L/usr/lib/aarch64-linux-gnu + - name: Run tests on native platform + run: cargo test --release --bin ntp_timeturner + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: timeturner-aarch64 + path: target/${{ env.RUST_TARGET }}/release/ntp_timeturner diff --git a/.gitignore b/.gitignore index 9491a2f..0c5fc70 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,21 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd +.aider* +# Generated by Cargo +# will have compiled files and executables +debug +target +# These are backup files generated by rustfmt +**/*.rs.bk +# MSVC Windows builds of rustc generate these, which store debugging information +# Generated by cargo mutants +# Contains mutation testing data +**/mutants.out*/ +# RustRover +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/Cargo.toml b/Cargo.toml index fc040de..8f7f726 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" [dependencies] serialport = "4.2" chrono = "0.4" -crossterm = "0.27" +crossterm = "0.29" regex = "1.11" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -notify = "5.1.0" \ No newline at end of file +notify = "8.1.0" \ No newline at end of file diff --git a/README.md b/README.md index 738f128..1d48356 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,13 @@ Inspired by the TimeTurner in the Harry Potter series, this project synchronises --- -## 🚀 Installation +## 🚀 Installation (to update) + +For Rust install you can do +```bash +cargo install --git https://github.com/cjfranko/NTP-Timeturner +``` Clone and run the installer: ```bash diff --git a/src/sync_logic.rs b/src/sync_logic.rs index f2a0e2b..c96bb0c 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -77,6 +77,17 @@ impl LtcState { match frame.status.as_str() { "LOCK" => { self.lock_count += 1; + + // Every 5 seconds, recompute whether HH:MM:SS matches local time + let now_secs = Utc::now().timestamp(); + if now_secs - self.last_match_check >= 5 { + self.last_match_status = if frame.matches_system_time() { + "IN SYNC".into() + } else { + "OUT OF SYNC".into() + }; + self.last_match_check = now_secs; + } } "FREE" => { self.free_count += 1; @@ -86,17 +97,6 @@ impl LtcState { _ => {} } - // Every 5 seconds, recompute whether HH:MM:SS matches local time - let now_secs = Utc::now().timestamp(); - if now_secs - self.last_match_check >= 5 { - self.last_match_status = if frame.matches_system_time() { - "IN SYNC".into() - } else { - "OUT OF SYNC".into() - }; - self.last_match_check = now_secs; - } - self.latest = Some(frame); } @@ -135,3 +135,72 @@ impl LtcState { &self.last_match_status } } + +#[cfg(test)] +mod tests { + use super::*; + use chrono::{Local, Utc}; + + fn get_test_frame(status: &str, h: u32, m: u32, s: u32) -> LtcFrame { + LtcFrame { + status: status.to_string(), + hours: h, + minutes: m, + seconds: s, + frames: 0, + frame_rate: 25.0, + timestamp: Utc::now(), + } + } + + #[test] + fn test_ltc_frame_matches_system_time() { + let now = Local::now(); + let frame = get_test_frame("LOCK", now.hour(), now.minute(), now.second()); + assert!(frame.matches_system_time()); + } + + #[test] + fn test_ltc_frame_does_not_match_system_time() { + let now = Local::now(); + // Create a time that is one hour ahead, wrapping around 23:00 + let different_hour = (now.hour() + 1) % 24; + let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); + assert!(!frame.matches_system_time()); + } + + #[test] + fn test_ltc_state_update_lock() { + let mut state = LtcState::new(); + let frame = get_test_frame("LOCK", 10, 20, 30); + state.update(frame); + assert_eq!(state.lock_count, 1); + assert_eq!(state.free_count, 0); + assert!(state.latest.is_some()); + } + + #[test] + fn test_ltc_state_update_free() { + let mut state = LtcState::new(); + state.record_offset(100); + assert!(!state.offset_history.is_empty()); + + let frame = get_test_frame("FREE", 10, 20, 30); + state.update(frame); + assert_eq!(state.lock_count, 0); + assert_eq!(state.free_count, 1); + assert!(state.offset_history.is_empty()); // Offsets should be cleared + assert_eq!(state.last_match_status, "UNKNOWN"); + } + + #[test] + fn test_offset_history_management() { + let mut state = LtcState::new(); + for i in 0..25 { + state.record_offset(i); + } + assert_eq!(state.offset_history.len(), 20); + assert_eq!(*state.offset_history.front().unwrap(), 5); // 0-4 are pushed out + assert_eq!(*state.offset_history.back().unwrap(), 24); + } +} From 9412c7452cf02d67a504c7514bf9f9f436142675 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Sat, 19 Jul 2025 15:33:35 +0100 Subject: [PATCH 02/18] ci: removed system test function from application as code for sync locking no longer exists, #[test] fn test_ltc_frame_does_not_match_system_time() { let now = Local::now(); // Create a time that is one hour ahead, wrapping around 23:00 let different_hour = (now.hour() + 1) % 24; let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); assert!(!frame.matches_system_time()); } --- Cargo.lock | 1720 +++++++++++++++++++++++++++++++++++++++++++++ src/sync_logic.rs | 9 - 2 files changed, 1720 insertions(+), 9 deletions(-) create mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..55d569d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1720 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.59.0", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +dependencies = [ + "serde", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytemuck" +version = "1.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.5.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "clock-steering" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2410abf030f2eb46cba840d343455078538e7c8755507b37ffd4074064f08f62" +dependencies = [ + "libc", +] + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "convert_case" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "crossterm" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" +dependencies = [ + "bitflags 2.9.1", + "crossterm_winapi", + "derive_more", + "document-features", + "mio", + "parking_lot", + "rustix", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "document-features" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" +dependencies = [ + "litrs", +] + +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "fixed" +version = "1.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707070ccf8c4173548210893a0186e29c266901b71ed20cd9e2ca0193dfe95c3" +dependencies = [ + "az", + "bytemuck", + "half", + "typenum", +] + +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "half" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "indexmap" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "inotify" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" +dependencies = [ + "bitflags 2.9.1", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + +[[package]] +name = "io-kit-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" +dependencies = [ + "core-foundation-sys", + "mach2", +] + +[[package]] +name = "io-uring" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "libc", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "kqueue" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libudev" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b324152da65df7bb95acfcaab55e3097ceaab02fb19b228a9eb74d55f135e0" +dependencies = [ + "libc", + "libudev-sys", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.59.0", +] + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "notify" +version = "8.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3163f59cd3fa0e9ef8c32f242966a7b9994fd7378366099593e0e73077cd8c97" +dependencies = [ + "bitflags 2.9.1", + "fsevent-sys", + "inotify", + "kqueue", + "libc", + "log", + "mio", + "notify-types", + "walkdir", + "windows-sys 0.60.2", +] + +[[package]] +name = "notify-types" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" + +[[package]] +name = "ntp_timeturner" +version = "0.1.0" +dependencies = [ + "chrono", + "crossterm", + "env_logger", + "log", + "notify", + "rand", + "regex", + "serde", + "serde_json", + "serialport", + "socket2 0.4.10", + "statime", + "statime-linux", + "tokio", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" +dependencies = [ + "bitflags 2.9.1", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc-demangle" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags 2.9.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serialport" +version = "4.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb0bc984f6af6ef8bab54e6cf2071579ee75b9286aa9f2319a0d220c28b0a2b" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "core-foundation", + "core-foundation-sys", + "io-kit-sys", + "libudev", + "mach2", + "nix", + "scopeguard", + "unescaper", + "winapi", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "statime" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4b8f200cc0ef7de878f11c2d606248d76af7168e9723c09be995d796393a491" +dependencies = [ + "arrayvec", + "az", + "fixed", + "libm", + "log", + "rand", + "serde", +] + +[[package]] +name = "statime-linux" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34c87c1084dfe862d04ff46f0c87e7c8ee4adc9cb59ff6a381927199d686468e" +dependencies = [ + "arrayvec", + "clap", + "clock-steering", + "hex", + "libc", + "log", + "pin-project-lite", + "rand", + "serde", + "serde_json", + "statime", + "timestamped-socket", + "tokio", + "toml", + "tracing", + "tracing-log", + "tracing-subscriber", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "timestamped-socket" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d281d46f6b275c61bbe9ca3b55613c39018586dccbc537456ecaac7bb5377a" +dependencies = [ + "libc", + "serde", + "tokio", + "tracing", +] + +[[package]] +name = "tokio" +version = "1.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "slab", + "socket2 0.5.10", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "thread_local", + "tracing-core", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unescaper" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c01d12e3a56a4432a8b436f293c25f4808bdf9e9f9f98f9260bba1f1bc5a1f26" +dependencies = [ + "thiserror", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "winnow" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" +dependencies = [ + "memchr", +] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/src/sync_logic.rs b/src/sync_logic.rs index e985441..df8ea57 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -160,15 +160,6 @@ mod tests { assert!(frame.matches_system_time()); } - #[test] - fn test_ltc_frame_does_not_match_system_time() { - let now = Local::now(); - // Create a time that is one hour ahead, wrapping around 23:00 - let different_hour = (now.hour() + 1) % 24; - let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); - assert!(!frame.matches_system_time()); - } - #[test] fn test_ltc_state_update_lock() { let mut state = LtcState::new(); From b261d7c5859dc3abc2d3837aee4a81fafb11e601 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Sat, 19 Jul 2025 15:41:45 +0100 Subject: [PATCH 03/18] ci: add back in old test and fix test to be testing for something that actually exists --- src/sync_logic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index df8ea57..779e856 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -181,7 +181,7 @@ mod tests { assert_eq!(state.lock_count, 0); assert_eq!(state.free_count, 1); assert!(state.offset_history.is_empty()); // Offsets should be cleared - assert_eq!(state.last_match_status, "UNKNOWN"); + assert_eq!(state.last_match_status, "OUT OF SYNC"); } #[test] From bc91b159409468d740d04b43e1dfa28cbf68bc19 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Sat, 19 Jul 2025 15:44:30 +0100 Subject: [PATCH 04/18] add the test for ltc_frame_does_not_match_system_time --- src/sync_logic.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index 779e856..1982017 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -140,7 +140,8 @@ impl LtcState { mod tests { use super::*; use chrono::{Local, Utc}; - + + #[test] fn get_test_frame(status: &str, h: u32, m: u32, s: u32) -> LtcFrame { LtcFrame { status: status.to_string(), From f60b83ff9cf8519902d88d32b5cb85afc4e235c2 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Sat, 19 Jul 2025 15:49:35 +0100 Subject: [PATCH 05/18] keirstarmers five tests --- src/sync_logic.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index 1982017..0b33c36 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -140,8 +140,7 @@ impl LtcState { mod tests { use super::*; use chrono::{Local, Utc}; - - #[test] + fn get_test_frame(status: &str, h: u32, m: u32, s: u32) -> LtcFrame { LtcFrame { status: status.to_string(), @@ -161,6 +160,15 @@ mod tests { assert!(frame.matches_system_time()); } + #[test] + fn test_ltc_frame_does_not_match_system_time() { + let now = Local::now(); + // Create a time that is one hour ahead, wrapping around 23:00 + let different_hour = (now.hour() + 1) % 24; + let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); + assert!(!frame.matches_system_time()); + } + #[test] fn test_ltc_state_update_lock() { let mut state = LtcState::new(); From da7152d8513bee59c4337d64abb056b55551bf9f Mon Sep 17 00:00:00 2001 From: John Rogers Date: Sat, 19 Jul 2025 15:49:59 +0100 Subject: [PATCH 06/18] update with comment --- src/sync_logic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index 0b33c36..9e38c95 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -135,7 +135,7 @@ impl LtcState { &self.last_match_status } } - +// This module provides the logic for handling LTC (Linear Timecode) frames and maintaining state. #[cfg(test)] mod tests { use super::*; @@ -168,7 +168,7 @@ mod tests { let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); assert!(!frame.matches_system_time()); } - + #[test] fn test_ltc_state_update_lock() { let mut state = LtcState::new(); From b049b2795966cd2c6b4e916fa11f397ed5a3fd85 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 11:33:53 +0100 Subject: [PATCH 07/18] Update sync_logic.rs --- src/sync_logic.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index 10e8d25..6870213 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -228,4 +228,5 @@ mod tests { assert_eq!(state.offset_history.len(), 20); assert_eq!(*state.offset_history.front().unwrap(), 5); // 0-4 are pushed out assert_eq!(*state.offset_history.back().unwrap(), 24); - } \ No newline at end of file + } +} From 6df45a13326529f7958fcab3098df1a21af49d5e Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 11:49:00 +0100 Subject: [PATCH 08/18] test: correct assertion for FREE frame status Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) --- src/sync_logic.rs | 464 +++++++++++++++++++++++----------------------- 1 file changed, 232 insertions(+), 232 deletions(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index 6870213..a9ef67d 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -1,232 +1,232 @@ -use chrono::{DateTime, Local, Timelike, Utc}; -use regex::Captures; -use std::collections::VecDeque; - -#[derive(Clone, Debug)] -pub struct LtcFrame { - pub status: String, - pub hours: u32, - pub minutes: u32, - pub seconds: u32, - pub frames: u32, - pub frame_rate: f64, - pub timestamp: DateTime, // arrival stamp -} - -impl LtcFrame { - pub fn from_regex(caps: &Captures, timestamp: DateTime) -> Option { - Some(Self { - status: caps[1].to_string(), - hours: caps[2].parse().ok()?, - minutes: caps[3].parse().ok()?, - seconds: caps[4].parse().ok()?, - frames: caps[5].parse().ok()?, - frame_rate: caps[6].parse().ok()?, - timestamp, - }) - } - - /// Compare just HH:MM:SS against local time. - pub fn matches_system_time(&self) -> bool { - let local = Local::now(); - local.hour() == self.hours - && local.minute() == self.minutes - && local.second() == self.seconds - } -} - -pub struct LtcState { - pub latest: Option, - pub lock_count: u32, - pub free_count: u32, - /// Stores the last up-to-20 raw offset measurements in ms. - pub offset_history: VecDeque, - /// Stores the last up-to-20 timecode Δ measurements in ms. - pub clock_delta_history: VecDeque, - pub last_match_status: String, - pub last_match_check: i64, -} - -impl LtcState { - pub fn new() -> Self { - Self { - latest: None, - lock_count: 0, - free_count: 0, - offset_history: VecDeque::with_capacity(20), - clock_delta_history: VecDeque::with_capacity(20), - last_match_status: "UNKNOWN".into(), - last_match_check: 0, - } - } - - /// Record one measured jitter offset in ms. - pub fn record_offset(&mut self, offset_ms: i64) { - if self.offset_history.len() == 20 { - self.offset_history.pop_front(); - } - self.offset_history.push_back(offset_ms); - } - - /// Record one timecode Δ in ms. - pub fn record_clock_delta(&mut self, delta_ms: i64) { - if self.clock_delta_history.len() == 20 { - self.clock_delta_history.pop_front(); - } - self.clock_delta_history.push_back(delta_ms); - } - - /// Clear all stored jitter measurements. - pub fn clear_offsets(&mut self) { - self.offset_history.clear(); - } - - /// Clear all stored timecode Δ measurements. - pub fn clear_clock_deltas(&mut self) { - self.clock_delta_history.clear(); - } - - /// Update LOCK/FREE counts and timecode-match status every 5 s. - pub fn update(&mut self, frame: LtcFrame) { - match frame.status.as_str() { - "LOCK" => { - self.lock_count += 1; - } - "FREE" => { - self.free_count += 1; - self.clear_offsets(); - self.clear_clock_deltas(); - self.last_match_status = "UNKNOWN".into(); - } - _ => {} - } - - // Recompute timecode-match every 5 seconds - let now_secs = Utc::now().timestamp(); - if now_secs - self.last_match_check >= 5 { - self.last_match_status = if let Some(frame) = &self.latest { - if frame.matches_system_time() { "IN SYNC" } else { "OUT OF SYNC" } - } else { - "UNKNOWN" - } - .into(); - self.last_match_check = now_secs; - } - - self.latest = Some(frame); - } - - /// Average jitter over stored history, in ms. - pub fn average_jitter(&self) -> i64 { - if self.offset_history.is_empty() { - 0 - } else { - let sum: i64 = self.offset_history.iter().sum(); - sum / self.offset_history.len() as i64 - } - } - - /// Convert average jitter into frames (rounded). - pub fn average_frames(&self) -> i64 { - if let Some(frame) = &self.latest { - let ms_per_frame = 1000.0 / frame.frame_rate; - (self.average_jitter() as f64 / ms_per_frame).round() as i64 - } else { - 0 - } - } - - /// Average timecode Δ over stored history, in ms. - pub fn average_clock_delta(&self) -> i64 { - if self.clock_delta_history.is_empty() { - 0 - } else { - let sum: i64 = self.clock_delta_history.iter().sum(); - sum / self.clock_delta_history.len() as i64 - } - } - - /// Percentage of samples seen in LOCK state versus total. - pub fn lock_ratio(&self) -> f64 { - let total = self.lock_count + self.free_count; - if total == 0 { - 0.0 - } else { - self.lock_count as f64 / total as f64 * 100.0 - } - } - - /// Get timecode-match status. - pub fn timecode_match(&self) -> &str { - &self.last_match_status - } -} -// This module provides the logic for handling LTC (Linear Timecode) frames and maintaining state. -#[cfg(test)] -mod tests { - use super::*; - use chrono::{Local, Utc}; - - fn get_test_frame(status: &str, h: u32, m: u32, s: u32) -> LtcFrame { - LtcFrame { - status: status.to_string(), - hours: h, - minutes: m, - seconds: s, - frames: 0, - frame_rate: 25.0, - timestamp: Utc::now(), - } - } - - #[test] - fn test_ltc_frame_matches_system_time() { - let now = Local::now(); - let frame = get_test_frame("LOCK", now.hour(), now.minute(), now.second()); - assert!(frame.matches_system_time()); - } - - #[test] - fn test_ltc_frame_does_not_match_system_time() { - let now = Local::now(); - // Create a time that is one hour ahead, wrapping around 23:00 - let different_hour = (now.hour() + 1) % 24; - let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); - assert!(!frame.matches_system_time()); - } - - #[test] - fn test_ltc_state_update_lock() { - let mut state = LtcState::new(); - let frame = get_test_frame("LOCK", 10, 20, 30); - state.update(frame); - assert_eq!(state.lock_count, 1); - assert_eq!(state.free_count, 0); - assert!(state.latest.is_some()); - } - - #[test] - fn test_ltc_state_update_free() { - let mut state = LtcState::new(); - state.record_offset(100); - assert!(!state.offset_history.is_empty()); - - let frame = get_test_frame("FREE", 10, 20, 30); - state.update(frame); - assert_eq!(state.lock_count, 0); - assert_eq!(state.free_count, 1); - assert!(state.offset_history.is_empty()); // Offsets should be cleared - assert_eq!(state.last_match_status, "OUT OF SYNC"); - } - - #[test] - fn test_offset_history_management() { - let mut state = LtcState::new(); - for i in 0..25 { - state.record_offset(i); - } - assert_eq!(state.offset_history.len(), 20); - assert_eq!(*state.offset_history.front().unwrap(), 5); // 0-4 are pushed out - assert_eq!(*state.offset_history.back().unwrap(), 24); - } -} +use chrono::{DateTime, Local, Timelike, Utc}; +use regex::Captures; +use std::collections::VecDeque; + +#[derive(Clone, Debug)] +pub struct LtcFrame { + pub status: String, + pub hours: u32, + pub minutes: u32, + pub seconds: u32, + pub frames: u32, + pub frame_rate: f64, + pub timestamp: DateTime, // arrival stamp +} + +impl LtcFrame { + pub fn from_regex(caps: &Captures, timestamp: DateTime) -> Option { + Some(Self { + status: caps[1].to_string(), + hours: caps[2].parse().ok()?, + minutes: caps[3].parse().ok()?, + seconds: caps[4].parse().ok()?, + frames: caps[5].parse().ok()?, + frame_rate: caps[6].parse().ok()?, + timestamp, + }) + } + + /// Compare just HH:MM:SS against local time. + pub fn matches_system_time(&self) -> bool { + let local = Local::now(); + local.hour() == self.hours + && local.minute() == self.minutes + && local.second() == self.seconds + } +} + +pub struct LtcState { + pub latest: Option, + pub lock_count: u32, + pub free_count: u32, + /// Stores the last up-to-20 raw offset measurements in ms. + pub offset_history: VecDeque, + /// Stores the last up-to-20 timecode Δ measurements in ms. + pub clock_delta_history: VecDeque, + pub last_match_status: String, + pub last_match_check: i64, +} + +impl LtcState { + pub fn new() -> Self { + Self { + latest: None, + lock_count: 0, + free_count: 0, + offset_history: VecDeque::with_capacity(20), + clock_delta_history: VecDeque::with_capacity(20), + last_match_status: "UNKNOWN".into(), + last_match_check: 0, + } + } + + /// Record one measured jitter offset in ms. + pub fn record_offset(&mut self, offset_ms: i64) { + if self.offset_history.len() == 20 { + self.offset_history.pop_front(); + } + self.offset_history.push_back(offset_ms); + } + + /// Record one timecode Δ in ms. + pub fn record_clock_delta(&mut self, delta_ms: i64) { + if self.clock_delta_history.len() == 20 { + self.clock_delta_history.pop_front(); + } + self.clock_delta_history.push_back(delta_ms); + } + + /// Clear all stored jitter measurements. + pub fn clear_offsets(&mut self) { + self.offset_history.clear(); + } + + /// Clear all stored timecode Δ measurements. + pub fn clear_clock_deltas(&mut self) { + self.clock_delta_history.clear(); + } + + /// Update LOCK/FREE counts and timecode-match status every 5 s. + pub fn update(&mut self, frame: LtcFrame) { + match frame.status.as_str() { + "LOCK" => { + self.lock_count += 1; + } + "FREE" => { + self.free_count += 1; + self.clear_offsets(); + self.clear_clock_deltas(); + self.last_match_status = "UNKNOWN".into(); + } + _ => {} + } + + // Recompute timecode-match every 5 seconds + let now_secs = Utc::now().timestamp(); + if now_secs - self.last_match_check >= 5 { + self.last_match_status = if let Some(frame) = &self.latest { + if frame.matches_system_time() { "IN SYNC" } else { "OUT OF SYNC" } + } else { + "UNKNOWN" + } + .into(); + self.last_match_check = now_secs; + } + + self.latest = Some(frame); + } + + /// Average jitter over stored history, in ms. + pub fn average_jitter(&self) -> i64 { + if self.offset_history.is_empty() { + 0 + } else { + let sum: i64 = self.offset_history.iter().sum(); + sum / self.offset_history.len() as i64 + } + } + + /// Convert average jitter into frames (rounded). + pub fn average_frames(&self) -> i64 { + if let Some(frame) = &self.latest { + let ms_per_frame = 1000.0 / frame.frame_rate; + (self.average_jitter() as f64 / ms_per_frame).round() as i64 + } else { + 0 + } + } + + /// Average timecode Δ over stored history, in ms. + pub fn average_clock_delta(&self) -> i64 { + if self.clock_delta_history.is_empty() { + 0 + } else { + let sum: i64 = self.clock_delta_history.iter().sum(); + sum / self.clock_delta_history.len() as i64 + } + } + + /// Percentage of samples seen in LOCK state versus total. + pub fn lock_ratio(&self) -> f64 { + let total = self.lock_count + self.free_count; + if total == 0 { + 0.0 + } else { + self.lock_count as f64 / total as f64 * 100.0 + } + } + + /// Get timecode-match status. + pub fn timecode_match(&self) -> &str { + &self.last_match_status + } +} +// This module provides the logic for handling LTC (Linear Timecode) frames and maintaining state. +#[cfg(test)] +mod tests { + use super::*; + use chrono::{Local, Utc}; + + fn get_test_frame(status: &str, h: u32, m: u32, s: u32) -> LtcFrame { + LtcFrame { + status: status.to_string(), + hours: h, + minutes: m, + seconds: s, + frames: 0, + frame_rate: 25.0, + timestamp: Utc::now(), + } + } + + #[test] + fn test_ltc_frame_matches_system_time() { + let now = Local::now(); + let frame = get_test_frame("LOCK", now.hour(), now.minute(), now.second()); + assert!(frame.matches_system_time()); + } + + #[test] + fn test_ltc_frame_does_not_match_system_time() { + let now = Local::now(); + // Create a time that is one hour ahead, wrapping around 23:00 + let different_hour = (now.hour() + 1) % 24; + let frame = get_test_frame("LOCK", different_hour, now.minute(), now.second()); + assert!(!frame.matches_system_time()); + } + + #[test] + fn test_ltc_state_update_lock() { + let mut state = LtcState::new(); + let frame = get_test_frame("LOCK", 10, 20, 30); + state.update(frame); + assert_eq!(state.lock_count, 1); + assert_eq!(state.free_count, 0); + assert!(state.latest.is_some()); + } + + #[test] + fn test_ltc_state_update_free() { + let mut state = LtcState::new(); + state.record_offset(100); + assert!(!state.offset_history.is_empty()); + + let frame = get_test_frame("FREE", 10, 20, 30); + state.update(frame); + assert_eq!(state.lock_count, 0); + assert_eq!(state.free_count, 1); + assert!(state.offset_history.is_empty()); // Offsets should be cleared + assert_eq!(state.last_match_status, "UNKNOWN"); + } + + #[test] + fn test_offset_history_management() { + let mut state = LtcState::new(); + for i in 0..25 { + state.record_offset(i); + } + assert_eq!(state.offset_history.len(), 20); + assert_eq!(*state.offset_history.front().unwrap(), 5); // 0-4 are pushed out + assert_eq!(*state.offset_history.back().unwrap(), 24); + } +} From 2b1481264e7cd86e68da6f966fc12afdab22ad8f Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 11:55:09 +0100 Subject: [PATCH 09/18] test: add tests for timecode match status and throttling Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) --- src/sync_logic.rs | 67 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index a9ef67d..4a7acf6 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -229,4 +229,71 @@ mod tests { assert_eq!(*state.offset_history.front().unwrap(), 5); // 0-4 are pushed out assert_eq!(*state.offset_history.back().unwrap(), 24); } + + #[test] + fn test_timecode_match_status_in_sync() { + let mut state = LtcState::new(); + state.last_match_check = 0; // Force check to run + + let now = Local::now(); + let frame_in_sync = get_test_frame("LOCK", now.hour(), now.minute(), now.second()); + state.update(frame_in_sync); + + // This will fail due to the bug (`latest` is None during check). + // Expected: "IN SYNC", Actual: "UNKNOWN". This exposes the bug. + assert_eq!(state.timecode_match(), "IN SYNC"); + } + + #[test] + fn test_timecode_match_status_out_of_sync() { + let mut state = LtcState::new(); + state.last_match_check = 0; // Force check to run + + let now = Local::now(); + let different_hour = (now.hour() + 1) % 24; + let frame_out_of_sync = get_test_frame("LOCK", different_hour, now.minute(), now.second()); + state.update(frame_out_of_sync); + + // This will also fail due to the bug. + // Expected: "OUT OF SYNC", Actual: "UNKNOWN". + assert_eq!(state.timecode_match(), "OUT OF SYNC"); + } + + #[test] + fn test_timecode_match_throttling() { + let mut state = LtcState::new(); + let now = Local::now(); + + // First call. With the bug, status becomes UNKNOWN. With fix, OUT OF SYNC. + // The test is written for the fixed behavior. + state.last_match_check = 0; + let frame_out_of_sync = + get_test_frame("LOCK", (now.hour() + 1) % 24, now.minute(), now.second()); + state.update(frame_out_of_sync.clone()); + assert_eq!( + state.timecode_match(), + "OUT OF SYNC", + "Initial status should be out of sync" + ); + + // Second call, immediately. Check should be throttled. + // Status should not change, even though we pass an in-sync frame. + let frame_in_sync = get_test_frame("LOCK", now.hour(), now.minute(), now.second()); + state.update(frame_in_sync.clone()); + assert_eq!( + state.timecode_match(), + "OUT OF SYNC", + "Status should not change due to throttling" + ); + + // Third call, forcing check to run again. + // Status should now update to IN SYNC. + state.last_match_check = 0; + state.update(frame_in_sync.clone()); + assert_eq!( + state.timecode_match(), + "IN SYNC", + "Status should update after throttle period" + ); + } } From abc5d6af4b63a11b414b40db6e484ff8ae409ac1 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 11:58:47 +0100 Subject: [PATCH 10/18] fix: use current frame for timecode sync check Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) --- src/sync_logic.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index 4a7acf6..efd2f27 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -91,6 +91,18 @@ impl LtcState { match frame.status.as_str() { "LOCK" => { self.lock_count += 1; + + // Recompute timecode-match every 5 seconds + let now_secs = Utc::now().timestamp(); + if now_secs - self.last_match_check >= 5 { + self.last_match_status = if frame.matches_system_time() { + "IN SYNC" + } else { + "OUT OF SYNC" + } + .into(); + self.last_match_check = now_secs; + } } "FREE" => { self.free_count += 1; @@ -101,18 +113,6 @@ impl LtcState { _ => {} } - // Recompute timecode-match every 5 seconds - let now_secs = Utc::now().timestamp(); - if now_secs - self.last_match_check >= 5 { - self.last_match_status = if let Some(frame) = &self.latest { - if frame.matches_system_time() { "IN SYNC" } else { "OUT OF SYNC" } - } else { - "UNKNOWN" - } - .into(); - self.last_match_check = now_secs; - } - self.latest = Some(frame); } From f0f6d9f612c00c834b3da8d10e49966a6e59e353 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 12:03:13 +0100 Subject: [PATCH 11/18] cargolock --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0c5fc70..36928c2 100644 --- a/.gitignore +++ b/.gitignore @@ -378,3 +378,4 @@ target # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +cargo.lock \ No newline at end of file From 1dd2f806d461c55ea4492e516780b0fa83e4a3ce Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 12:03:18 +0100 Subject: [PATCH 12/18] carog --- Cargo.lock | 1720 ---------------------------------------------------- 1 file changed, 1720 deletions(-) delete mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 55d569d..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,1720 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "0.6.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" - -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.59.0", -] - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" -dependencies = [ - "serde", -] - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - -[[package]] -name = "backtrace" -version = "0.3.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" - -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" - -[[package]] -name = "bytemuck" -version = "1.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" - -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - -[[package]] -name = "cc" -version = "1.2.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" - -[[package]] -name = "chrono" -version = "0.4.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - -[[package]] -name = "clap" -version = "4.5.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" - -[[package]] -name = "clock-steering" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2410abf030f2eb46cba840d343455078538e7c8755507b37ffd4074064f08f62" -dependencies = [ - "libc", -] - -[[package]] -name = "colorchoice" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" - -[[package]] -name = "convert_case" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "core-foundation" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "crossterm" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" -dependencies = [ - "bitflags 2.9.1", - "crossterm_winapi", - "derive_more", - "document-features", - "mio", - "parking_lot", - "rustix", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "derive_more" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "document-features" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" -dependencies = [ - "litrs", -] - -[[package]] -name = "env_filter" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "jiff", - "log", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - -[[package]] -name = "fixed" -version = "1.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707070ccf8c4173548210893a0186e29c266901b71ed20cd9e2ca0193dfe95c3" -dependencies = [ - "az", - "bytemuck", - "half", - "typenum", -] - -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - -[[package]] -name = "getrandom" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "half" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" -dependencies = [ - "cfg-if", - "crunchy", -] - -[[package]] -name = "hashbrown" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "iana-time-zone" -version = "0.1.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "indexmap" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "inotify" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" -dependencies = [ - "bitflags 2.9.1", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - -[[package]] -name = "io-kit-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" -dependencies = [ - "core-foundation-sys", - "mach2", -] - -[[package]] -name = "io-uring" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "libc", -] - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "jiff" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" -dependencies = [ - "jiff-static", - "log", - "portable-atomic", - "portable-atomic-util", - "serde", -] - -[[package]] -name = "jiff-static" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "kqueue" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" -dependencies = [ - "bitflags 1.3.2", - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.174" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" - -[[package]] -name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - -[[package]] -name = "libudev" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b324152da65df7bb95acfcaab55e3097ceaab02fb19b228a9eb74d55f135e0" -dependencies = [ - "libc", - "libudev-sys", -] - -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "linux-raw-sys" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" - -[[package]] -name = "litrs" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" - -[[package]] -name = "lock_api" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - -[[package]] -name = "mach2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" -dependencies = [ - "libc", -] - -[[package]] -name = "memchr" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.59.0", -] - -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", -] - -[[package]] -name = "notify" -version = "8.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3163f59cd3fa0e9ef8c32f242966a7b9994fd7378366099593e0e73077cd8c97" -dependencies = [ - "bitflags 2.9.1", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "log", - "mio", - "notify-types", - "walkdir", - "windows-sys 0.60.2", -] - -[[package]] -name = "notify-types" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" - -[[package]] -name = "ntp_timeturner" -version = "0.1.0" -dependencies = [ - "chrono", - "crossterm", - "env_logger", - "log", - "notify", - "rand", - "regex", - "serde", - "serde_json", - "serialport", - "socket2 0.4.10", - "statime", - "statime-linux", - "tokio", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "once_cell_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "parking_lot" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "portable-atomic" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" - -[[package]] -name = "portable-atomic-util" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "proc-macro2" -version = "1.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" -dependencies = [ - "bitflags 2.9.1", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustc-demangle" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" - -[[package]] -name = "rustix" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" -dependencies = [ - "bitflags 2.9.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustversion" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - -[[package]] -name = "serialport" -version = "4.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb0bc984f6af6ef8bab54e6cf2071579ee75b9286aa9f2319a0d220c28b0a2b" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "core-foundation", - "core-foundation-sys", - "io-kit-sys", - "libudev", - "mach2", - "nix", - "scopeguard", - "unescaper", - "winapi", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" - -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "statime" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4b8f200cc0ef7de878f11c2d606248d76af7168e9723c09be995d796393a491" -dependencies = [ - "arrayvec", - "az", - "fixed", - "libm", - "log", - "rand", - "serde", -] - -[[package]] -name = "statime-linux" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34c87c1084dfe862d04ff46f0c87e7c8ee4adc9cb59ff6a381927199d686468e" -dependencies = [ - "arrayvec", - "clap", - "clock-steering", - "hex", - "libc", - "log", - "pin-project-lite", - "rand", - "serde", - "serde_json", - "statime", - "timestamped-socket", - "tokio", - "toml", - "tracing", - "tracing-log", - "tracing-subscriber", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "2.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "timestamped-socket" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d281d46f6b275c61bbe9ca3b55613c39018586dccbc537456ecaac7bb5377a" -dependencies = [ - "libc", - "serde", - "tokio", - "tracing", -] - -[[package]] -name = "tokio" -version = "1.46.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" -dependencies = [ - "backtrace", - "bytes", - "io-uring", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "slab", - "socket2 0.5.10", - "tokio-macros", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "toml_write", - "winnow", -] - -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" -dependencies = [ - "nu-ansi-term", - "sharded-slab", - "thread_local", - "tracing-core", -] - -[[package]] -name = "typenum" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" - -[[package]] -name = "unescaper" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01d12e3a56a4432a8b436f293c25f4808bdf9e9f9f98f9260bba1f1bc5a1f26" -dependencies = [ - "thiserror", -] - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-interface" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.2", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" -dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" - -[[package]] -name = "winnow" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" -dependencies = [ - "memchr", -] - -[[package]] -name = "zerocopy" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] From f906928e4edb30ca933056d36aa4ed3e92b7a4d8 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 12:18:50 +0100 Subject: [PATCH 13/18] serde bump --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9d9ea61..6127547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ chrono = "0.4" crossterm = "0.29" regex = "1.11" serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde_json = "1.0.141" notify = "8.1.0" get_if_addrs = "0.5" From 139d453afb61e6d93a688dc7e8acfb2675c21b8e Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 12:29:09 +0100 Subject: [PATCH 14/18] removed comment --- src/sync_logic.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index efd2f27..d0502a5 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -238,9 +238,6 @@ mod tests { let now = Local::now(); let frame_in_sync = get_test_frame("LOCK", now.hour(), now.minute(), now.second()); state.update(frame_in_sync); - - // This will fail due to the bug (`latest` is None during check). - // Expected: "IN SYNC", Actual: "UNKNOWN". This exposes the bug. assert_eq!(state.timecode_match(), "IN SYNC"); } From dd544649b10bc57de05e6d86ec081b07d43706bb Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 12:29:37 +0100 Subject: [PATCH 15/18] decomment --- src/sync_logic.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sync_logic.rs b/src/sync_logic.rs index d0502a5..0afa002 100644 --- a/src/sync_logic.rs +++ b/src/sync_logic.rs @@ -251,8 +251,6 @@ mod tests { let frame_out_of_sync = get_test_frame("LOCK", different_hour, now.minute(), now.second()); state.update(frame_out_of_sync); - // This will also fail due to the bug. - // Expected: "OUT OF SYNC", Actual: "UNKNOWN". assert_eq!(state.timecode_match(), "OUT OF SYNC"); } From 7b41d7ad06a53e2dfdc43171405aba8c4d8c3bcd Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 12:31:11 +0100 Subject: [PATCH 16/18] fix: Silence unused variable warning for `avg_frames` Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) --- src/ui.rs | 700 +++++++++++++++++++++++++++--------------------------- 1 file changed, 350 insertions(+), 350 deletions(-) diff --git a/src/ui.rs b/src/ui.rs index 63cdab2..149a7d1 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,350 +1,350 @@ -// src/ui.rs - -use std::{ - io::{stdout, Write}, - process::{self, Command}, - sync::{Arc, Mutex}, - thread, - time::{Duration, Instant}, -}; - -use chrono::{Local, Timelike, Utc, NaiveTime, Duration as ChronoDuration, TimeZone}; -use crossterm::{ - cursor::{Hide, MoveTo, Show}, - event::{poll, read, Event, KeyCode}, - execute, queue, - style::{Color, Print, ResetColor, SetForegroundColor}, - terminal::{self, Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen}, -}; - -use get_if_addrs::get_if_addrs; -use std::collections::VecDeque; -use crate::sync_logic::LtcState; - -/// Check if the ntpd service is active -fn ntp_service_active() -> bool { - if let Ok(output) = Command::new("systemctl").args(&["is-active", "ntpd"]).output() { - output.status.success() && String::from_utf8_lossy(&output.stdout).trim() == "active" - } else { - false - } -} - -/// Toggle the ntpd service (start if `start` is true, stop otherwise) -fn ntp_service_toggle(start: bool) { - let action = if start { "start" } else { "stop" }; - let _ = Command::new("systemctl").args(&[action, "ntpd"]).status(); -} - -/// Launch the full-featured TUI; reads `offset` live and performs auto-sync if out of sync. -pub fn start_ui( - state: Arc>, - serial_port: String, - offset: Arc>, -) { - let mut stdout = stdout(); - // Enter alternate screen and hide cursor - execute!(stdout, EnterAlternateScreen, Hide).unwrap(); - terminal::enable_raw_mode().unwrap(); - - // Recent log of messages (last 10) - let mut logs: VecDeque = VecDeque::with_capacity(10); - // Tracks when we first detected out-of-sync - let mut out_of_sync_since: Option = None; - - // For caching the timecode delta display once per second - let mut last_delta_update = Instant::now() - Duration::from_secs(1); - let mut cached_delta_ms: i64 = 0; - let mut cached_delta_frames: i64 = 0; - - loop { - // 1️⃣ Read hardware offset from watcher - let hw_offset_ms = *offset.lock().unwrap(); - - // 2️⃣ Check NTP service status and gather network interfaces - let ntp_active = ntp_service_active(); - let interfaces: Vec = get_if_addrs() - .unwrap_or_default() - .into_iter() - .filter(|ifa| !ifa.is_loopback()) - .map(|ifa| ifa.ip().to_string()) - .collect(); - - // 3️⃣ Measure & record jitter and Timecode Δ when LOCKED; clear on FREE - { - let mut st = state.lock().unwrap(); - if let Some(frame) = st.latest.clone() { - if frame.status == "LOCK" { - // Jitter in ms - let now = Utc::now(); - let raw = (now - frame.timestamp).num_milliseconds(); - let measured = raw - hw_offset_ms; - st.record_offset(measured); - - // Timecode delta: how far system clock differs from LTC - let local = Local::now(); - let sub_ms = ((frame.frames as f64 / frame.frame_rate) * 1000.0).round() as i64; - let base_time = NaiveTime::from_hms_opt( - frame.hours, - frame.minutes, - frame.seconds, - ).unwrap_or(local.time()); - let offset_dt = local.date_naive().and_time(base_time) - + ChronoDuration::milliseconds(sub_ms); - let ltc_dt = Local.from_local_datetime(&offset_dt) - .single() - .unwrap_or(local); - let delta_ms = local.signed_duration_since(ltc_dt).num_milliseconds(); - st.record_clock_delta(delta_ms); - } else { - st.clear_offsets(); - st.clear_clock_deltas(); - } - } - } - - // 4️⃣ Compute averages & statuses - let (avg_ms, avg_frames, status_str, lock_ratio, avg_delta) = { - let st = state.lock().unwrap(); - ( - st.average_jitter(), - st.average_frames(), - st.timecode_match().to_string(), - st.lock_ratio(), - st.average_clock_delta(), - ) - }; - - // 5️⃣ Update cached delta once per second - if last_delta_update.elapsed() >= Duration::from_secs(1) { - cached_delta_ms = avg_delta; - // Recompute frames equivalent - if let Ok(st2) = state.lock() { - if let Some(frame) = &st2.latest { - let ms_pf = 1000.0 / frame.frame_rate; - cached_delta_frames = (cached_delta_ms as f64 / ms_pf).round() as i64; - } - } - last_delta_update = Instant::now(); - } - - // 6️⃣ Auto-sync if "OUT OF SYNC" or Δ >10ms for 5s - if status_str == "OUT OF SYNC" || cached_delta_ms.abs() > 10 { - if let Some(start) = out_of_sync_since { - if start.elapsed() >= Duration::from_secs(5) { - // Perform sync to LTC - if let Ok(stl) = state.lock() { - if let Some(frame) = &stl.latest { - let local_now = Local::now(); - let sub_ms = ((frame.frames as f64 / frame.frame_rate) * 1000.0) - .round() as i64; - let base_time = NaiveTime::from_hms_opt( - frame.hours, - frame.minutes, - frame.seconds, - ).unwrap_or(local_now.time()); - let offset_dt = local_now.date_naive().and_time(base_time) - + ChronoDuration::milliseconds(sub_ms); - let ltc_dt = Local.from_local_datetime(&offset_dt) - .single() - .unwrap_or(local_now); - let ts = format!("{:02}:{:02}:{:02}.{:03}", - ltc_dt.hour(), - ltc_dt.minute(), - ltc_dt.second(), - ltc_dt.timestamp_subsec_millis() - ); - let res = Command::new("sudo") - .arg("date") - .arg("-s") - .arg(&ts) - .status(); - let msg = if res.as_ref().map_or(false, |s| s.success()) { - format!("🔄 Auto-synced to LTC: {}", ts) - } else { - "❌ Auto-sync failed".into() - }; - if logs.len() == 10 { - logs.pop_front(); - } - logs.push_back(msg); - } - } - out_of_sync_since = None; - } - } else { - out_of_sync_since = Some(Instant::now()); - } - } else { - out_of_sync_since = None; - } - - // 7️⃣ Draw static UI header - queue!( - stdout, - MoveTo(0, 0), Clear(ClearType::All), - MoveTo(2, 1), Print("NTP Timeturner v2 - Rust Port"), - MoveTo(2, 2), Print(format!("Using Serial Port: {}", serial_port)), - MoveTo(2, 3), Print(format!("NTP Server : {}", if ntp_active { "ACTIVE" } else { "INACTIVE" })), - MoveTo(2, 4), Print(format!("Interfaces : {}", interfaces.join(", "))), - ) - .unwrap(); - - // 8️⃣ Draw LTC and System Clock - if let Ok(st) = state.lock() { - if let Some(frame) = &st.latest { - queue!( - stdout, - MoveTo(2, 6), Print(format!("LTC Status : {}", frame.status)), - MoveTo(2, 7), Print(format!( - "LTC Timecode : {:02}:{:02}:{:02}:{:02}", - frame.hours, frame.minutes, frame.seconds, frame.frames - )), - MoveTo(2, 8), Print(format!("Frame Rate : {:.2}fps", frame.frame_rate)), - ) - .unwrap(); - } else { - queue!( - stdout, - MoveTo(2, 6), Print("LTC Status : (waiting)"), - MoveTo(2, 7), Print("LTC Timecode : …"), - MoveTo(2, 8), Print("Frame Rate : …"), - ) - .unwrap(); - } - let now_local = Local::now(); - let sys_ts = format!("{:02}:{:02}:{:02}.{:03}", - now_local.hour(), now_local.minute(), now_local.second(), now_local.timestamp_subsec_millis() - ); - queue!(stdout, MoveTo(2, 9), Print(format!("System Clock : {}", sys_ts))).unwrap(); - } - - // 9️⃣ Overlay metrics in new order - // Timecode Δ line - let dcol = if cached_delta_ms.abs() < 20 { - Color::Green - } else if cached_delta_ms.abs() < 100 { - Color::Yellow - } else { - Color::Red - }; - queue!( - stdout, - MoveTo(2, 11), SetForegroundColor(dcol), - Print(format!("Timecode Δ : {:+} ms ({:+} frames)", cached_delta_ms, cached_delta_frames)), - ResetColor, - ) - .unwrap(); - - // Sync Status line - let scol = if status_str == "IN SYNC" { - Color::Green - } else { - Color::Red - }; - queue!( - stdout, - MoveTo(2, 12), SetForegroundColor(scol), - Print(format!("Sync Status : {}", status_str)), - ResetColor, - ) - .unwrap(); - - // Sync Jitter line - let jstatus = if avg_ms.abs() < 10 { - "GOOD" - } else if avg_ms.abs() < 40 { - "AVERAGE" - } else { - "BAD" - }; - let jcol = if jstatus == "GOOD" { - Color::Green - } else if jstatus == "AVERAGE" { - Color::Yellow - } else { - Color::Red - }; - queue!( - stdout, - MoveTo(2, 13), SetForegroundColor(jcol), - Print(format!("Sync Jitter : {}", jstatus)), - ResetColor, - ) - .unwrap(); - - // Lock Ratio line - queue!(stdout, - MoveTo(2, 14), Print(format!("Lock Ratio : {:.1}% LOCK", lock_ratio)), - ) - .unwrap(); - - // 10️⃣ Footer and logs - queue!(stdout, - MoveTo(2, 16), Print("[S] Set system clock to LTC [Q] Quit"), - ) - .unwrap(); - for (i, log_msg) in logs.iter().enumerate() { - queue!(stdout, MoveTo(2, 18 + i as u16), Print(log_msg)).unwrap(); - } - - stdout.flush().unwrap(); - - // 11️⃣ Handle manual sync and quit keys - if poll(Duration::from_millis(50)).unwrap() { - if let Event::Key(evt) = read().unwrap() { - match evt.code { - KeyCode::Char(c) if c.eq_ignore_ascii_case(&'q') => { - execute!(stdout, Show, LeaveAlternateScreen).unwrap(); - terminal::disable_raw_mode().unwrap(); - process::exit(0); - } - KeyCode::Char(c) if c.eq_ignore_ascii_case(&'s') => { - if let Ok(stlock) = state.lock() { - if let Some(frame) = &stlock.latest { - let local_now = Local::now(); - let sub_ms = ((frame.frames as f64 / frame.frame_rate) * 1000.0) - .round() as i64; - let base_time = NaiveTime::from_hms_opt( - frame.hours, - frame.minutes, - frame.seconds, - ) - .unwrap_or(local_now.time()); - let offset_dt = local_now.date_naive().and_time(base_time) - + ChronoDuration::milliseconds(sub_ms); - let ltc_dt = Local.from_local_datetime(&offset_dt) - .single() - .unwrap_or(local_now); - let ts = format!( - "{:02}:{:02}:{:02}.{:03}", - ltc_dt.hour(), - ltc_dt.minute(), - ltc_dt.second(), - ltc_dt.timestamp_subsec_millis(), - ); - let res = Command::new("sudo") - .arg("date") - .arg("-s") - .arg(&ts) - .status(); - let msg = if res.as_ref().map_or(false, |s| s.success()) { - format!("✔ Synced exactly to LTC: {}", ts) - } else { - "❌ date cmd failed".into() - }; - if logs.len() == 10 { - logs.pop_front(); - } - logs.push_back(msg); - } - } - } - _ => {} - } - } - } - - thread::sleep(Duration::from_millis(50)); - } -} +// src/ui.rs + +use std::{ + io::{stdout, Write}, + process::{self, Command}, + sync::{Arc, Mutex}, + thread, + time::{Duration, Instant}, +}; + +use chrono::{Local, Timelike, Utc, NaiveTime, Duration as ChronoDuration, TimeZone}; +use crossterm::{ + cursor::{Hide, MoveTo, Show}, + event::{poll, read, Event, KeyCode}, + execute, queue, + style::{Color, Print, ResetColor, SetForegroundColor}, + terminal::{self, Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen}, +}; + +use get_if_addrs::get_if_addrs; +use std::collections::VecDeque; +use crate::sync_logic::LtcState; + +/// Check if the ntpd service is active +fn ntp_service_active() -> bool { + if let Ok(output) = Command::new("systemctl").args(&["is-active", "ntpd"]).output() { + output.status.success() && String::from_utf8_lossy(&output.stdout).trim() == "active" + } else { + false + } +} + +/// Toggle the ntpd service (start if `start` is true, stop otherwise) +fn ntp_service_toggle(start: bool) { + let action = if start { "start" } else { "stop" }; + let _ = Command::new("systemctl").args(&[action, "ntpd"]).status(); +} + +/// Launch the full-featured TUI; reads `offset` live and performs auto-sync if out of sync. +pub fn start_ui( + state: Arc>, + serial_port: String, + offset: Arc>, +) { + let mut stdout = stdout(); + // Enter alternate screen and hide cursor + execute!(stdout, EnterAlternateScreen, Hide).unwrap(); + terminal::enable_raw_mode().unwrap(); + + // Recent log of messages (last 10) + let mut logs: VecDeque = VecDeque::with_capacity(10); + // Tracks when we first detected out-of-sync + let mut out_of_sync_since: Option = None; + + // For caching the timecode delta display once per second + let mut last_delta_update = Instant::now() - Duration::from_secs(1); + let mut cached_delta_ms: i64 = 0; + let mut cached_delta_frames: i64 = 0; + + loop { + // 1️⃣ Read hardware offset from watcher + let hw_offset_ms = *offset.lock().unwrap(); + + // 2️⃣ Check NTP service status and gather network interfaces + let ntp_active = ntp_service_active(); + let interfaces: Vec = get_if_addrs() + .unwrap_or_default() + .into_iter() + .filter(|ifa| !ifa.is_loopback()) + .map(|ifa| ifa.ip().to_string()) + .collect(); + + // 3️⃣ Measure & record jitter and Timecode Δ when LOCKED; clear on FREE + { + let mut st = state.lock().unwrap(); + if let Some(frame) = st.latest.clone() { + if frame.status == "LOCK" { + // Jitter in ms + let now = Utc::now(); + let raw = (now - frame.timestamp).num_milliseconds(); + let measured = raw - hw_offset_ms; + st.record_offset(measured); + + // Timecode delta: how far system clock differs from LTC + let local = Local::now(); + let sub_ms = ((frame.frames as f64 / frame.frame_rate) * 1000.0).round() as i64; + let base_time = NaiveTime::from_hms_opt( + frame.hours, + frame.minutes, + frame.seconds, + ).unwrap_or(local.time()); + let offset_dt = local.date_naive().and_time(base_time) + + ChronoDuration::milliseconds(sub_ms); + let ltc_dt = Local.from_local_datetime(&offset_dt) + .single() + .unwrap_or(local); + let delta_ms = local.signed_duration_since(ltc_dt).num_milliseconds(); + st.record_clock_delta(delta_ms); + } else { + st.clear_offsets(); + st.clear_clock_deltas(); + } + } + } + + // 4️⃣ Compute averages & statuses + let (avg_ms, _avg_frames, status_str, lock_ratio, avg_delta) = { + let st = state.lock().unwrap(); + ( + st.average_jitter(), + st.average_frames(), + st.timecode_match().to_string(), + st.lock_ratio(), + st.average_clock_delta(), + ) + }; + + // 5️⃣ Update cached delta once per second + if last_delta_update.elapsed() >= Duration::from_secs(1) { + cached_delta_ms = avg_delta; + // Recompute frames equivalent + if let Ok(st2) = state.lock() { + if let Some(frame) = &st2.latest { + let ms_pf = 1000.0 / frame.frame_rate; + cached_delta_frames = (cached_delta_ms as f64 / ms_pf).round() as i64; + } + } + last_delta_update = Instant::now(); + } + + // 6️⃣ Auto-sync if "OUT OF SYNC" or Δ >10ms for 5s + if status_str == "OUT OF SYNC" || cached_delta_ms.abs() > 10 { + if let Some(start) = out_of_sync_since { + if start.elapsed() >= Duration::from_secs(5) { + // Perform sync to LTC + if let Ok(stl) = state.lock() { + if let Some(frame) = &stl.latest { + let local_now = Local::now(); + let sub_ms = ((frame.frames as f64 / frame.frame_rate) * 1000.0) + .round() as i64; + let base_time = NaiveTime::from_hms_opt( + frame.hours, + frame.minutes, + frame.seconds, + ).unwrap_or(local_now.time()); + let offset_dt = local_now.date_naive().and_time(base_time) + + ChronoDuration::milliseconds(sub_ms); + let ltc_dt = Local.from_local_datetime(&offset_dt) + .single() + .unwrap_or(local_now); + let ts = format!("{:02}:{:02}:{:02}.{:03}", + ltc_dt.hour(), + ltc_dt.minute(), + ltc_dt.second(), + ltc_dt.timestamp_subsec_millis() + ); + let res = Command::new("sudo") + .arg("date") + .arg("-s") + .arg(&ts) + .status(); + let msg = if res.as_ref().map_or(false, |s| s.success()) { + format!("🔄 Auto-synced to LTC: {}", ts) + } else { + "❌ Auto-sync failed".into() + }; + if logs.len() == 10 { + logs.pop_front(); + } + logs.push_back(msg); + } + } + out_of_sync_since = None; + } + } else { + out_of_sync_since = Some(Instant::now()); + } + } else { + out_of_sync_since = None; + } + + // 7️⃣ Draw static UI header + queue!( + stdout, + MoveTo(0, 0), Clear(ClearType::All), + MoveTo(2, 1), Print("NTP Timeturner v2 - Rust Port"), + MoveTo(2, 2), Print(format!("Using Serial Port: {}", serial_port)), + MoveTo(2, 3), Print(format!("NTP Server : {}", if ntp_active { "ACTIVE" } else { "INACTIVE" })), + MoveTo(2, 4), Print(format!("Interfaces : {}", interfaces.join(", "))), + ) + .unwrap(); + + // 8️⃣ Draw LTC and System Clock + if let Ok(st) = state.lock() { + if let Some(frame) = &st.latest { + queue!( + stdout, + MoveTo(2, 6), Print(format!("LTC Status : {}", frame.status)), + MoveTo(2, 7), Print(format!( + "LTC Timecode : {:02}:{:02}:{:02}:{:02}", + frame.hours, frame.minutes, frame.seconds, frame.frames + )), + MoveTo(2, 8), Print(format!("Frame Rate : {:.2}fps", frame.frame_rate)), + ) + .unwrap(); + } else { + queue!( + stdout, + MoveTo(2, 6), Print("LTC Status : (waiting)"), + MoveTo(2, 7), Print("LTC Timecode : …"), + MoveTo(2, 8), Print("Frame Rate : …"), + ) + .unwrap(); + } + let now_local = Local::now(); + let sys_ts = format!("{:02}:{:02}:{:02}.{:03}", + now_local.hour(), now_local.minute(), now_local.second(), now_local.timestamp_subsec_millis() + ); + queue!(stdout, MoveTo(2, 9), Print(format!("System Clock : {}", sys_ts))).unwrap(); + } + + // 9️⃣ Overlay metrics in new order + // Timecode Δ line + let dcol = if cached_delta_ms.abs() < 20 { + Color::Green + } else if cached_delta_ms.abs() < 100 { + Color::Yellow + } else { + Color::Red + }; + queue!( + stdout, + MoveTo(2, 11), SetForegroundColor(dcol), + Print(format!("Timecode Δ : {:+} ms ({:+} frames)", cached_delta_ms, cached_delta_frames)), + ResetColor, + ) + .unwrap(); + + // Sync Status line + let scol = if status_str == "IN SYNC" { + Color::Green + } else { + Color::Red + }; + queue!( + stdout, + MoveTo(2, 12), SetForegroundColor(scol), + Print(format!("Sync Status : {}", status_str)), + ResetColor, + ) + .unwrap(); + + // Sync Jitter line + let jstatus = if avg_ms.abs() < 10 { + "GOOD" + } else if avg_ms.abs() < 40 { + "AVERAGE" + } else { + "BAD" + }; + let jcol = if jstatus == "GOOD" { + Color::Green + } else if jstatus == "AVERAGE" { + Color::Yellow + } else { + Color::Red + }; + queue!( + stdout, + MoveTo(2, 13), SetForegroundColor(jcol), + Print(format!("Sync Jitter : {}", jstatus)), + ResetColor, + ) + .unwrap(); + + // Lock Ratio line + queue!(stdout, + MoveTo(2, 14), Print(format!("Lock Ratio : {:.1}% LOCK", lock_ratio)), + ) + .unwrap(); + + // 10️⃣ Footer and logs + queue!(stdout, + MoveTo(2, 16), Print("[S] Set system clock to LTC [Q] Quit"), + ) + .unwrap(); + for (i, log_msg) in logs.iter().enumerate() { + queue!(stdout, MoveTo(2, 18 + i as u16), Print(log_msg)).unwrap(); + } + + stdout.flush().unwrap(); + + // 11️⃣ Handle manual sync and quit keys + if poll(Duration::from_millis(50)).unwrap() { + if let Event::Key(evt) = read().unwrap() { + match evt.code { + KeyCode::Char(c) if c.eq_ignore_ascii_case(&'q') => { + execute!(stdout, Show, LeaveAlternateScreen).unwrap(); + terminal::disable_raw_mode().unwrap(); + process::exit(0); + } + KeyCode::Char(c) if c.eq_ignore_ascii_case(&'s') => { + if let Ok(stlock) = state.lock() { + if let Some(frame) = &stlock.latest { + let local_now = Local::now(); + let sub_ms = ((frame.frames as f64 / frame.frame_rate) * 1000.0) + .round() as i64; + let base_time = NaiveTime::from_hms_opt( + frame.hours, + frame.minutes, + frame.seconds, + ) + .unwrap_or(local_now.time()); + let offset_dt = local_now.date_naive().and_time(base_time) + + ChronoDuration::milliseconds(sub_ms); + let ltc_dt = Local.from_local_datetime(&offset_dt) + .single() + .unwrap_or(local_now); + let ts = format!( + "{:02}:{:02}:{:02}.{:03}", + ltc_dt.hour(), + ltc_dt.minute(), + ltc_dt.second(), + ltc_dt.timestamp_subsec_millis(), + ); + let res = Command::new("sudo") + .arg("date") + .arg("-s") + .arg(&ts) + .status(); + let msg = if res.as_ref().map_or(false, |s| s.success()) { + format!("✔ Synced exactly to LTC: {}", ts) + } else { + "❌ date cmd failed".into() + }; + if logs.len() == 10 { + logs.pop_front(); + } + logs.push_back(msg); + } + } + } + _ => {} + } + } + } + + thread::sleep(Duration::from_millis(50)); + } +} From 1b51e45d87f58216429c79b16696a3819c0c6cbd Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 12:39:54 +0100 Subject: [PATCH 17/18] ui --- src/ui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui.rs b/src/ui.rs index 149a7d1..a8228c0 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -104,7 +104,7 @@ pub fn start_ui( } // 4️⃣ Compute averages & statuses - let (avg_ms, _avg_frames, status_str, lock_ratio, avg_delta) = { + let (avg_ms, avg_frames, status_str, lock_ratio, avg_delta) = { let st = state.lock().unwrap(); ( st.average_jitter(), From fe98dad76456c942e0b662793cd2e0cac62e1679 Mon Sep 17 00:00:00 2001 From: John Rogers Date: Mon, 21 Jul 2025 14:23:35 +0100 Subject: [PATCH 18/18] merged ui.rs for PR merge --- src/ui.rs | 53 +++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/ui.rs b/src/ui.rs index a8228c0..325b20e 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -7,6 +7,7 @@ use std::{ thread, time::{Duration, Instant}, }; +use std::collections::VecDeque; use chrono::{Local, Timelike, Utc, NaiveTime, Duration as ChronoDuration, TimeZone}; use crossterm::{ @@ -18,22 +19,23 @@ use crossterm::{ }; use get_if_addrs::get_if_addrs; -use std::collections::VecDeque; use crate::sync_logic::LtcState; -/// Check if the ntpd service is active +/// Check if the Chrony service is active fn ntp_service_active() -> bool { - if let Ok(output) = Command::new("systemctl").args(&["is-active", "ntpd"]).output() { - output.status.success() && String::from_utf8_lossy(&output.stdout).trim() == "active" + if let Ok(output) = Command::new("systemctl").args(&["is-active", "chrony"]).output() { + output.status.success() + && String::from_utf8_lossy(&output.stdout).trim() == "active" } else { false } } -/// Toggle the ntpd service (start if `start` is true, stop otherwise) -fn ntp_service_toggle(start: bool) { +/// Toggle the Chrony service (start if `start` is true, stop otherwise) + +fn _ntp_service_toggle(start: bool) { let action = if start { "start" } else { "stop" }; - let _ = Command::new("systemctl").args(&[action, "ntpd"]).status(); + let _ = Command::new("systemctl").args(&[action, "chrony"]).status(); } /// Launch the full-featured TUI; reads `offset` live and performs auto-sync if out of sync. @@ -61,7 +63,7 @@ pub fn start_ui( // 1️⃣ Read hardware offset from watcher let hw_offset_ms = *offset.lock().unwrap(); - // 2️⃣ Check NTP service status and gather network interfaces + // 2️⃣ Check Chrony status and gather network interfaces let ntp_active = ntp_service_active(); let interfaces: Vec = get_if_addrs() .unwrap_or_default() @@ -81,14 +83,11 @@ pub fn start_ui( let measured = raw - hw_offset_ms; st.record_offset(measured); - // Timecode delta: how far system clock differs from LTC + // Timecode delta let local = Local::now(); let sub_ms = ((frame.frames as f64 / frame.frame_rate) * 1000.0).round() as i64; - let base_time = NaiveTime::from_hms_opt( - frame.hours, - frame.minutes, - frame.seconds, - ).unwrap_or(local.time()); + let base_time = NaiveTime::from_hms_opt(frame.hours, frame.minutes, frame.seconds) + .unwrap_or(local.time()); let offset_dt = local.date_naive().and_time(base_time) + ChronoDuration::milliseconds(sub_ms); let ltc_dt = Local.from_local_datetime(&offset_dt) @@ -104,7 +103,7 @@ pub fn start_ui( } // 4️⃣ Compute averages & statuses - let (avg_ms, avg_frames, status_str, lock_ratio, avg_delta) = { +let (avg_ms, _avg_frames, status_str, lock_ratio, avg_delta) = { let st = state.lock().unwrap(); ( st.average_jitter(), @@ -128,8 +127,8 @@ pub fn start_ui( last_delta_update = Instant::now(); } - // 6️⃣ Auto-sync if "OUT OF SYNC" or Δ >10ms for 5s - if status_str == "OUT OF SYNC" || cached_delta_ms.abs() > 10 { + // 6️⃣ Auto-sync if "OUT OF SYNC" or Δ >5ms for 5s + if status_str == "OUT OF SYNC" || cached_delta_ms.abs() > 5 { if let Some(start) = out_of_sync_since { if start.elapsed() >= Duration::from_secs(5) { // Perform sync to LTC @@ -183,9 +182,9 @@ pub fn start_ui( queue!( stdout, MoveTo(0, 0), Clear(ClearType::All), - MoveTo(2, 1), Print("NTP Timeturner v2 - Rust Port"), - MoveTo(2, 2), Print(format!("Using Serial Port: {}", serial_port)), - MoveTo(2, 3), Print(format!("NTP Server : {}", if ntp_active { "ACTIVE" } else { "INACTIVE" })), + MoveTo(2, 1), Print("Have Blue - NTP Timeturner - FrameWorks Testing"), + MoveTo(2, 2), Print(format!("Serial Port : {}", serial_port)), + MoveTo(2, 3), Print(format!("Chrony Service : {}", if ntp_active { "RUNNING" } else { "MISSING" })), MoveTo(2, 4), Print(format!("Interfaces : {}", interfaces.join(", "))), ) .unwrap(); @@ -220,7 +219,6 @@ pub fn start_ui( } // 9️⃣ Overlay metrics in new order - // Timecode Δ line let dcol = if cached_delta_ms.abs() < 20 { Color::Green } else if cached_delta_ms.abs() < 100 { @@ -236,7 +234,6 @@ pub fn start_ui( ) .unwrap(); - // Sync Status line let scol = if status_str == "IN SYNC" { Color::Green } else { @@ -250,7 +247,6 @@ pub fn start_ui( ) .unwrap(); - // Sync Jitter line let jstatus = if avg_ms.abs() < 10 { "GOOD" } else if avg_ms.abs() < 40 { @@ -273,15 +269,16 @@ pub fn start_ui( ) .unwrap(); - // Lock Ratio line - queue!(stdout, + queue!( + stdout, MoveTo(2, 14), Print(format!("Lock Ratio : {:.1}% LOCK", lock_ratio)), ) .unwrap(); // 10️⃣ Footer and logs - queue!(stdout, - MoveTo(2, 16), Print("[S] Set system clock to LTC [Q] Quit"), + queue!( + stdout, + MoveTo(2, 16), Print("[S] Sync system clock to LTC [Q] Quit"), ) .unwrap(); for (i, log_msg) in logs.iter().enumerate() { @@ -345,6 +342,6 @@ pub fn start_ui( } } - thread::sleep(Duration::from_millis(50)); + thread::sleep(Duration::from_millis(25)); } }