---
name: "pthread_getcpuclockid"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/pthread_getcpuclockid"
---

# pthread\_getcpuclockid(3)

access a thread CPU-time clock

## NAME

**pthread\_getcpuclockid** – access a thread CPU-time clock

## LIBRARY

POSIX Threads Library (libpthread, -lpthread)

## SYNOPSIS

**#include \<pthread.h\>**

**#include \<time.h\>**

*int*\

**pthread\_getcpuclockid**(*pthread\_t thread\_id*, *clockid\_t \*clock\_id*);

## DESCRIPTION

The **pthread\_getcpuclockid**() returns the clock ID of the CPU-time clock of the thread specified by *thread\_id*, if the thread described by *thread\_id* exists.

## RETURN VALUES

Upon successful completion, **pthread\_getcpuclockid**() returns zero; otherwise, an error number is returned to indicate the error.

## ERRORS

The **pthread\_getcpuclockid**() function will fail if:

- \[ESRCH\]

  The value specified by *thread\_id* does not refer to an existing thread.

## SEE ALSO

[clock\_gettime(2)](/clock_gettime/2.md)

## STANDARDS

The **pthread\_getcpuclockid**() function conforms to IEEE Std 1003.1-2004 (“POSIX.1”).

## HISTORY

The **pthread\_getcpuclockid**() function first appeared in FreeBSD 10.0.

## AUTHORS

David Xu ⟨*davidxu@FreeBSD.org*⟩
