Skip to content

Commit

Permalink
Napatech: SCTIME_FROM_SECS is used to initialaze 'seconds' member of …
Browse files Browse the repository at this point in the history
…SCTime
  • Loading branch information
ilya-bakhtin committed Nov 19, 2023
1 parent 4fdb92d commit 5b4c31c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/source-napatech.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,19 +931,19 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot)
*/
switch (NT_NET_GET_PKT_TIMESTAMP_TYPE(packet_buffer)) {
case NT_TIMESTAMP_TYPE_NATIVE_UNIX:
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_USECS(pkt_ts / 100000000),
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_SECS(pkt_ts / 100000000),
((pkt_ts % 100000000) / 100) + ((pkt_ts % 100) > 50 ? 1 : 0));
break;
case NT_TIMESTAMP_TYPE_PCAP:
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_USECS(pkt_ts >> 32), pkt_ts & 0xFFFFFFFF);
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_SECS(pkt_ts >> 32), pkt_ts & 0xFFFFFFFF);
break;
case NT_TIMESTAMP_TYPE_PCAP_NANOTIME:
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_USECS(pkt_ts >> 32),
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_SECS(pkt_ts >> 32),
((pkt_ts & 0xFFFFFFFF) / 1000) + ((pkt_ts % 1000) > 500 ? 1 : 0));
break;
case NT_TIMESTAMP_TYPE_NATIVE_NDIS:
/* number of seconds between 1/1/1601 and 1/1/1970 */
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_USECS((pkt_ts / 100000000) - 11644473600),
p->ts = SCTIME_ADD_USECS(SCTIME_FROM_SECS((pkt_ts / 100000000) - 11644473600),
((pkt_ts % 100000000) / 100) + ((pkt_ts % 100) > 50 ? 1 : 0));
break;
default:
Expand Down

0 comments on commit 5b4c31c

Please sign in to comment.