tools: Fix time offset when localtime=0

localtime can be stored in vm config as a string, resulting in
incorrect calculation of rtc_timeoffset.  Cast localtime to int
to ensure rtc_timeoffset is calculated properly.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
xen-unstable changeset:   21460:15f4ead9e686
xen-unstable date:        Wed May 26 08:15:31 2010 +0100
This commit is contained in:
Keir Fraser committed 2010-05-26 08:29:15 +01:00
1 parent 1a830511d1
commit 0bfde44856
1 file changed
+1 -1
+1 -1
View File
@@ -129,7 +129,7 @@ class ImageHandler:
self.dmargs = self.parseDeviceModelArgs(vmConfig)
self.pid = None
rtc_timeoffset = int(vmConfig['platform'].get('rtc_timeoffset', 0))
if vmConfig['platform'].get('localtime', 0):
if int(vmConfig['platform'].get('localtime', 0)):
if time.localtime(time.time())[8]:
rtc_timeoffset -= time.altzone
else:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.