From aef6030a80765dec6fbd176a8d79ef6e6de03854 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 27 Mar 2019 01:31:53 +0100 Subject: [PATCH] LibC: Time-related POSIX compliance fixes. --- LibC/sys/time.h | 9 +++++++++ LibC/time.cpp | 3 ++- LibC/time.h | 4 +++- LibGUI/GElapsedTimer.cpp | 1 + LibGUI/GEventLoop.cpp | 1 + Servers/WindowServer/WSMessageLoop.cpp | 3 ++- Userland/ping.cpp | 1 + 7 files changed, 19 insertions(+), 3 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 + +__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 +#include #include #include #include @@ -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*); diff --git a/LibGUI/GElapsedTimer.cpp b/LibGUI/GElapsedTimer.cpp index 1d6f6eb943..d0b6f51022 100644 --- a/LibGUI/GElapsedTimer.cpp +++ b/LibGUI/GElapsedTimer.cpp @@ -1,4 +1,5 @@ #include +#include void GElapsedTimer::start() { diff --git a/LibGUI/GEventLoop.cpp b/LibGUI/GEventLoop.cpp index e157968e23..1756198b2e 100644 --- a/LibGUI/GEventLoop.cpp +++ b/LibGUI/GEventLoop.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/Servers/WindowServer/WSMessageLoop.cpp b/Servers/WindowServer/WSMessageLoop.cpp index f4eef37544..21ebc80ee7 100644 --- a/Servers/WindowServer/WSMessageLoop.cpp +++ b/Servers/WindowServer/WSMessageLoop.cpp @@ -9,8 +9,9 @@ #include #include #include -#include +#include #include +#include #include #include #include diff --git a/Userland/ping.cpp b/Userland/ping.cpp index 914a5a8a36..05a63d0b66 100644 --- a/Userland/ping.cpp +++ b/Userland/ping.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include