KOS Time Model - System time management with real-time synchronization and timezone control.
This singleton model provides centralized control over system time, date, and timezone settings
with automatic event propagation when changes occur. Essential for applications that need to
synchronize time-based operations, schedule events, or maintain consistent timestamps across
the system.
System Clock Management - Synchronize device time with server time
Scheduled Operations - Trigger events based on time changes
Multi-timezone Support - Handle devices in different time zones
Time-based UI Updates - Keep clocks and calendars synchronized
Audit Logging - Ensure consistent timestamps across the system
Day Rollover Handling - Reset daily counters or refresh data
Example: Basic Usage
consttimeModel = KosTime.instance().build();
// Update system time and date awaittimeModel.updateSystemTime({ hour:15, min:45, sec:30 }); awaittimeModel.updateSystemDate({ month:3, day:15, year:2024 }); awaittimeModel.updateSystemTimezone('America/New_York');
Use Declared Type
See
TimeBean - Time value structure (hour, minute, second)
DateBean - Date value structure (month, day, year)
KOS Time Model - System time management with real-time synchronization and timezone control.
This singleton model provides centralized control over system time, date, and timezone settings with automatic event propagation when changes occur. Essential for applications that need to synchronize time-based operations, schedule events, or maintain consistent timestamps across the system.
Key Features
Topic-Based Reactivity
The model listens to three KOS topics for time synchronization:
/kos/time/time- Fired when system time changes (hour/minute/second)/kos/time/day- Fired when the date changes (day rollover or manual change)/kos/time/timezone- Fired when timezone is updatedAdditionally, the model publishes to internal EventBus topics:
TIME_CHANGE- For UI components to react to time updatesDAY_CHANGE- For date-dependent UI updatesTIMEZONE_CHANGE- For timezone-aware componentsCommon Use Cases
Example: Basic Usage
Use Declared Type
See