improved _parse_timestamp

incorrect timestamps will now return timestamp 0 and get clipped from
the body so further parsing can occur.

stopped using utc.second to fill the second for z/ formats
This commit is contained in:
Rossen Georgiev 2015-03-10 17:55:30 +00:00
parent 829f1fc894
commit bd8b1867aa
1 changed files with 4 additions and 2 deletions

View File

@ -331,7 +331,7 @@ def _parse_timestamp(body, packet_type=''):
if packet_type == '>' and form != 'z':
pass
if form in "hz/":
else:
body = body[7:]
try:
@ -341,7 +341,9 @@ def _parse_timestamp(body, packet_type=''):
# zulu ddhhmm format
# '/' local ddhhmm format
elif form in 'z/':
timestamp = "%d%02d%s%02d" % (utc.year, utc.month, ts, utc.second)
timestamp = "%d%02d%s%02d" % (utc.year, utc.month, ts, 0)
else:
timestamp = "19700101000000"
timestamp = utc.strptime(timestamp, "%Y%m%d%H%M%S")
timestamp = time.mktime(timestamp.timetuple())