/usr/bin/systime
Main executable file
Kylin sdk system time monitoring service
kysdk-systime
kysdk-systime is a system time monitoring service in the KYLIN SDK system. This service provides real-time system time broadcasting and monitoring capabilities, detecting system time changes and timezone changes, and broadcasting time information through D-Bus signals.
The service runs as a system daemon that continuously monitors the system clock for changes and broadcasts time updates every minute. It also monitors for system time adjustments and timezone changes, ensuring accurate time information is available to all subscribed applications.
Real-time Time Broadcasting
|
Broadcasts current system time every minute through D-Bus signals |
|---|---|
System Time Change Detection
|
Monitors and detects system time adjustments using timerfd |
Timezone Change Monitoring
|
Monitors changes to system timezone settings using inotify |
D-Bus Signal Broadcasting
|
Provides time information through D-Bus signals for inter-process communication |
Precise Timing
|
Uses high-precision timers for accurate time synchronization |
The service implements the following D-Bus interface `com.kylin.kysdk.TimeInterface` with these signals:
TimeSignalEmitted every minute with current time information in format: "YYYY/MM/DD HH:MM:SS"
TimeChangeSignalEmitted when system time or timezone changes, providing updated time information
Detects manual time adjustments, NTP synchronization, and other time modifications
Monitors changes to /etc/localtime for timezone updates
Handles clock synchronization and drift correction
The service uses a multi-threaded architecture:
Main Thread
|
Handles D-Bus communication and main event loop |
|---|---|
Time Change Monitor Thread
|
Monitors system time changes using timerfd |
Timezone Monitor Thread
|
Monitors timezone changes using inotify |
Time Broadcast Thread
|
Manages periodic time broadcasting |
Periodic Timer
|
Runs every 60 seconds for regular time broadcasting |
|---|---|
Single-shot Timer
|
Used for immediate time change notifications |
Timer Synchronization
|
Automatically resynchronizes when time changes are detected |
/usr/bin/systime
Main executable file
/etc/systemd/system/kysdk-systime.service
Systemd service configuration file
/etc/localtime
Monitored file for timezone changes
The service runs as a systemd service with: - Service name: kysdk-systime.service - D-Bus name: com.kylin.kysdk.TimeServer - Object path: /com/kylin/kysdk/Timer - Interface: com.kylin.kysdk.TimeInterface - Type: D-Bus activated service
|
For inter-process communication |
|---|---|
|
For main loop integration |
|
For timer management functionality |
|
For service management |
SIGTERM, SIGINT
|
Graceful shutdown signals |
|---|---|
|
Special timer flag for detecting time changes |
All time information is broadcast in the following format: YYYY/MM/DD HH:MM:SS - 4-digit year - 2-digit month (01-12) - 2-digit day (01-31) - 2-digit hour (00-23) - 2-digit minute (00-59) - 2-digit second (00-59)
Automatic Resync
|
Automatically resynchronizes timers when time changes are detected |
|---|---|
Mis-sync Handling
|
Detects and corrects timing drift or missed notifications |
Timer Management
|
Intelligently manages periodic and single-shot timers |