X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d0ca21133e420f63c90d44e6b8bd23273e2ffd58..39627668ca36cecbc78ec5f677061f128957b550:/lib/python/Components/Timezones.py diff --git a/lib/python/Components/Timezones.py b/lib/python/Components/Timezones.py index 0b6eb79b..ccc98279 100644 --- a/lib/python/Components/Timezones.py +++ b/lib/python/Components/Timezones.py @@ -4,8 +4,6 @@ from xml.sax.handler import ContentHandler import os import time -from enigma import * - class Timezones: class parseTimezones(ContentHandler): def __init__(self, timezones): @@ -23,16 +21,27 @@ 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() except: - etimezone() + from enigma import e_tzset + e_tzset() def getTimezoneList(self): list = [] @@ -42,6 +51,6 @@ class Timezones: def getDefaultTimezone(self): # TODO return something more useful - depending on country-settings? - return 27 + return "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Vienna" timezones = Timezones()