LibC: Time-related POSIX compliance fixes.

This commit is contained in:
Andreas Kling 2019-03-27 01:31:53 +01:00
parent abd5931184
commit aef6030a80
Notes: sideshowbarker 2024-07-19 14:56:13 +09:00
7 changed files with 19 additions and 3 deletions

View file

@ -0,0 +1,9 @@
#pragma once
#include <sys/cdefs.h>
__BEGIN_DECLS
int gettimeofday(struct timeval* __restrict__, void* __restrict__) __attribute__((nonnull(1)));
__END_DECLS

View file

@ -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);

View file

@ -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*);

View file

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

View file

@ -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>

View file

@ -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>

View file

@ -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>