fix incorrect prasing of timestamps
This commit is contained in:
parent
5a7da98f2d
commit
d57c368aef
|
|
@ -118,29 +118,22 @@ def parse(raw_sentence):
|
||||||
|
|
||||||
parsed.update({'raw_timestamp': rawts})
|
parsed.update({'raw_timestamp': rawts})
|
||||||
|
|
||||||
|
timestamp = 0
|
||||||
try:
|
try:
|
||||||
if form in "hz/":
|
if form in "hz/":
|
||||||
if form == 'h': # zulu hhmmss format
|
# zulu hhmmss format
|
||||||
timestamp = utc.strptime(
|
if form == 'h':
|
||||||
"%s %s %s %s" % (utc.year, utc.month, utc.day, ts),
|
timestamp = "%s%s%s%s" % (utc.year, utc.month, utc.day, ts)
|
||||||
"%Y %m %d %H%M%S"
|
# zulu ddhhmm format
|
||||||
)
|
# '/' local ddhhmm format
|
||||||
elif form == 'z': # zulu ddhhss format
|
elif form in 'z/':
|
||||||
timestamp = utc.strptime(
|
timestamp = "%s%s%s%s" % (utc.year, utc.month, ts, utc.second)
|
||||||
"%s %s %s" % (utc.year, utc.month, ts),
|
|
||||||
"%Y %m %d%M%S"
|
|
||||||
)
|
|
||||||
elif form == '/': # '/' local ddhhss format
|
|
||||||
timestamp = utc.strptime(
|
|
||||||
"%s %s %s" % (utc.year, utc.month, ts),
|
|
||||||
"%Y %m %d%M%S"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
timestamp = utc.strptime(timestamp, "%Y%m%d%H%M%S")
|
||||||
timestamp = time.mktime(timestamp.timetuple())
|
timestamp = time.mktime(timestamp.timetuple())
|
||||||
else:
|
except Exception as exp:
|
||||||
timestamp = 0
|
logger.debug(exp)
|
||||||
except:
|
pass
|
||||||
timestamp = 0
|
|
||||||
|
|
||||||
parsed.update({'timestamp': int(timestamp)})
|
parsed.update({'timestamp': int(timestamp)})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue