From: Felix Domke Date: Thu, 17 Nov 2005 20:53:32 +0000 (+0000) Subject: timezone handling: when there is no timezone, use UTC. ignore illegal config values X-Git-Tag: 2.6.0~5106 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/d801f7ab1029416b489c32e15a857e2ce963015c timezone handling: when there is no timezone, use UTC. ignore illegal config values --- diff --git a/lib/python/Components/Timezones.py b/lib/python/Components/Timezones.py index 0b6eb79b..15837450 100644 --- a/lib/python/Components/Timezones.py +++ b/lib/python/Components/Timezones.py @@ -23,11 +23,21 @@ class Timezones: def readTimezonesFromFile(self): parser = make_parser() - timezonesHandler = self.parseTimezones(self.timezones) - parser.setContentHandler(timezonesHandler) - parser.parse('/etc/timezone.xml') + + try: + timezonesHandler = self.parseTimezones(self.timezones) + parser.setContentHandler(timezonesHandler) + parser.parse('/etc/timezone.xml') + except: + pass + + if len(self.timezones) == 0: + self.timezones = [("UTC", "UTC")] def activateTimezone(self, index): + if len(self.timezones) <= index: + return + os.environ['TZ'] = self.timezones[index][1] try: time.tzset()