diff options
author | Christian Limpach <Christian.Limpach@xensource.com> | 2007-03-08 15:51:32 +0000 |
---|---|---|
committer | Christian Limpach <Christian.Limpach@xensource.com> | 2007-03-08 15:51:32 +0000 |
commit | d861c10c24742a04e8452dd7fc09e961a0ec6be4 (patch) | |
tree | 4bfe65c66db7aa36d91585bd5769668aac947cde /xen/arch/x86/hvm/rtc.c | |
parent | 75c73974d7d41d0d28c743ce3cb551c856c6d190 (diff) | |
download | xen-d861c10c24742a04e8452dd7fc09e961a0ec6be4.tar.gz xen-d861c10c24742a04e8452dd7fc09e961a0ec6be4.tar.bz2 xen-d861c10c24742a04e8452dd7fc09e961a0ec6be4.zip |
[xen] Update the hvm rtc clock state if the domain's time offset is changed.
The settimeoffset domctl had no effect on hvm domains since the offset
was only read in rtc_init which is done when the domain is created.
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
Diffstat (limited to 'xen/arch/x86/hvm/rtc.c')
-rw-r--r-- | xen/arch/x86/hvm/rtc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c index 5cda6bbb75..036eba7bfe 100644 --- a/xen/arch/x86/hvm/rtc.c +++ b/xen/arch/x86/hvm/rtc.c @@ -174,6 +174,11 @@ static void rtc_copy_date(RTCState *s) { const struct tm *tm = &s->current_tm; + if (s->time_offset_seconds != s->pt.vcpu->domain->time_offset_seconds) { + s->current_tm = gmtime(get_localtime(s->pt.vcpu->domain)); + s->time_offset_seconds = s->pt.vcpu->domain->time_offset_seconds; + } + s->hw.cmos_data[RTC_SECONDS] = to_bcd(s, tm->tm_sec); s->hw.cmos_data[RTC_MINUTES] = to_bcd(s, tm->tm_min); if ( s->hw.cmos_data[RTC_REG_B] & RTC_24H ) @@ -211,10 +216,16 @@ static int get_days_in_month(int month, int year) } /* update 'tm' to the next second */ -static void rtc_next_second(struct tm *tm) +static void rtc_next_second(RTCState *s) { + struct tm *tm = &s->current_tm; int days_in_month; + if (s->time_offset_seconds != s->pt.vcpu->domain->time_offset_seconds) { + s->current_tm = gmtime(get_localtime(s->pt.vcpu->domain)); + s->time_offset_seconds = s->pt.vcpu->domain->time_offset_seconds; + } + tm->tm_sec++; if ((unsigned)tm->tm_sec >= 60) { tm->tm_sec = 0; @@ -258,7 +269,7 @@ static void rtc_update_second(void *opaque) } else { - rtc_next_second(&s->current_tm); + rtc_next_second(s); if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_SET) ) s->hw.cmos_data[RTC_REG_A] |= RTC_UIP; |