PCAP\_SET\_TSTAMP\_PRECISION(3PCAP) PCAP\_SET\_TSTAMP\_PRECISION(3PCAP)

# [NAME](#NAME)

pcap\_set\_tstamp\_precision - set the time stamp precision returned in captures

# [SYNOPSIS](#SYNOPSIS)

```
#include <pcap/pcap.h>
```

```
int pcap_set_tstamp_precision(pcap_t *p, int tstamp_precision);
```

# [DESCRIPTION](#DESCRIPTION)

**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*. It must be called on a pcap descriptor created by [**pcap\_create**(3PCAP)](/man/os/libpcap/pcap_create.3PCAP) that has not yet been activated by [**pcap\_activate**(3PCAP)](/man/os/libpcap/pcap_activate.3PCAP). Two time stamp precisions are supported, microseconds and nanoseconds. One can use options **PCAP\_TSTAMP\_PRECISION\_MICRO** and **PCAP\_TSTAMP\_PRECISION\_NANO** to request desired precision. By default, time stamps are in microseconds.

# [RETURN VALUE](#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, **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.

# [BACKWARD COMPATIBILITY](#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.

# [SEE ALSO](#SEE_ALSO)

[**pcap**(3PCAP)](/man/os/libpcap/pcap.3PCAP), [**pcap\_get\_tstamp\_precision**(3PCAP)](/man/os/libpcap/pcap_get_tstamp_precision.3PCAP), [**pcap\_set\_tstamp\_type**(3PCAP)](/man/os/libpcap/pcap_set_tstamp_type.3PCAP), [**pcap-tstamp**(7)](/man/os/libpcap/pcap-tstamp.7)

23 August 2018

---

Document: pcap_set_tstamp_precision(3pcap) from libpcap 1.11.0-r0 (Chainguard OS)
Source: https://github.com/the-tcpdump-group/libpcap.git
