Skip to content

DVR-246: complete RTC and timezone handling overhaul

Hosseini requested to merge DVR-246-date-and-time-issue into master

Comprehensive fix for RTC synchronization, timezone management, and time handling across all modules. Replaces unreliable shell commands with direct RTC ioctl operations and ensures thread-safe time functions throughout the system.

  • Added GSF_ID_BSP_RTC_TIME (13) and GSF_ID_BSP_TIMEZONE (14) message types

  • Implemented timezone framework with fallback to UTC-3:30 (Iran/Tehran)

  • Added proper RTC open/close functions with error handling

  • Replaced localtime() with thread-safe localtime_r() in all modules

  • Consolidated time update logic into rtc_update_utc_field()

  • Simplified settings page to use single rtc_set_local_datetime() call

  • Changed from local time to UTC-based time management system-wide

  • Replaced multiple system("hwclock") calls with direct RTC ioctl operations

  • Added rtc_sync_from_hw() and rtc_sync_to_hw() for clean RTC<->system sync

  • Fixed boot-time RTC initialization to properly handle UTC times

  • Added graceful RTC shutdown on process termination

  • Replaced individual time variables with struct tm storage

  • Added time change detection to only update when necessary

  • Batch time component updates into single RTC operation

  • Preserves seconds when updating date/time components

  • All modules (app, rec, bsp) now properly set timezone from BSP configuration

  • OSD, status bar, and recording functions use thread-safe time functions

  • Added signal handlers for clean shutdown in BSP module

  • Updated default timezone to UTC-3:30 in JSON configs and startup script

  • Fixed zone value from -480 to -210 (3.5 hours behind UTC)

Merge request reports

Loading