xref: /openbsd-src/lib/librthread/rthread_getcpuclockid.c (revision fe38b55cb0aae270de3f844146814682e8cd345c)
1*fe38b55cSguenther /*	$OpenBSD: rthread_getcpuclockid.c,v 1.2 2016/05/07 19:05:22 guenther Exp $ */
27b36c281Sguenther /*
37b36c281Sguenther  * Copyright (c) 2013 Philip Guenther <guenther@openbsd.org>
47b36c281Sguenther  *
57b36c281Sguenther  * Permission to use, copy, modify, and distribute this software for any
67b36c281Sguenther  * purpose with or without fee is hereby granted, provided that the above
77b36c281Sguenther  * copyright notice and this permission notice appear in all copies.
87b36c281Sguenther  *
97b36c281Sguenther  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
107b36c281Sguenther  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
117b36c281Sguenther  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
127b36c281Sguenther  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
137b36c281Sguenther  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
147b36c281Sguenther  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
157b36c281Sguenther  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
167b36c281Sguenther  */
177b36c281Sguenther 
187b36c281Sguenther #include <pthread.h>
19*fe38b55cSguenther #include <tib.h>
20*fe38b55cSguenther #include <time.h>
217b36c281Sguenther 
227b36c281Sguenther #include "rthread.h"
237b36c281Sguenther 
247b36c281Sguenther int
pthread_getcpuclockid(pthread_t thread,clockid_t * clock_id)257b36c281Sguenther pthread_getcpuclockid(pthread_t thread, clockid_t *clock_id)
267b36c281Sguenther {
27*fe38b55cSguenther 	*clock_id = __CLOCK_ENCODE(CLOCK_THREAD_CPUTIME_ID,
28*fe38b55cSguenther 	    thread->tib->tib_tid);
297b36c281Sguenther 	return (0);
307b36c281Sguenther }
31