From 080c2a83b79af8afe48105bb0a1b69d3597a2e49 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Mon, 20 Aug 2007 10:17:35 +0000 Subject: [PATCH] set /etc/localtime link when change the timezone too --- lib/python/Components/Timezones.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/python/Components/Timezones.py b/lib/python/Components/Timezones.py index 6e43aa21..d9edfec5 100644 --- 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 -import os +from os import environ, unlink, symlink import time class Timezones: @@ -36,7 +36,12 @@ class 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 + symlink("/usr/share/zoneinfo/%s" %(self.timezones[index][1]), "/etc/localtime") try: time.tzset() except: -- 2.30.2