-
-
Save motiejus/3312ce433038624d89163675d05c3eea to your computer and use it in GitHub Desktop.
timer
This file contains hidden or 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
#!/usr/bin/env python -u | |
from sys import stdin, stdout | |
from datetime import datetime | |
before, line = datetime.utcnow(), 'foo' | |
while line != '': | |
line = stdin.readline() | |
ret = "[%s] %s" % (datetime.utcnow().strftime("%H:%M:%S.%f"), line) | |
stdout.write(ret) | |
diff = datetime.utcnow() - before | |
stdout.write("Total: %.6fs\n" % diff.total_seconds()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.