Skip to content

[settings] fixed: set timezone during initialization #4095

Merged
merged 1 commit into from Feb 11, 2014

6 participants

@vkosh
vkosh commented Jan 27, 2014

This sets timezone during xbmc loading.
To reproduce the bug:
1. go to settings and set timezone to something different from system one, note the time changed on home screen.
2. restart xbmc.
3. note that time on home screen corresponds to system timezone, but not the selected one.
4. go to settings and reset timezone, note the time changed to selected timezone.

@t-nelson

Does this need to happen more generally to hit platforms besides linux?

@Montellese
Team Kodi member

Using the OnSettingUpdate() is not the right way to go. The proper way to do this is to manually set the timezone on linux during startup after having loaded the settings. That's how it works for everything else as well (resolution, gui language etc).

@t-nelson: IIRC only linux has a timezone implementation right now.

@t-nelson
@davilla
davilla commented Jan 27, 2014

darwin does.

@vkosh
vkosh commented Jan 27, 2014

@t-nelson: I think CApplication::Initialize is also not correct place for setting TZ, because, for example, switching between profiles with the different TZ settings will not work in this case.
The right way IMO is to implement ISettingsHandler::OnSettingsLoaded in CLinuxTimezone.
@Montellese @t-nelson: if there is no objection I'll implement the fix this way.

@t-nelson
@vkosh
vkosh commented Jan 27, 2014

@t-nelson: As I can see in CSettings, CLinuxTimezone is the only handler for locale.timezone and locale.timezonecountry settings, and it affects linux systems only.

@davilla: Do the settings really change TZ on darwin platforms?

@vkosh
vkosh commented Jan 27, 2014

Looks like it's another regression.
On Frodo we have initialization during settings loading and TZ settings should work on any "_LINUX" platform except android: see https://github.com/xbmc/xbmc/blob/Frodo/configure.in#L551 and https://github.com/xbmc/xbmc/blob/Frodo/xbmc/settings/GUISettings.cpp#L1424
On Gotham there is no initialization (subject of the PR) and "TARGET_LINUX" platforms supported only: see https://github.com/xbmc/xbmc/blob/master/m4/xbmc_arch.m4 and https://github.com/xbmc/xbmc/blob/master/xbmc/settings/Settings.cpp#L1142

So, I think the PR should be rewritten as I mentioned above. And the second PR should be created to support platforms that were supported in Frodo.

@vkosh
vkosh commented Jan 28, 2014

Here is the new patch for tz initialization. I use TARGET_LINUX as the rest CLinuxTimezone callbacks currently registered for this target only. The other platforms support will be added in another PR.

@Montellese Montellese commented on an outdated diff Jan 28, 2014
xbmc/linux/LinuxTimezone.cpp
@@ -170,6 +170,17 @@ void CLinuxTimezone::OnSettingChanged(const CSetting *setting)
}
}
+void CLinuxTimezone::OnSettingsLoaded()
+{
+ CSettingString *setting = (CSettingString*)CSettings::Get().GetSetting("locale.timezone");
@Montellese
Team Kodi member
Montellese added a note Jan 28, 2014
SetTimezone(CSettings::Get().GetString("locale.timezone"));
CDateTime::ResetTimezoneBias();

would be enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Montellese
Team Kodi member

Yup looks like I missed the fact that darwin also handles timezones probably because of the name of CLinuxTimezone.

@vkosh
vkosh commented Jan 28, 2014

@Montellese: thanks, fixed

@t-nelson

jenkins build this please

@vkosh
vkosh commented Feb 11, 2014

looks like a problem with jenkins

@t-nelson

jenkins build this please

@t-nelson t-nelson merged commit bfc296b into xbmc:master Feb 11, 2014

1 check failed

Details default Merged build #194 failed in 29 min
@koying
Team Kodi member
koying commented Feb 15, 2014

IIRC, TARGET_LINUX is true for android, too, and this seems to cause a regression there...
cf. http://forum.xbmc.org/showthread.php?tid=186294

@t-nelson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.