summaryrefslogtreecommitdiff
path: root/hw/mc146818rtc.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-03 12:27:31 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-03 12:27:31 +0000
commit4721c4575004f9436e3c167f4daa66e2a2d6a3ff (patch)
tree266c3a3bff937a1dd99646f48d6772a2596b100d /hw/mc146818rtc.c
parenta6e022ad139c695e60d1bcb6c298a67aaf5c2916 (diff)
UIP update fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@699 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/mc146818rtc.c')
-rw-r--r--hw/mc146818rtc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index d5746835a1..69addba0cb 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -206,6 +206,7 @@ static void rtc_set_time(RTCState *s)
static void rtc_update_second(void *opaque)
{
RTCState *s = opaque;
+ int64_t delay;
/* if the oscillator is not in normal operation, we do not update */
if ((s->cmos_data[RTC_REG_A] & 0x70) != 0x20) {
@@ -218,8 +219,13 @@ static void rtc_update_second(void *opaque)
/* update in progress bit */
s->cmos_data[RTC_REG_A] |= REG_A_UIP;
}
+ /* should be 244 us = 8 / 32768 seconds, but currently the
+ timers do not have the necessary resolution. */
+ delay = (ticks_per_sec * 1) / 100;
+ if (delay < 1)
+ delay = 1;
qemu_mod_timer(s->second_timer2,
- s->next_second_time + (ticks_per_sec * 99) / 100);
+ s->next_second_time + delay);
}
}