ref: 7f653da168fc6f7aa478967a33c4e94f3916a5a3
parent: eeb15a2bd7b2fa6333937cdc7ec93df4a4522447
author: Jacob Moody <moody@posixcafe.org>
date: Sat Dec 13 10:25:46 EST 2025
libnpe: add CLOCK_PROCESS_CPUTIME_ID
--- a/include/npe/time.h
+++ b/include/npe/time.h
@@ -27,6 +27,7 @@
enum {CLOCK_REALTIME,
CLOCK_MONOTONIC,
+ CLOCK_PROCESS_CPUTIME_ID,
};
#include <sys/time.h>
--- a/libnpe/clock_gettime.c
+++ b/libnpe/clock_gettime.c
@@ -11,6 +11,8 @@
t = nsec();
else if(clockid == CLOCK_MONOTONIC)
t = npe_nanosec();
+ else if(clockid == CLOCK_PROCESS_CPUTIME_ID)
+ t = (uvlong)(times(nil)) * 1000;
else{errno = EINVAL;
return -1;
--
⑨