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]
- # FIXME we need a tzset
- #time.tzset()
+ try:
+ time.tzset()
+ except:
+ from enigma import e_tzset
+ e_tzset()
def getTimezoneList(self):
list = []
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()