git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add pluginlist reload, fix type (thx to Ali Abdul)
[enigma2.git]
/
lib
/
python
/
Components
/
Timezones.py
diff --git
a/lib/python/Components/Timezones.py
b/lib/python/Components/Timezones.py
index ccc982797e8c466b521362ce9c2145c98d4a2ba2..f3e24ee6c766eb4cd502c0efa47e050b1a52d849 100644
(file)
--- a/
lib/python/Components/Timezones.py
+++ b/
lib/python/Components/Timezones.py
@@
-1,7
+1,7
@@
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
-import os
+from os import environ, unlink, symlink
import time
class Timezones:
import time
class Timezones:
@@
-36,7
+36,15
@@
class Timezones:
if len(self.timezones) <= index:
return
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:
try:
time.tzset()
except:
@@
-51,6
+59,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 "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Vienna"
+ 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()