debuggers.hg
changeset 21059:31ee49f2c4ea
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@citrix.com>
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@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Mar 09 09:57:25 2010 +0000 (2010-03-09) |
parents | ef845a385014 |
children | efa827c5bf73 |
files | xen/arch/x86/hvm/rtc.c |
line diff
1.1 --- a/xen/arch/x86/hvm/rtc.c Tue Mar 09 09:54:39 2010 +0000 1.2 +++ b/xen/arch/x86/hvm/rtc.c Tue Mar 09 09:57:25 2010 +0000 1.3 @@ -165,7 +165,7 @@ static void rtc_set_time(RTCState *s) 1.4 1.5 ASSERT(spin_is_locked(&s->lock)); 1.6 1.7 - before = mktime(tm->tm_year, tm->tm_mon, tm->tm_mday, 1.8 + before = mktime(tm->tm_year, tm->tm_mon + 1, tm->tm_mday, 1.9 tm->tm_hour, tm->tm_min, tm->tm_sec); 1.10 1.11 tm->tm_sec = from_bcd(s, s->hw.cmos_data[RTC_SECONDS]); 1.12 @@ -179,7 +179,7 @@ static void rtc_set_time(RTCState *s) 1.13 tm->tm_mon = from_bcd(s, s->hw.cmos_data[RTC_MONTH]) - 1; 1.14 tm->tm_year = from_bcd(s, s->hw.cmos_data[RTC_YEAR]) + 100; 1.15 1.16 - after = mktime(tm->tm_year, tm->tm_mon, tm->tm_mday, 1.17 + after = mktime(tm->tm_year, tm->tm_mon + 1, tm->tm_mday, 1.18 tm->tm_hour, tm->tm_min, tm->tm_sec); 1.19 1.20 /* We use the guest's setting of the RTC to define the local-time