#include "pthread_internal.h"
int pthread_getcpuclockid(pthread_t t, clockid_t* clockid) {
- pid_t tid = reinterpret_cast<pthread_internal_t*>(t)->tid;
- if (tid == 0) return ESRCH;
+ pid_t tid = pthread_gettid_np(t);
+ if (tid == -1) return ESRCH;
// The tid is stored in the top bits, but negated.
clockid_t result = ~static_cast<clockid_t>(tid) << 3;