Cherry pick PR #8935: Implement time zone monitor for linux #9059
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refer to the original PR: #8935
Adds a time zone monitor for Linux platforms using inotify. It observes
changes to system time zone configuration files such as /etc/localtime.
Upon detecting a modification, a kSbEventDateTimeConfigurationChanged
event is injected into the Starboard application event queue. This allows
Cobalt to dynamically react to system time zone updates without requiring
a restart, improving time-sensitive feature consistency.
Have to remove the time zone caching mechanism in
starboard/shared/linux/time_zone_get_name.ccto redetermine time zone from system wheneverSbTimeZoneGetNameis called. Check theSbTimeZoneGetNameimplementation on ATV, ATV does not have the caching mechanism to determine the time zone only once either.The TimeZoneMonitor class uses a inifinite blocking poll command to watch system time zone files, and non-blocking read command to read the time zone change to buffer to avoid read command hanging the thread, and a blocking write command to signal the destruction of TimeZoneMonitor.
Test: (on evergreen-x64)
Before this change: http://screencast/cast/NDc5OTQwMDc5MzYwNDA5Nnw1MjJlOWM1OC00Yg
After this change: http://screencast/cast/NTg2NDY3NDA0OTM5MjY0MHw4NmIwOThjZS0zMw
Bug: 448161236