aboutsummaryrefslogtreecommitdiff
path: root/hw/i8254.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-02 20:58:56 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-02 20:58:56 +0000
commit1154e441aa19ce3bf15fb0cabab2a5656321b43f (patch)
tree98ee9f158b5fd0bb3503f2defc610e598f65c31c /hw/i8254.c
parente463b581ead04c1e5004e08c3bfb16e7fde88e20 (diff)
avoid rounding problems
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@696 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/i8254.c')
-rw-r--r--hw/i8254.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/i8254.c b/hw/i8254.c
index 20cca0ef83..ad61a14af2 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -136,6 +136,10 @@ static int64_t pit_get_next_transition_time(PITChannelState *s,
}
/* convert to timer units */
next_time = s->count_load_time + muldiv64(next_time, ticks_per_sec, PIT_FREQ);
+ /* fix potential rounding problems */
+ /* XXX: better solution: use a clock at PIT_FREQ Hz */
+ if (next_time <= current_time)
+ next_time = current_time + 1;
return next_time;
}