> The problem is that when sleep is a little bit too fast on every round, > t will never catch up with ct. so it sleeps shorter and shorter until > t - ct < 1. > > It all works when changing t += msec to t = ct + msec. It may still > do a zero sleep, but the error will not add up.
why not just get rid of the double? then you will never zero sleep. - erik