Parses timestamp at beginning of a line. Returns a tuple of seconds since the epoch and the rest of the line. Returns None on parse failures.
(line)
| 89 | |
| 90 | |
| 91 | def split_timestamp(line): |
| 92 | """Parses timestamp at beginning of a line. |
| 93 | |
| 94 | Returns a tuple of seconds since the epoch and the rest |
| 95 | of the line. Returns None on parse failures. |
| 96 | """ |
| 97 | LENGTH = 26 |
| 98 | FORMAT = "%Y-%m-%d %H:%M:%S.%f" |
| 99 | t = line[:LENGTH] |
| 100 | return (datetime_to_seconds_since_epoch(datetime.datetime.strptime(t, FORMAT)), |
| 101 | line[LENGTH + 1:]) |
| 102 | |
| 103 | |
| 104 | class ContainerMonitor(object): |
no test coverage detected