Skip to content

Instantly share code, notes, and snippets.

@orinx
Created May 20, 2012 14:12
Show Gist options
  • Save orinx/2758264 to your computer and use it in GitHub Desktop.
Save orinx/2758264 to your computer and use it in GitHub Desktop.
import datetime, threading
def get_time():
t = threading.Timer(1,get_time)
t.start()
r = datetime.datetime.today()
s = '{:02d}:{:02d}:{:02d}.{:3d}'.format(r.hour, r.minute, r.second, int(r.microsecond / 1000), '2s')
print(s)
get_time()
#output
#22:09:10.144
#22:09:11.144
#22:09:12.145
#22:09:13.145
#22:09:14.146
#22:09:15.147
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment