summaryrefslogtreecommitdiff
path: root/userland/libc/time/clock_gettime.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-07-01 16:21:43 +0200
committerAnton Kling <anton@kling.gg>2024-07-01 16:21:43 +0200
commit326cedcca7050ec0b143ff3d2ad94839f77ab22e (patch)
tree0fbcfdc18b0da5ba2cccb3950edf1ef906e9af5b /userland/libc/time/clock_gettime.c
parentab09d1f56f5881eb5d2234038d9146f74deecc10 (diff)
LibC: Change how kill() works
Diffstat (limited to 'userland/libc/time/clock_gettime.c')
-rw-r--r--userland/libc/time/clock_gettime.c17
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));
}