Created
May 17, 2018 16:42
-
-
Save toddlipcon/1b46db45ae8fd496253eaaea09de0f7f to your computer and use it in GitHub Desktop.
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/python | |
import time | |
import re | |
import sys | |
def convert_ts(ts_match): | |
ts_i = int(ts_match.group(0)) | |
phys, logical = (ts_i >> 12, ts_i & ((1 << 12) - 1)) | |
phys_sec = phys / 1000000 | |
phys_micros = phys % 1000000 | |
f = time.strftime("%F %H:%M:%S", time.localtime(phys_sec)) | |
return "%s.%06d L=%d" % (f, phys_micros, logical) | |
for l in sys.stdin.xreadlines(): | |
print re.sub(r"\d{10,19}", convert_ts, l), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment