Skip to content

Instantly share code, notes, and snippets.

@jornane
Created October 3, 2017 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jornane/81f0edcebbafbcf1605a9a0fe9034152 to your computer and use it in GitHub Desktop.
Save jornane/81f0edcebbafbcf1605a9a0fe9034152 to your computer and use it in GitHub Desktop.
import time
for i in range(1, 1000):
i = i / 1000.0
then = time.time()
time.sleep(max(0, i - 0.005))
now = time.time()
while now - then - i < 0:
now = time.time()
print(round(now - then - i, 5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment