headers: crt: Clean up time.h and sys/time.h sys/time.h always include time.h, so no need to define timezone and mingw_gettimeofday itself. Use reserved parameter name for mingw_gettimeofday. Remove _TIMEZONE_DEFINED and _GETTIMEOFDAY_DEFINED. Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/crt/sys/time.h b/mingw-w64-headers/crt/sys/time.h index 9ef3fd3..56a0931 100644 --- a/mingw-w64-headers/crt/sys/time.h +++ b/mingw-w64-headers/crt/sys/time.h
@@ -11,40 +11,10 @@ _CRT_BEGIN_C_HEADER -#include <_timeval.h> - -#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ -#define _TIMEZONE_DEFINED -/* Provided for compatibility with code that assumes that - the presence of gettimeofday function implies a definition - of struct timezone. */ -struct timezone -{ - int tz_minuteswest; /* of Greenwich */ - int tz_dsttime; /* type of dst correction to apply */ -}; - - extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); - -#endif /* _TIMEZONE_DEFINED */ - -/* - Implementation as per: - The Open Group Base Specifications, Issue 6 - IEEE Std 1003.1, 2004 Edition - - The timezone pointer arg is ignored. Errors are ignored. -*/ -#ifndef _GETTIMEOFDAY_DEFINED -#define _GETTIMEOFDAY_DEFINED -int __cdecl gettimeofday(struct timeval *__restrict__, - void *__restrict__ /* tzp (unused) */); -#endif +/* TODO: POSIX.1-2008 marked it as obsolete, and POSIX.1-2024 removed it. */ +/* libiberty.h requires the second argument to be void* instead of struct timezone* */ +int __cdecl gettimeofday(struct timeval* __restrict__ _Tv, void* __restrict__ _Tz); _CRT_END_C_HEADER -/* Adding timespec definition. */ -#include <sys/timeb.h> - - #endif /* _SYS_TIME_H_ */
diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h index 2a8e392..3d69e7c 100644 --- a/mingw-w64-headers/crt/time.h +++ b/mingw-w64-headers/crt/time.h
@@ -163,15 +163,12 @@ #include <_timeval.h> -#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ -#define _TIMEZONE_DEFINED struct timezone { int tz_minuteswest; int tz_dsttime; }; - extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); -#endif /* _TIMEZONE_DEFINED */ +int __cdecl mingw_gettimeofday(struct timeval* _Tv, struct timezone* _Tz); #if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS) #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L