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
|