From 10dc7271d5b69f09669bacf3ca89a75f15730e63 Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Mon, 9 May 2022 11:05:49 +0200 Subject: [PATCH] In IPFIX DeltaMicroseconds case, basetime must be converted to MS --- producer/producer_nf.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/producer/producer_nf.go b/producer/producer_nf.go index e42391c..b556844 100644 --- a/producer/producer_nf.go +++ b/producer/producer_nf.go @@ -341,13 +341,13 @@ func ConvertNetFlowDataSet(version uint16, baseTime uint32, uptime uint32, recor var timeFirstSwitched uint32 DecodeUNumber(v, &timeFirstSwitched) timeDiff := (uptime - timeFirstSwitched) - flowMessage.TimeFlowStart = uint64(baseTime - timeDiff / 1000) + flowMessage.TimeFlowStart = uint64(baseTime - timeDiff/1000) flowMessage.TimeFlowStartMs = uint64(baseTime)*1000 - uint64(timeDiff) case netflow.NFV9_FIELD_LAST_SWITCHED: var timeLastSwitched uint32 DecodeUNumber(v, &timeLastSwitched) timeDiff := (uptime - timeLastSwitched) - flowMessage.TimeFlowEnd = uint64(baseTime - timeDiff / 1000) + flowMessage.TimeFlowEnd = uint64(baseTime - timeDiff/1000) flowMessage.TimeFlowEndMs = uint64(baseTime)*1000 - uint64(timeDiff) } } else if version == 10 { @@ -355,7 +355,7 @@ func ConvertNetFlowDataSet(version uint16, baseTime uint32, uptime uint32, recor case netflow.IPFIX_FIELD_flowStartSeconds: DecodeUNumber(v, &time) flowMessage.TimeFlowStart = time - flowMessage.TimeFlowStartMs = time*1000 + flowMessage.TimeFlowStartMs = time * 1000 case netflow.IPFIX_FIELD_flowStartMilliseconds: DecodeUNumber(v, &time) flowMessage.TimeFlowStart = time / 1000 @@ -371,7 +371,7 @@ func ConvertNetFlowDataSet(version uint16, baseTime uint32, uptime uint32, recor case netflow.IPFIX_FIELD_flowEndSeconds: DecodeUNumber(v, &time) flowMessage.TimeFlowEnd = time - flowMessage.TimeFlowEndMs = time*1000 + flowMessage.TimeFlowEndMs = time * 1000 case netflow.IPFIX_FIELD_flowEndMilliseconds: DecodeUNumber(v, &time) flowMessage.TimeFlowEnd = time / 1000 @@ -387,11 +387,11 @@ func ConvertNetFlowDataSet(version uint16, baseTime uint32, uptime uint32, recor case netflow.IPFIX_FIELD_flowStartDeltaMicroseconds: DecodeUNumber(v, &time) flowMessage.TimeFlowStart = uint64(baseTime) - time/1000000 - flowMessage.TimeFlowStartMs = uint64(baseTime) - time/1000 + flowMessage.TimeFlowStartMs = uint64(baseTime)*1000 - time/1000 case netflow.IPFIX_FIELD_flowEndDeltaMicroseconds: DecodeUNumber(v, &time) flowMessage.TimeFlowEnd = uint64(baseTime) - time/1000000 - flowMessage.TimeFlowEndMs = uint64(baseTime) - time/1000 + flowMessage.TimeFlowEndMs = uint64(baseTime)*1000 - time/1000 // RFC7133 case netflow.IPFIX_FIELD_dataLinkFrameSize: DecodeUNumber(v, &(flowMessage.Bytes))