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] [PATCH] hvm: correct time offset update in RTC write emulati

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] hvm: correct time offset update in RTC write emulation
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 09 Mar 2010 09:23:33 +0000
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 09 Mar 2010 01:24:23 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1268126608 0
# Node ID 3b292a8858d2340a2a47d98ccc7fde9070075a42
# Parent  e5d1ae8238cc5f028fd5790c7d658aaba133bb5a
hvm: correct time offset update in RTC write emulation

mktime takes a month in 1..12 form while tm->tm_mon contains 0..11 so
we need to add 1. Without this fix setting the month back or forward a
month inside the guest would lead to the wrong number of days being
added/subtracted.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r e5d1ae8238cc -r 3b292a8858d2 xen/arch/x86/hvm/rtc.c
--- a/xen/arch/x86/hvm/rtc.c    Fri Feb 26 12:08:20 2010 +0000
+++ b/xen/arch/x86/hvm/rtc.c    Tue Mar 09 09:23:28 2010 +0000
@@ -165,7 +165,7 @@
       
     ASSERT(spin_is_locked(&s->lock));
 
-    before = mktime(tm->tm_year, tm->tm_mon, tm->tm_mday,
+    before = mktime(tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
                    tm->tm_hour, tm->tm_min, tm->tm_sec);
     
     tm->tm_sec = from_bcd(s, s->hw.cmos_data[RTC_SECONDS]);
@@ -179,7 +179,7 @@
     tm->tm_mon = from_bcd(s, s->hw.cmos_data[RTC_MONTH]) - 1;
     tm->tm_year = from_bcd(s, s->hw.cmos_data[RTC_YEAR]) + 100;
 
-    after = mktime(tm->tm_year, tm->tm_mon, tm->tm_mday,
+    after = mktime(tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
                    tm->tm_hour, tm->tm_min, tm->tm_sec);
 
     /* We use the guest's setting of the RTC to define the local-time 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] hvm: correct time offset update in RTC write emulation, Ian Campbell <=