from xml.sax import make_parser
from xml.sax.handler import ContentHandler
-import os
+from os import environ, unlink, symlink
import time
-from enigma import *
-
class Timezones:
class parseTimezones(ContentHandler):
def __init__(self, timezones):
if len(self.timezones) <= index:
return
- os.environ['TZ'] = self.timezones[index][1]
+ environ['TZ'] = self.timezones[index][1]
+ try:
+ unlink("/etc/localtime")
+ except OSError:
+ pass
+ try:
+ symlink("/usr/share/zoneinfo/%s" %(self.timezones[index][1]), "/etc/localtime")
+ except OSError:
+ pass
try:
time.tzset()
except:
- etimezone()
+ 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()