Closed nicholaswbsr closed 2 years ago
I fingered out the reason myself.
Change to the this then fixed.
Packet some_pdu = sniffer.next_packet();
auto sec = some_pdu.timestamp().seconds();
std::cout << "next_packet: " << sec << std::endl;
It means only class Packet has the wrapper for timestamp not class PDU. So we must take Packet reference directly not construct from PDU.
Hi,
I want to get the timestamp from pcap file, thus I can know when the package is captured. But the timestamp seconds always show up the current time. For example I open pcap file via Wireshark then I can see the package captured with seconds: 1654494730 which represent around June 6, 2022 13:52. But while I run the code I got 1655275668, represent my current local time: June 15, 2022.
Here is my code snap: