Created
May 24, 2016 05:24
-
-
Save devilholk/397049a5f4a4f98d11459c1686d6c8ab to your computer and use it in GitHub Desktop.
timestamp_ping.py
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 re, sys, time | |
t = re.compile(r'time=(.*?) ms') | |
line = True | |
while line: | |
line = sys.stdin.readline() | |
r = tuple(t.finditer(line)) | |
if len(r) == 1: | |
print(time.time(), r[0].group(1)) | |
sys.stdout.flush() | |
#ping ping.sunet.se -i 5 | python ~/timestamp_ping.py | tee ~/sunet_ping_ts.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment