import time from time import perf_counter time_count = time.perf_counter() endtime = time_count + 10 while (time_count < endtime):