PCAP_SET_TSTAMP_PRECISION(3)
πΈ NAME πΈ
pcap_set_tstamp_precision β set the time stamp precision returned in captures. Thatβs the whole assignment, bestie: youβre telling libpcap what time-stamp precision you want for captured packets, no cap.
This page lives in the Library Functions Manual, and itβs giving very specific βconfigure your capture handle before you activate itβ energy. π
β¨ SYNOPSIS β¨
#include <pcap/pcap.h>
int pcap_set_tstamp_precision(pcap_t *p, int tstamp_precision);
π¦ DESCRIPTION π¦
Okay so pcap_set_tstamp_precision() sets the precision of the time stamp desired for packets captured on the pcap descriptor to the type specified by tstamp_precision.
The way that this works is: it must be called on a pcap descriptor created by pcap_create(3) that has not yet been activated by pcap_activate(3). Like, do not try to sneak this in after activation β thatβs not the vibe. π
Two time stamp precisions are supported, bestie:
- microseconds
- nanoseconds
You can use these options to request the precision you want:
PCAP_TSTAMP_PRECISION_MICROPCAP_TSTAMP_PRECISION_NANO
By default, time stamps are in microseconds. Periodt. β
π RETURN VALUE π
pcap_set_tstamp_precision() returns 0 on success if the specified time stamp precision is expected to be supported by the capture device. Slay. β¨
It can also return:
PCAP_ERROR_TSTAMP_PRECISION_NOTSUPβ if the capture device does not support the requested time stamp precision.PCAP_ERROR_ACTIVATEDβ if called on a capture handle that has been activated.
Like, read the room: if the handle is already activated, PCAP_ERROR_ACTIVATED is the energy you get. π
π BACKWARD COMPATIBILITY π
This function became available in libpcap release 1.5.1.
In previous releases, time stamps from a capture device or savefile are always given in seconds and microseconds. So if youβre time-traveling through old libpcap versions, thatβs the situation. π°οΈ
π SEE ALSO π
Mwah π β signing off from the Library Functions Manual, page PCAP_SET_T...P_PRECISION(3), dated 23 August 2018. Stay precise, bestie. π«Άβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2013, Michal Sekletar
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms