Skip to content

Conversation

@chrisgalanis
Copy link
Contributor

@chrisgalanis chrisgalanis commented Jan 14, 2026

This pull request improves the system time synchronization logic in hil/src/commands/ota/system.rs by introducing a fallback mechanism when NTP/chrony-based sync fails. Instead of failing immediately, the code now compares the device's time with the local PC and allows a tolerance of up to one month. This makes the OTA process more robust to minor time discrepancies.

Enhancements to time synchronization robustness:

  • Changed timeout handling in wait_for_time_sync to log a warning and fall back to a date comparison instead of failing immediately if NTP/chrony sync does not complete.
  • Added the check_time_difference_fallback function, which compares the Orb's time with the local PC and accepts a difference of up to 30 days. This helps avoid unnecessary failures due to minor clock drift.

Logging improvements:

  • Imported warn from tracing and added more informative logging to indicate fallback behavior and time difference results. [1] [2]

@chrisgalanis chrisgalanis requested a review from a team as a code owner January 14, 2026 21:56
@chrisgalanis chrisgalanis changed the title fix: fallback date comparison fix(ota-hil): fallback date comparison Jan 14, 2026
@chrisgalanis chrisgalanis marked this pull request as draft January 14, 2026 22:07
@chrisgalanis chrisgalanis force-pushed the chris/pearl-hil-ota branch 2 times, most recently from d887214 to 208ddcd Compare January 15, 2026 12:48
chrisgalanis and others added 9 commits January 15, 2026 18:10
This pull request introduces improvements to the OTA update process and
device reboot logic, with a focus on configurability, reliability, and
robustness around time synchronization and FTDI device handling. The
most important changes are grouped below:

**OTA Update Process Improvements:**

* Added a `--skip-time-sync-before-reboot` flag to the `Ota` command,
allowing users to optionally skip the NTP time synchronization check
before the first reboot. Time sync is still enforced after reboot and
before starting the update.
[[1]](diffhunk://#diff-4417a067e971532511cd378570394d24d393625d1e510ecc9475239495917805R72-R76)
[[2]](diffhunk://#diff-4417a067e971532511cd378570394d24d393625d1e510ecc9475239495917805L108-R132)
* Ensured that the log directory is created or verified before starting
the OTA process, improving reliability of log file handling.

**Device Reboot and FTDI Handling:**

* Refactored the reboot logic to use named constants for timing delays
and clarified the handling of the recovery pin state, making the reboot
process more maintainable and readable.
[[1]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cR26-R28)
[[2]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cL40-R48)
[[3]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cL49-R68)
[[4]](diffhunk://#diff-201f44f16c361cb2807a9ba916d437dd592b40a19e0a1b9f095b37e3ea38cd7cL77-R85)

**Time Synchronization Robustness:**

* Enhanced the time synchronization check to detect and use either
`chronyc` or `timedatectl` (preferring `chronyc` if available), with
robust error handling and command timeouts. This ensures the system
waits for accurate time sync using the best available tool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants