OSDN Git Service

Redo the filters based on assumptions discussed in mingw-dvlpr list.
[mingw/mingw-org-wsl.git] / include / time.h
index 8d463b0..2bccfa4 100644 (file)
 #ifndef        _TIME_H
 #define        _TIME_H
 #pragma GCC system_header
-
-/* All the headers include this file. */
 #include <_mingw.h>
 
 #define __need_wchar_t
 #define __need_size_t
 #define __need_NULL
+
 #ifndef RC_INVOKED
 #include <stddef.h>
 #endif /* Not RC_INVOKED */
@@ -55,29 +54,21 @@ typedef __int32 __time32_t;
 #define _TIME32_T_DEFINED
 #endif
 
-#ifndef __STRICT_ANSI__
-/* A 64-bit time_t to get to Y3K */
 #ifndef _TIME64_T_DEFINED
+/* A 64-bit time_t to get to Y3K */
 typedef __int64 __time64_t;
 #define _TIME64_T_DEFINED
 #endif
-#endif
 
 #ifndef _TIME_T_DEFINED
-/* FIXME __STRICT_ANSI__ ! */
-#if __MSVCRT_VERSION__ >= 0x0800
-#ifndef _USE_32BIT_TIME_T
-typedef        __time64_t time_t;
-#else
-typedef        __time32_t time_t;
-#endif /* !_USE_32BIT_TIME_T */
-#else
-typedef        __time32_t time_t;
-#endif /* __MSVCRT_VERSION__ >= 0x0800 */
-#define _TIME_T_DEFINED
+# ifndef _USE_32BIT_TIME_T
+   typedef     __time64_t time_t;
+# else
+   typedef     __time32_t time_t;
+# endif /* !_USE_32BIT_TIME_T */
+# define _TIME_T_DEFINED
 #endif
 
-
 /*
  * A type for measuring processor time (in clock ticks).
  */
@@ -112,11 +103,9 @@ extern "C" {
 #endif
 
 _CRTIMP clock_t __cdecl __MINGW_NOTHROW        clock (void);
-#if __MSVCRT_VERSION__ < 0x0800
 _CRTIMP time_t __cdecl __MINGW_NOTHROW time (time_t*);
 _CRTIMP double __cdecl __MINGW_NOTHROW difftime (time_t, time_t);
 _CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*);
-#endif
 
 /*
  * These functions write to and return pointers to static buffers that may
@@ -129,11 +118,9 @@ _CRTIMP time_t __cdecl __MINGW_NOTHROW     mktime (struct tm*);
  * a directory gives 'invalid' times in st_atime etc...
  */
 _CRTIMP char* __cdecl __MINGW_NOTHROW          asctime (const struct tm*);
-#if __MSVCRT_VERSION__ < 0x0800
 _CRTIMP char* __cdecl __MINGW_NOTHROW          ctime (const time_t*);
 _CRTIMP struct tm*  __cdecl __MINGW_NOTHROW    gmtime (const time_t*);
 _CRTIMP struct tm*  __cdecl __MINGW_NOTHROW    localtime (const time_t*);
-#endif
 
 _CRTIMP size_t __cdecl __MINGW_NOTHROW         strftime (char*, size_t, const char*, const struct tm*);
 
@@ -149,16 +136,13 @@ _CRTIMP char* __cdecl __MINGW_NOTHROW     _strdate(char*);
 _CRTIMP char* __cdecl __MINGW_NOTHROW  _strtime(char*);
 
 /* These require newer versions of msvcrt.dll (6.10 or higher). */ 
-#if __MSVCRT_VERSION__ >= 0x0601
 _CRTIMP __time64_t __cdecl __MINGW_NOTHROW  _time64( __time64_t*);
 _CRTIMP __time64_t __cdecl __MINGW_NOTHROW  _mktime64 (struct tm*);
 _CRTIMP char* __cdecl __MINGW_NOTHROW _ctime64 (const __time64_t*);
 _CRTIMP struct tm*  __cdecl __MINGW_NOTHROW _gmtime64 (const __time64_t*);
 _CRTIMP struct tm*  __cdecl __MINGW_NOTHROW _localtime64 (const __time64_t*);
-#endif /* __MSVCRT_VERSION__ >= 0x0601 */
 
 /* These require newer versions of msvcrt.dll (8.00 or higher). */ 
-#if __MSVCRT_VERSION__ >= 0x0800
 _CRTIMP __time32_t __cdecl __MINGW_NOTHROW     _time32 (__time32_t*);
 _CRTIMP double    __cdecl __MINGW_NOTHROW      _difftime32 (__time32_t, __time32_t);
 _CRTIMP double    __cdecl __MINGW_NOTHROW      _difftime64 (__time64_t, __time64_t);
@@ -168,6 +152,7 @@ _CRTIMP __time64_t __cdecl __MINGW_NOTHROW  _mkgmtime64 (struct tm*);
 _CRTIMP char*     __cdecl __MINGW_NOTHROW      _ctime32 (const __time32_t*);
 _CRTIMP struct tm* __cdecl __MINGW_NOTHROW     _gmtime32 (const __time32_t*);
 _CRTIMP struct tm* __cdecl __MINGW_NOTHROW     _localtime32 (const __time32_t*);
