From: Keir Fraser Date: Mon, 31 Mar 2008 15:41:53 +0000 (+0100) Subject: xend: Improve localtime calculation -- Python time module already X-Git-Tag: 3.1.4-rc3~14 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ec2aa9b4331a04285aa2f11ffd8397e14cc855a5;p=people%2Fvhanquez%2Fxen.git xend: Improve localtime calculation -- Python time module already provides the relevant information. From: Ross Walker Signed-off-by: Keir Fraser xen-unstable changeset: 17323:d24f37b31030bdc9305e40a9a71846e6f79909d7 xen-unstable date: Mon Mar 31 10:40:43 2008 +0100 --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 5543e28ca..edd75d415 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -1583,11 +1583,10 @@ class XendDomainInfo: try: if self.info['platform'].get('localtime', 0): - t = time.time() - loc = time.localtime(t) - utc = time.gmtime(t) - timeoffset = int(time.mktime(loc) - time.mktime(utc)) - self.info['platform']['rtc_timeoffset'] = timeoffset + if time.localtime(time.time())[8]: + self.info['platform']['rtc_timeoffset'] = -time.altzone + else: + self.info['platform']['rtc_timeoffset'] = -time.timezone self.image = image.create(self, self.info)