Have you considered setting an alarm for one minute? That will be significantly more reliable than trying to precisely time a for loop, especially since the execution time of the for loop will depend on things outside the control of the program, such as how busy the CPU is with other processes.