From 04f797490d81c2ef3f61ab961e0c67b1d20bb50a Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Wed, 15 May 2013 00:59:37 +0200 Subject: [PATCH] Add clocks for process and child execute and system time. --- sortix/include/sortix/clock.h | 6 +++++- sortix/time.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sortix/include/sortix/clock.h b/sortix/include/sortix/clock.h index 9c8b4795..b6e533f1 100644 --- a/sortix/include/sortix/clock.h +++ b/sortix/include/sortix/clock.h @@ -34,7 +34,11 @@ __BEGIN_DECLS #define CLOCK_BOOT 2 /* Time since system boot (uptime). */ #define CLOCK_INIT 3 /* Time since 'init' process began. */ #define CLOCK_PROCESS_CPUTIME_ID 4 -#define CLOCK_THREAD_CPUTIME_ID 5 +#define CLOCK_PROCESS_SYSTIME_ID 5 +#define CLOCK_CHILD_CPUTIME_ID 6 +#define CLOCK_CHILD_SYSTIME_ID 7 +#define CLOCK_THREAD_CPUTIME_ID 8 +#define CLOCK_THREAD_SYSTIME_ID 9 __END_DECLS diff --git a/sortix/time.cpp b/sortix/time.cpp index 2d5864fd..47262b6f 100644 --- a/sortix/time.cpp +++ b/sortix/time.cpp @@ -61,6 +61,10 @@ Clock* GetClock(clockid_t clock) case CLOCK_BOOT: return uptime_clock; case CLOCK_INIT: return uptime_clock; case CLOCK_MONOTONIC: return uptime_clock; + case CLOCK_PROCESS_CPUTIME_ID: return &CurrentProcess()->execute_clock; + case CLOCK_PROCESS_SYSTIME_ID: return &CurrentProcess()->system_clock; + case CLOCK_CHILD_CPUTIME_ID: return &CurrentProcess()->child_execute_clock; + case CLOCK_CHILD_SYSTIME_ID: return &CurrentProcess()->child_system_clock; default: return errno = ENOTSUP, (Clock*) NULL; } }