avoid rounding problems
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 2 Apr 2004 20:58:56 +0000 (20:58 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 2 Apr 2004 20:58:56 +0000 (20:58 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@696 c046a42c-6fe2-441c-8c8c-71466251a162

hw/i8254.c

index 20cca0e..ad61a14 100644 (file)
@@ -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;
 }