DVR-246: complete RTC and timezone handling overhaul
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-safelocaltime_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()andrtc_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 tmstorage -
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)