Skip to content

Instantly share code, notes, and snippets.

@thmosqueiro
Last active January 10, 2017 03:04
Show Gist options
  • Select an option

  • Save thmosqueiro/1f9ef01e81e1ea719a863e7a6a17cec8 to your computer and use it in GitHub Desktop.

Select an option

Save thmosqueiro/1f9ef01e81e1ea719a863e7a6a17cec8 to your computer and use it in GitHub Desktop.
import time
key = True
intrval = 0.050
for j in range(10000):
while key:
now = ( time.time() % 1 )
dif = intrval - now % intrval
key = not ( dif < 0.005 )
time.sleep( dif*0.6 )
now = time.time()
print now, ( intrval - ( now % 1 % 0.050 ) )
time.sleep(0.005)
key = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment