Created
May 20, 2012 14:12
-
-
Save orinx/2758264 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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