diff options
author | Anton Kling <anton@kling.gg> | 2024-07-01 16:21:43 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-07-01 16:21:43 +0200 |
commit | 326cedcca7050ec0b143ff3d2ad94839f77ab22e (patch) | |
tree | 0fbcfdc18b0da5ba2cccb3950edf1ef906e9af5b /userland/libc/time/clock_gettime.c | |
parent | ab09d1f56f5881eb5d2234038d9146f74deecc10 (diff) |
LibC: Change how kill() works
Diffstat (limited to 'userland/libc/time/clock_gettime.c')
-rw-r--r-- | userland/libc/time/clock_gettime.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/userland/libc/time/clock_gettime.c b/userland/libc/time/clock_gettime.c index 492b968..239b389 100644 --- a/userland/libc/time/clock_gettime.c +++ b/userland/libc/time/clock_gettime.c @@ -1,15 +1,12 @@ +#include <errno.h> +#include <stdint.h> #include <syscall.h> #include <time.h> +#include <unistd.h> int clock_gettime(clockid_t clock_id, struct timespec *tp) { - (void)clock_id; - tp->tv_sec = 0; - tp->tv_nsec = 0; - return 0; - /* -SYS_CLOCK_GETTIME_PARAMS args = { -.clk = clock_id, -.ts = tp, -}; -return syscall(SYS_CLOCK_GETTIME, &args);*/ + uint32_t ms = uptime(); + tp->tv_sec = ms / 1000; + tp->tv_nsec = ms * 1000000; + RC_ERRNO(syscall(SYS_CLOCK_GETTIME, clock_id, tp, 0, 0, 0)); } |