avoid endless loops

The loop boundary used to check @timings == $max_iterations, but
@timings was incremented by an increasingly amount so could
overshoot.

This patch has a belt-and-suspenders approach:

    - Loop boundary test are ">="

    - The increment is limited by the number of iterations to the max

Only one of the two is necessary, but I put in both in case some
future change breaks one, the other will still be there.
Merge pull request #4 from dagolden/topic/fix-endless-loop-bug

avoid endless loops