+
 #ifndef _USE_32BIT_TIME_T
 _CRTALIAS time_t          __cdecl __MINGW_NOTHROW      time (time_t* _v)                 { return(_time64 (_v)); }
 _CRTALIAS double          __cdecl __MINGW_NOTHROW      difftime (time_t _v1, time_t _v2) { return(_difftime64 (_v1,_v2)); }
@@ -185,7 +170,6 @@ _CRTALIAS char*                __cdecl __MINGW_NOTHROW      ctime (const time_t* _v)          { return(
 _CRTALIAS struct tm*      __cdecl __MINGW_NOTHROW      gmtime (const time_t* _v)         { return(_gmtime32 (_v)); }
 _CRTALIAS struct tm*      __cdecl __MINGW_NOTHROW      localtime (const time_t* _v)      { return(_localtime32 (_v)); }
 #endif /* !_USE_32BIT_TIME_T */
-#endif /* __MSVCRT_VERSION__ >= 0x0800 */
 
 
 /*
@@ -194,7 +178,6 @@ _CRTALIAS struct tm*           __cdecl __MINGW_NOTHROW      localtime (const time_t* _v)      {
  * _tzname: standard/daylight savings time zone names (an array with two
  *          elements).
  */
-#ifdef __MSVCRT__
 
 /* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */
 extern _CRTIMP int* __cdecl __MINGW_NOTHROW    __p__daylight (void);
@@ -205,81 +188,34 @@ __MINGW_IMPORT int        _daylight;
 __MINGW_IMPORT long    _timezone;
 __MINGW_IMPORT char    *_tzname[2];
 
-#else /* not __MSVCRT (ie. crtdll) */
-
-#ifndef __DECLSPEC_SUPPORTED
-
-extern int*    _imp___daylight_dll;
-extern long*   _imp___timezone_dll;
-extern char**  _imp___tzname;
-
-#define _daylight      (*_imp___daylight_dll)
-#define _timezone      (*_imp___timezone_dll)
-#define _tzname                (*_imp___tzname)
-
-#else /* __DECLSPEC_SUPPORTED */
-
-__MINGW_IMPORT int     _daylight_dll;
-__MINGW_IMPORT long    _timezone_dll;
-__MINGW_IMPORT char*   _tzname[2];
-
-#define _daylight      _daylight_dll
-#define _timezone      _timezone_dll
-
-#endif /* __DECLSPEC_SUPPORTED */
-
-#endif /* not __MSVCRT__ */
-
 #endif /* Not __STRICT_ANSI__ */
 
 #ifndef _NO_OLDNAMES
-
-#ifdef __MSVCRT__
-
 /* These go in the oldnames import library for MSVCRT. */
 __MINGW_IMPORT int     daylight;
 __MINGW_IMPORT long    timezone;
 __MINGW_IMPORT char    *tzname[2];
-
-#else /* not __MSVCRT__ */
-
-/* CRTDLL is royally messed up when it comes to these macros.
-   TODO: import and alias these via oldnames import library instead 
-   of macros.  */
-
-#define daylight        _daylight
-/* NOTE: timezone not defined as macro because it would conflict with
-   struct timezone in sys/time.h.
-   Also, tzname used to a be macro, but now it's in moldname. */
-__MINGW_IMPORT char    *tzname[2];
-
-#endif /* not __MSVCRT__ */
-
 #endif /* Not _NO_OLDNAMES */
 
 #ifndef _WTIME_DEFINED
 /* wide function prototypes, also declared in wchar.h */
+
 #ifndef __STRICT_ANSI__
-#ifdef __MSVCRT__
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW       _wasctime(const struct tm*);
-#if __MSVCRT_VERSION__ < 0x0800
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW       _wctime(const time_t*);
-#endif
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW       _wstrdate(wchar_t*);
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW       _wstrtime(wchar_t*);
-#if __MSVCRT_VERSION__ >= 0x0601
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW       _wctime64 (const __time64_t*);
-#endif
-#if __MSVCRT_VERSION__ >= 0x0800
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW       _wctime32 (const __time32_t*);
+
 #ifndef _USE_32BIT_TIME_T
 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW     _wctime (const time_t* _v) { return(_wctime64 (_v)); }
 #else
 _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW     _wctime (const time_t* _v) { return(_wctime32 (_v)); }
 #endif
-#endif /* __MSVCRT_VERSION__ >= 0x0800 */
-#endif /*  __MSVCRT__ */
+
 #endif /* __STRICT_ANSI__ */
+
 _CRTIMP size_t __cdecl __MINGW_NOTHROW         wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
 #define _WTIME_DEFINED
 #endif /* _WTIME_DEFINED */ 
@@ -289,4 +225,5 @@ _CRTIMP size_t __cdecl __MINGW_NOTHROW              wcsftime (wchar_t*, size_t, const wchar_
 #endif
 
 #endif /* Not RC_INVOKED */
+
 #endif /* Not _TIME_H */