Changed semantics for loop_delay. sleep_time = 0 if iteration takes longer than loop delay else sleep for loop_delay - iteration_time