Created
May 6, 2014 19:31
-
-
Save scottjg/2c7b1ef6e5eb1d223548 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
#!/usr/bin/env ruby | |
require 'date' | |
prev_dt = nil | |
prev_line = nil | |
$stdin.each_line do |line| | |
time_str = line[1..25] | |
dt = DateTime.parse(time_str) rescue next | |
if prev_dt != nil | |
#p '---' | |
#p prev_dt | |
#p dt | |
#p line | |
secs = ((dt - prev_dt) * 24 * 60 * 60).to_i | |
if (secs > 0) | |
puts "(#{secs.to_s.rjust(10, '0')}s) #{line}" | |
end | |
end | |
prev_dt = dt | |
prev_line = line | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment