From a8d624c0502c241feadcfba71ba1442b22d9908b Mon Sep 17 00:00:00 2001 From: Satoshi Fujii Date: Fri, 15 Oct 2021 06:55:11 +0000 Subject: Fix microsec timestamp not properly handled Current heartbeat service assumes lastEpochMicrosec timestamp in VES notification is represented as milli-seconds, but some devices sends micro-sec timestamp in the field. In that case, the heartbeat notification was not working due to timestamp comparison was not done properly. Signed-off-by: Satoshi Fujii Issue-ID: DCAEGEN2-2940 Change-Id: Id7c9241de70cb3ff7ee59cf1e2c60089ff96a42b --- miss_htbt_service/htbtworker.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'miss_htbt_service/htbtworker.py') diff --git a/miss_htbt_service/htbtworker.py b/miss_htbt_service/htbtworker.py index 467b2b7..6fbda2d 100644 --- a/miss_htbt_service/htbtworker.py +++ b/miss_htbt_service/htbtworker.py @@ -125,6 +125,9 @@ def process_msg(jsfile, user_name, password, ip_address, port_num, db_name): jitem = json.loads(item) srcname = (jitem['event']['commonEventHeader']['sourceName']) lastepo = (jitem['event']['commonEventHeader']['lastEpochMicrosec']) + # if lastEpochMicrosec looks like microsec, align it with millisec + if lastepo > 1000000000000000: + lastepo = int(lastepo / 1000) seqnum = (jitem['event']['commonEventHeader']['sequence']) eventName = (jitem['event']['commonEventHeader']['eventName']) except Exception as err: -- cgit 1.2.3-korg