X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=hw%2Fi8254.c;h=ad61a14af23d356adbb566f05211ca6e08226d21;hb=1154e441aa19ce3bf15fb0cabab2a5656321b43f;hp=20cca0ef838237c4995a647dbaf424842e974ad9;hpb=67b915a5dd52a05f8030cd9edc005effd9c8eea5;p=qemu diff --git a/hw/i8254.c b/hw/i8254.c index 20cca0e..ad61a14 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; }