FWIW, when using timers, I always set the AutoReset property to false . This prevents the timer from starting, so you must call Timer.Start() so that it starts counting again. This will avoid additional Stop() calls.
Also, to be explicit, I would have a function that calculates milliseconds until midnight every time and assigns it to a timer interval each time. Would make your code more understandable. And also, if you use Timer.AutoRest = false , the timer will not start counting until you call Timer.Start() , which means that if you put the Start() call at the end of your KillZombies method, and this method takes 5 seconds to complete, your timer should be 86400000 - 5000 . This 5 second shift will add up over time.
Tim coker
source share