add stv0299 snr to dB Calculation (thx to adenin for this)
[enigma2.git] / lib / python / Components / Timezones.py
index 2eec17a67e9ed0202b2dedc904b16d76a37e9f9e..6e43aa21120c9e6d3d3367d6ffbf148a050e8999 100644 (file)
@@ -21,14 +21,27 @@ class Timezones:
 
        def readTimezonesFromFile(self):
                parser = make_parser()
 
        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):
                
        def activateTimezone(self, index):
+               if len(self.timezones) <= index:
+                       return
+               
                os.environ['TZ'] = self.timezones[index][1]
                os.environ['TZ'] = self.timezones[index][1]
-               # FIXME we need a tzset
-               #time.tzset()
+               try:
+                       time.tzset()
+               except:
+                       from enigma import e_tzset
+                       e_tzset()
                
        def getTimezoneList(self):
                list = []
                
        def getTimezoneList(self):
                list = []
@@ -38,6 +51,10 @@ class Timezones:
        
        def getDefaultTimezone(self):
                # TODO return something more useful - depending on country-settings?
        
        def getDefaultTimezone(self):
                # TODO return something more useful - depending on country-settings?
-               return 27
+               t = "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Vienna"
+               for (a,b) in self.timezones:
+                       if a == t:
+                               return a
+               return self.timezones[0][0]
 
 timezones = Timezones()
 
 timezones = Timezones()