Please see my comment to the question: you are talking about nothing.
Sorry for not giving you a solution; this is probably impossible, based on your information. Only one thing is more or less clear: you created incorrect dependency on time interval, I have no idea why. It has nothing to do with "bulk of code". So, here is the hint which may lead you to something better: your "bulk of code" just manifests your rotten design, which is incorrect in all cases, even with little code; and only by chance (combination of time intervals) you have an illusion that it "works". Roughly speaking, should you use slower CPU, and your application with "small code" will stop working. In other words, you don't have working application at all.
For the most general idea, get familiar with the concept of
race condition. I faced with more clear and definitive term meaning the same: "incorrect dependency on the time of execution":
http://en.wikipedia.org/wiki/Race_condition[
^].
It's likely that your case in more trivial. As you mentioned "interval time", I can assume you use some timer. Timers are potentially unreliable and should be used with great care, or not used at all. One simple idea is: imagine that your next timer event comes when the event handler invoked by previous timer even is not yet executed. It can create a great mess. So, the safe alternative would be using a separate thread working in a cycle, possibly with some sleep time in each cycle; in more advanced approach, you can adjust the sleep time based on real time measurement of time interval consumed by previous iteration. This is just one very basic idea. The "real" solution would need much more detailed knowledge or your problem.
—SA