Skip to content

Instantly share code, notes, and snippets.

@Xpktro
Created August 13, 2013 16:10
Show Gist options
  • Save Xpktro/6222781 to your computer and use it in GitHub Desktop.
Save Xpktro/6222781 to your computer and use it in GitHub Desktop.
System-time synchronized timer in Python
from datetime import datetime
import time
while True:
t = datetime.utcnow()
print '%s:%s:%s' % (t.hour, t.minute, t.second)
sleeptime = 1 - (t.microsecond/1000000.0)
time.sleep(sleeptime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment