Skip to content

Conversation

@cobalt-github-releaser-bot
Copy link
Collaborator

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.cc to redetermine time zone from system whenever SbTimeZoneGetName is called. Check the SbTimeZoneGetName implementation 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

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.cc` to redetermine time zone
from system whenever `SbTimeZoneGetName` is called. Check the
`SbTimeZoneGetName` implementation on ATV,
[ATV](https://source.corp.google.com/h/github/youtube/cobalt/+/main:starboard/android/shared/time_zone_get_name.cc;l=28?q=SbTimeZoneGetName&ss=h%2Fgithub%2Fyoutube%2Fcobalt%2F%2B%2Frefs%2Fheads%2Fmain)
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

(cherry picked from commit 56b39bb)
@cobalt-github-releaser-bot
Copy link
Collaborator Author

MERGE CONFLICT CAT

Caution

There were merge conflicts while cherry picking! Check out cherry-pick-main-8935 and fix the conflicts before proceeding. Check the log at https://github.com/youtube/cobalt/actions/runs/21920389140 for details.

@github-actions
Copy link

🤖 Gemini Suggested Commit Message


linux: Add time zone monitor

This change introduces a time zone monitor for Linux platforms. It
utilizes inotify to observe changes in system time zone configuration
files such as /etc/localtime, /etc/timezone, and /etc/TZ. When a
modification is detected, a kSbEventDateTimeConfigurationChanged event
is injected into the Starboard application event queue.

This enables Cobalt applications to dynamically react to system time zone
updates without requiring a restart, ensuring better consistency for
time-sensitive features. Additionally, the caching mechanism in
SbTimeZoneGetName for Linux is removed, ensuring that the current system
time zone is always re-determined upon each call.
Bug: 448161236

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants