Answers for "python how accurate is time.sleep"

1

from time import sleep, time

from time import sleep
sleep(0.5)
Posted by: Guest on December-30-2020
0

python time.sleep slow

from time import perf_counter as timer
import time
from ctypes import windll #new

timeBeginPeriod = windll.winmm.timeBeginPeriod #new
timeBeginPeriod(1) #new

start = timer()
for i in range(1000):
    print (i)
    time.sleep(0.001)

end = timer()
print ("Total time: ", end - start)
Posted by: Guest on September-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language