the big time handling overhaul
[musl] / src / time / clock_getcpuclockid.c
index 723840b..8a0e2d4 100644 (file)
@@ -5,7 +5,10 @@
 
 int clock_getcpuclockid(pid_t pid, clockid_t *clk)
 {
-       if (pid && pid != getpid()) return EPERM;
-       *clk = CLOCK_PROCESS_CPUTIME_ID;
+       struct timespec ts;
+       clockid_t id = (-pid-1)*8U + 2;
+       int ret = __syscall(SYS_clock_getres, id, &ts);
+       if (ret) return -ret;
+       *clk = id;
        return 0;
 }