Created
February 5, 2016 13:53
-
-
Save lukebigum/051be7eadfa9984f99ae to your computer and use it in GitHub Desktop.
time difference between proceeding lines
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
from datetime import datetime, timedelta | |
import sys | |
last_t = None | |
min_delta = timedelta(seconds=1) | |
#2016-02-05T09:46:33Z | |
for line in sys.stdin: | |
t = datetime.strptime(line, "%Y-%m-%dT%H:%M:%SZ\n") | |
if last_t: | |
diff = t - last_t | |
if diff > min_delta: | |
print "%s - %s since last spike" % (t, diff) | |
last_t = t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment