diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-11-17 20:53:32 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-11-17 20:53:32 +0000 |
| commit | d801f7ab1029416b489c32e15a857e2ce963015c (patch) | |
| tree | 5c36848e53e5149e5ad587040b5be11094265928 /lib/python/Components | |
| parent | c8da97052d1d98b1a9b5c59a38877867ff0f80c3 (diff) | |
| download | enigma2-d801f7ab1029416b489c32e15a857e2ce963015c.tar.gz enigma2-d801f7ab1029416b489c32e15a857e2ce963015c.zip | |
timezone handling: when there is no timezone, use UTC. ignore illegal config values
Diffstat (limited to 'lib/python/Components')
| -rw-r--r-- | lib/python/Components/Timezones.py | 16 |
1 files changed, 13 insertions, 3 deletions
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() |
