summaryrefslogtreecommitdiff
path: root/lib/libc/time/clock_getcpuclockid.c
blob: 5bb5322168ad153a06c1d899652aed3b19df13d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <time.h>
#include <syscall.h>

int clock_getcpuclockid(pid_t pid, clockid_t *clock_id)
{
	int ret;
	clockid_t id;
	struct timespec ts;

	id = (-pid - 1) * 8U + 2;
	ret = syscall(clock_getres, id, &ts);

	if (ret >= 0) {
		*clock_id = id;
	}

	return ret;
}