Selaa lähdekoodia

LibC: Time-related POSIX compliance fixes.

Andreas Kling 6 vuotta sitten
vanhempi
commit
aef6030a80

+ 9 - 0
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

+ 2 - 1
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);

+ 3 - 1
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*);

+ 1 - 0
LibGUI/GElapsedTimer.cpp

@@ -1,4 +1,5 @@
 #include <LibGUI/GElapsedTimer.h>
+#include <sys/time.h>
 
 void GElapsedTimer::start()
 {

+ 1 - 0
LibGUI/GEventLoop.cpp

@@ -13,6 +13,7 @@
 #include <LibC/time.h>
 #include <LibC/sys/select.h>
 #include <LibC/sys/socket.h>
+#include <LibC/sys/time.h>
 #include <LibC/errno.h>
 #include <LibC/string.h>
 #include <LibC/stdlib.h>

+ 2 - 1
Servers/WindowServer/WSMessageLoop.cpp

@@ -9,8 +9,9 @@
 #include <Kernel/MousePacket.h>
 #include <LibC/sys/socket.h>
 #include <LibC/sys/select.h>
-#include <LibC/unistd.h>
+#include <LibC/sys/time.h>
 #include <LibC/time.h>
+#include <LibC/unistd.h>
 #include <LibC/fcntl.h>
 #include <LibC/stdio.h>
 #include <LibC/errno.h>

+ 1 - 0
Userland/ping.cpp

@@ -1,4 +1,5 @@
 #include <sys/socket.h>
+#include <sys/time.h>
 #include <arpa/inet.h>
 #include <netinet/ip_icmp.h>
 #include <netinet/in.h>