[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Bug: Change: 16932 xend: Obey localtime config option for HVM guests as well as PV guests


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Ross S. W. Walker" <rwalker@xxxxxxxxxxxxx>
  • Date: Fri, 28 Mar 2008 15:05:38 -0400
  • Delivery-date: Fri, 28 Mar 2008 12:06:03 -0700
  • Importance: normal
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Priority: normal
  • Thread-index: AciRBrW0qrDr3OZ/RhS5FeCG608JDw==
  • Thread-topic: Bug: Change: 16932 xend: Obey localtime config option for HVM guests as well as PV guests

 
The calculation done for the local offset is not only redundant,
but doesn't take daylight savings into account.

>From the Python time module manual:

altzone 
The offset of the local DST timezone, in seconds west of UTC, if one is
defined. This is negative if the local DST timezone is east of UTC
(as in Western Europe, including the UK). Only use this if daylight is
nonzero. 

timezone 
The offset of the local (non-DST) timezone, in seconds west of UTC
(negative in most of Western Europe, positive in the US, zero in the UK). 

Given that the module already calculates these, then
 
Instead of:
 
+            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

May I suggest something along the lines of:
 
+            if self.info['platform'].get('localtime', 0):
+                if time.localtime(time.time())[8]:
+                    self.info['platform']['rtc_timeoffset'] = -time.altzone
+                else:
+                    self.info['platform']['rtc_timeoffset'] = -time.timezone


I have tested this change on 3.2.0 and appears to do the trick.


Ross S. W. Walker
Information Systems Manager
Medallion Financial, Corp.
437 Madison Avenue
38th Floor
New York, NY 10022
Tel: (212) 328-2165
Fax: (212) 328-2125
WWW: http://www.medallion.com <http://www.medallion.com/>  


______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.