diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-03-09 09:57:25 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-03-09 09:57:25 +0000 |
commit | 9e4f8153248f3db4e240e803759c764d83a0e54c (patch) | |
tree | 7832afa2ba2b7cf004a8d01fd15c439b84910bf8 | |
parent | 60440d9af3a721d9dc05f7cfd455624c0c328dfc (diff) | |
download | xen-9e4f8153248f3db4e240e803759c764d83a0e54c.tar.gz xen-9e4f8153248f3db4e240e803759c764d83a0e54c.tar.bz2 xen-9e4f8153248f3db4e240e803759c764d83a0e54c.zip |
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>
-rw-r--r-- | xen/arch/x86/hvm/rtc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c index 174a111535..1eb4854276 100644 --- a/xen/arch/x86/hvm/rtc.c +++ b/xen/arch/x86/hvm/rtc.c @@ -165,7 +165,7 @@ static void rtc_set_time(RTCState *s) 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 @@ static void rtc_set_time(RTCState *s) 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 |