WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Bug: Change: 16932 xend: Obey localtime config option for HV

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Bug: Change: 16932 xend: Obey localtime config option for HVM guests as well as PV guests
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
Importance: normal
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Priority: normal
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] Bug: Change: 16932 xend: Obey localtime config option for HVM guests as well as PV guests, Ross S. W. Walker <=