Commit 1154e441aa19ce3bf15fb0cabab2a5656321b43f
1 parent
e463b581
avoid rounding problems
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@696 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
4 additions
and
0 deletions
hw/i8254.c
... | ... | @@ -136,6 +136,10 @@ static int64_t pit_get_next_transition_time(PITChannelState *s, |
136 | 136 | } |
137 | 137 | /* convert to timer units */ |
138 | 138 | next_time = s->count_load_time + muldiv64(next_time, ticks_per_sec, PIT_FREQ); |
139 | + /* fix potential rounding problems */ | |
140 | + /* XXX: better solution: use a clock at PIT_FREQ Hz */ | |
141 | + if (next_time <= current_time) | |
142 | + next_time = current_time + 1; | |
139 | 143 | return next_time; |
140 | 144 | } |
141 | 145 | ... | ... |