Any expert could advise how I can display the nanosecond part of the timestamp using libpcap?
Use the top of the git-track version of libpcap, open the capture file with
pcap_open_offline_with_tstamp_precision(pathname, PCAP_TSTAMP_PRECISION_NANO, errbuf);
and treating the struct timeval in the pcap_pkthdr structure as seconds and nanoseconds rather than seconds and microseconds (i.e. your program treats tv_usec as nanoseconds rather than microseconds is a bit confusing, but I don’t of course have a less ugly solution).
user862787
source share