summaryrefslogtreecommitdiff
path: root/LibC
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-27 01:31:53 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-27 01:31:53 +0100
commitaef6030a80765dec6fbd176a8d79ef6e6de03854 (patch)
treeb11cd259b6e27de7627a6f4f93170bcd13c7fba3 /LibC
parentabd5931184c49fffc62efeadb2795ccbb86bce05 (diff)
downloadserenity-aef6030a80765dec6fbd176a8d79ef6e6de03854.zip
LibC: Time-related POSIX compliance fixes.
Diffstat (limited to 'LibC')
-rw-r--r--LibC/sys/time.h9
-rw-r--r--LibC/time.cpp3
-rw-r--r--LibC/time.h4
3 files changed, 14 insertions, 2 deletions
diff --git a/LibC/sys/time.h b/LibC/sys/time.h
index e69de29bb2..970aa3f971 100644
--- a/LibC/sys/time.h
+++ b/LibC/sys/time.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+int gettimeofday(struct timeval* __restrict__, void* __restrict__) __attribute__((nonnull(1)));
+
+__END_DECLS
diff --git a/LibC/time.cpp b/LibC/time.cpp
index dc8ed9ceab..2709f10cad 100644
--- a/LibC/time.cpp
+++ b/LibC/time.cpp
@@ -1,4 +1,5 @@
#include <time.h>
+#include <sys/time.h>
#include <errno.h>
#include <assert.h>
#include <Kernel/Syscall.h>
@@ -16,7 +17,7 @@ time_t time(time_t* tloc)
return tv.tv_sec;
}
-int gettimeofday(struct timeval* tv, struct timezone*)
+int gettimeofday(struct timeval* __restrict__ tv, void* __restrict__)
{
int rc = syscall(SC_gettimeofday, tv);
__RETURN_WITH_ERRNO(rc, rc, -1);
diff --git a/LibC/time.h b/LibC/time.h
index b2a7d76d3f..331d9e842c 100644
--- a/LibC/time.h
+++ b/LibC/time.h
@@ -27,7 +27,9 @@ extern long altzone;
extern char* tzname[2];
extern int daylight;
-int gettimeofday(struct timeval*, struct timezone* tz);
+typedef uint32_t clock_t;
+typedef uint32_t time_t;
+
struct tm* localtime(const time_t*);
struct tm *gmtime(const time_t*);
time_t mktime(struct tm*);