---
name: "pcap_list_tstamp_types"
section: "3pcap"
platform: "macos"
package: "libpcap"
version: "146"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/pcap_list_tstamp_types/3pcap"
---

# pcap\_list\_tstamp\_types(3pcap)

get a list of time stamp types supported by a capture device, and free that list

## NAME

pcap\_list\_tstamp\_types, pcap\_free\_tstamp\_types - get a list of time stamp types supported by a capture device, and free that list

## SYNOPSIS

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

**int pcap\_list\_tstamp\_types(pcap\_t \*p, int \*\*tstamp\_typesp);** **void pcap\_free\_tstamp\_types(int \*tstamp\_types);**

## DESCRIPTION

**pcap\_list\_tstamp\_types**() is used to get a list of the supported time stamp types of the interface associated with the pcap descriptor. **pcap\_list\_tstamp\_types**() allocates an array to hold the list and sets *\*tstamp\_typesp* to point to the array. See [**pcap-tstamp**(7)](/pcap-tstamp/7.md) for a list of all the time stamp types.

The caller is responsible for freeing the array with **pcap\_free\_tstamp\_types**(), which frees the list pointed to by *tstamp\_types*.

## RETURN VALUE

**pcap\_list\_tstamp\_types**() returns the number of time stamp types in the array on success and **PCAP\_ERROR** on failure. A return value of one means that the only time stamp type supported is the one in the list, which is the capture device's default time stamp type.  A return value of zero means that the only time stamp type supported is **PCAP\_TSTAMP\_HOST**, which is the capture device's default time stamp type (only older versions of libpcap will return that; newer versions will always return one or more types). If **PCAP\_ERROR** is returned, **pcap\_geterr**(3PCAP) or **pcap\_perror**(3PCAP) may be called with *p* as an argument to fetch or display the error text.

## BACKWARD COMPATIBILITY

These functions became available in libpcap release 1.2.1.  In previous releases, the time stamp type cannot be set; only the default time stamp type offered by a capture source is available.

## SEE ALSO

**pcap**(3PCAP), **pcap\_tstamp\_type\_val\_to\_name**(3PCAP), [**pcap-tstamp**(7)](/pcap-tstamp/7.md)
