OSDN Git Service

Correct project name references in mingwrt source files.
[mingw/mingw-org-wsl.git] / mingwrt / include / time.h
1 /*
2  * time.h
3  *
4  * Type definitions and function declarations relating to date and time.
5  *
6  * $Id$
7  *
8  * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
9  * Copyright (C) 1997-2007, 2011, 2015-2018, 2022, MinGW.OSDN Project
10  *
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice, this permission notice, and the following
20  * disclaimer shall be included in all copies or substantial portions of
21  * the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  *
31  */
32 #if ! defined _TIME_H || defined __need_time_t
33 #pragma GCC system_header
34
35 /* Irrespective of whether this is normal or selective inclusion of
36  * <time.h>, we ALWAYS require the definition for time_t; get it by
37  * selective inclusion from its primary source, in <sys/types.h>;
38  * note that we must ALWAYS delegate this, when __need_time_t is
39  * defined, even when _TIME_H had been defined previously, to ensure
40  * that __need_time_t is properly reset, and thus cannot compromise
41  * a later inclusion of <sys/types.h>
42  */
43 #undef __need_time_h
44 #define __need_time_t  1
45 #include <sys/types.h>
46
47 #ifndef _TIME_H
48 /* To support selective partial inclusion, we do not immediately define
49  * the normal _TIME_H guard macro; initially, we also clear all of those
50  * declaraction subset selection macros which are applicable herein.
51  */
52 #undef __need_struct_timespec
53 #undef __need_wchar_decls
54
55 #if defined __SCHED_H_SOURCED__
56 /* This is selective inclusion by <sched.h>; although not a standard
57  * MinGW.OSDN header, we provide this hook to grant access from third
58  * party implementations, (e.g. pthreads-win32), to get a definition
59  * for struct timespec, which POSIX requires it to provide.
60  *
61  * Note that, in common with all selective inclusion strategies, we
62  * do not define the _TIME_H guard macro in this case, and we select
63  * only the minimally required subset of declarations to be exposed
64  * from within <time.h>, as required by <sched.h>
65  */
66 # define __need_struct_timespec  1
67
68 #elif defined __WCHAR_H_SOURCED__
69 /* This is selective inclusion by <wchar.h>; thus, we do not define the
70  * _TIME_H guard macro, and we select only the minimally required subset
71  * of declarations to be exposed from within <time.h>
72  */
73 # define __need_wchar_decls  1
74
75 /* Both ISO-C and POSIX stipulate that <wchar.h> shall declare "struct tm"
76  * as an incomplete structure, with its complete declaration to be provided
77  * by <time.h>; provide an incomplete forward declaration, to satisfy this
78  * minimal requirement for selective inclusion by <wchar.h>
79  */
80 struct tm;
81
82 #else
83 #define _TIME_H
84 /* This is normal inclusion of <time.h>, in its own right.  All our system
85  * headers are required to include <_mingw.h>, but in the case of selective
86  * inclusion, we delegate that responsibility to the including header; when
87  * including <time.h> directly, we must fulfil this requirement now.
88  */
89 #include <_mingw.h>
90
91 /* Number of clock ticks per second. A clock tick is the unit by which
92  * processor time is measured and is returned by 'clock'.
93  */
94 #define CLOCKS_PER_SEC  ((clock_t)(1000))
95 #define CLK_TCK         CLOCKS_PER_SEC
96
97 #define __need_struct_timespec  1
98 #define __need_wchar_decls  1
99 #endif
100
101 #ifndef RC_INVOKED
102 #if defined __need_struct_timespec && ! __struct_timespec_defined
103 /* Structure timespec is mandated by POSIX, for specification of
104  * intervals with the greatest precision supported by the OS kernel.
105  * Although this allows for specification to nanosecond precision, do
106  * not be deluded into any false expectation that such short intervals
107  * can be realized on Windows; on Win9x derivatives, the metronome used
108  * by the process scheduler has a period of ~55 milliseconds, while for
109  * WinNT derivatives, the corresponding period is ~15 milliseconds; thus,
110  * the shortest intervals which can be realistically timed will range
111  * from 0..55 milliseconds on Win9x hosts, and from 0..15 ms on WinNT,
112  * with period values normally distributed around means of ~27.5 ms
113  * and ~7.5 ms, for the two system types respectively.
114  */
115 struct timespec
116 { /* Period is sum of tv_sec + tv_nsec; while 32-bits is sufficient
117    * to accommodate tv_nsec, we use 64-bit __time64_t for tv_sec, to
118    * ensure that we have a sufficiently large field to accommodate
119    * Microsoft's ambiguous __time32_t vs. __time64_t representation
120    * of time_t; we may resolve this ambiguity locally, by casting a
121    * pointer to a struct timespec to point to an identically sized
122    * struct __mingw32_timespec, which is defined below.
123    */
124   __time64_t      tv_sec;       /* seconds; accept 32 or 64 bits */
125   __int32         tv_nsec;      /* nanoseconds */
126 };
127
128 # ifdef _MINGW32_SOURCE_EXTENDED
129 struct __mingw32_expanded_timespec
130 {
131   /* Equivalent of struct timespec, with disambiguation for the
132    * 32-bit vs. 64-bit tv_sec field declaration.  Period is the
133    * sum of tv_sec + tv_nsec; we use explicitly sized types to
134    * avoid 32-bit vs. 64-bit time_t ambiguity...
135    */
136   union
137   { /* ...within this anonymous union, allowing tv_sec to accommodate
138      * seconds expressed in either of Microsoft's (ambiguously sized)
139      * time_t representations.
140      */
141     __time64_t  __tv64_sec;     /* unambiguously 64 bits */
142     __time32_t  __tv32_sec;     /* unambiguously 32 bits */
143     time_t        tv_sec;       /* ambiguously 32 or 64 bits */
144   };
145   __int32         tv_nsec;      /* nanoseconds */
146 };
147 # endif /* _MINGW32_SOURCE_EXTENDED */
148
149 # define __struct_timespec_defined  1
150 #endif
151
152 #ifdef _TIME_H
153 #ifdef _MINGW32_SOURCE_EXTENDED
154
155 _BEGIN_C_DECLS
156
157 __CRT_ALIAS __LIBIMPL__(( FUNCTION = mingw_timespec ))
158 /* This non-ANSI convenience function facilitates access to entities
159  * defined as struct timespec, while exposing the broken down form of
160  * the tv_sec field, as declared within struct __mingw32_timespec.  It
161  * is exposed only when _MINGW32_SOURCE_EXTENDED is defined, which is
162  * normally implicitly the case, except when in __STRICT_ANSI__ mode
163  * unless the user defines it explicitly.
164  */
165 struct __mingw32_expanded_timespec *mingw_timespec( struct timespec *__tv )
166 { return (struct __mingw32_expanded_timespec *)(__tv); }
167
168 _END_C_DECLS
169
170 #endif  /* _MINGW32_SOURCE_EXTENDED */
171
172 /* <time.h> is also required to duplicate the following type definitions,
173  * which are nominally defined in <stddef.h>
174  */
175 #define __need_NULL
176 #define __need_wchar_t
177 #define __need_size_t
178 #include <stddef.h>
179
180 /* A type for measuring processor time in clock ticks; (no need to
181  * guard this, since it isn't defined elsewhere).
182  */
183 typedef long clock_t;
184
185 struct tm
186 { /* A structure for storing the attributes of a broken-down time; (once
187    * again, it isn't defined elsewhere, so no guard is necessary).  Note
188    * that we are within the scope of <time.h> itself, so we must provide
189    * the complete structure declaration here.
190    */
191   int  tm_sec;          /* Seconds: 0-60 (to accommodate leap seconds) */
192   int  tm_min;          /* Minutes: 0-59 */
193   int  tm_hour;         /* Hours since midnight: 0-23 */
194   int  tm_mday;         /* Day of the month: 1-31 */
195   int  tm_mon;          /* Months *since* January: 0-11 */
196   int  tm_year;         /* Years since 1900 */
197   int  tm_wday;         /* Days since Sunday (0-6) */
198   int  tm_yday;         /* Days since Jan. 1: 0-365 */
199   int  tm_isdst;        /* +1=Daylight Savings Time, 0=No DST, -1=unknown */
200 };
201
202 _BEGIN_C_DECLS
203
204 _CRTIMP __cdecl __MINGW_NOTHROW  clock_t  clock (void);
205
206 #if __MSVCRT_VERSION__ < __MSVCR80_DLL
207  /* Although specified as ISO-C functions, Microsoft withdrew direct
208   * support for these, with their ISO-C names, from MSVCR80.DLL onwards,
209   * preferring to map them via header file macros, to alternatively named
210   * DLL functions with ambiguous time_t representations; they remain in
211   * MSVCRT.DLL, however, with their original ISO-C names, and time_t
212   * unambiguously represented as a 32-bit data type.
213   */
214 _CRTIMP __cdecl __MINGW_NOTHROW  time_t time (time_t *);
215 _CRTIMP __cdecl __MINGW_NOTHROW  double difftime (time_t, time_t);
216 _CRTIMP __cdecl __MINGW_NOTHROW  time_t mktime (struct tm *);
217 #endif
218
219 /* These functions write to and return pointers to static buffers that may
220  * be overwritten by other function calls. Yikes!
221  *
222  * NOTE: localtime, and perhaps the others of the four functions grouped
223  * below may return NULL if their argument is not 'acceptable'. Also note
224  * that calling asctime with a NULL pointer will produce an Invalid Page
225  * Fault and crap out your program. Guess how I know. Hint: stat called on
226  * a directory gives 'invalid' times in st_atime etc...
227  */
228 _CRTIMP __cdecl __MINGW_NOTHROW  char *asctime (const struct tm *);
229
230 #if __MSVCRT_VERSION__ < __MSVCR80_DLL
231  /* Once again, these have been withdrawn from MSVCR80.DLL, (and later),
232   * but remain in MSVCRT.DLL, with unambiguously 32-bit time_t.
233   */
234 _CRTIMP __cdecl __MINGW_NOTHROW  char *ctime (const time_t *);
235 _CRTIMP __cdecl __MINGW_NOTHROW  struct tm *gmtime (const time_t *);
236 _CRTIMP __cdecl __MINGW_NOTHROW  struct tm *localtime (const time_t *);
237 #endif
238
239 _CRTIMP __cdecl __MINGW_NOTHROW
240 size_t strftime (char *, size_t, const char *, const struct tm *);
241
242 #ifndef __STRICT_ANSI__
243 extern _CRTIMP __cdecl __MINGW_NOTHROW  void _tzset (void);
244
245 #ifndef _NO_OLDNAMES
246 extern _CRTIMP __cdecl __MINGW_NOTHROW  void tzset (void);
247 #endif
248
249 _CRTIMP __cdecl __MINGW_NOTHROW  char *_strdate (char *);
250 _CRTIMP __cdecl __MINGW_NOTHROW  char *_strtime (char *);
251
252 #if __MSVCRT_VERSION__ >= __MSVCR61_DLL || _WIN32_WINNT >= _WIN32_WINNT_WIN2K
253 /* These 64-bit time_t variant functions first became available in
254  * MSVCR61.DLL, and its descendants; they were subsequently included
255  * in MSVCRT.DLL, from its Win2K release onwards.
256  */
257 _CRTIMP __cdecl __MINGW_NOTHROW  __time64_t _time64( __time64_t *);
258 _CRTIMP __cdecl __MINGW_NOTHROW  __time64_t _mktime64 (struct tm *);
259 _CRTIMP __cdecl __MINGW_NOTHROW    char *_ctime64 (const __time64_t *);
260 _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_gmtime64 (const __time64_t *);
261 _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_localtime64 (const __time64_t *);
262
263 #endif  /* __MSVCR61_DLL, _WIN32_WINNT_WIN2K, and descendants. */
264
265 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
266  /* The following were introduced in MSVCR80.DLL, and they subsequently
267   * appeared in MSVCRT.DLL, from Windows-Vista onwards.
268   */
269 _CRTIMP __cdecl __MINGW_NOTHROW    char *_ctime32 (const __time32_t *);
270 _CRTIMP __cdecl __MINGW_NOTHROW    double _difftime32 (__time32_t, __time32_t);
271 _CRTIMP __cdecl __MINGW_NOTHROW    double _difftime64 (__time64_t, __time64_t);
272 _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_gmtime32 (const __time32_t *);
273 _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_localtime32 (const __time32_t *);
274 _CRTIMP __cdecl __MINGW_NOTHROW  __time32_t _mktime32 (struct tm *);
275 _CRTIMP __cdecl __MINGW_NOTHROW  __time32_t _mkgmtime32 (struct tm *);
276 _CRTIMP __cdecl __MINGW_NOTHROW  __time64_t _mkgmtime64 (struct tm *);
277 _CRTIMP __cdecl __MINGW_NOTHROW  __time32_t _time32 (__time32_t *);
278
279 # if __MSVCRT_VERSION__ >= __MSVCR80_DLL && defined _USE_32BIT_TIME_T
280   /* Users of MSVCR80.DLL and later, (but not users of MSVCRT.DLL, even
281    * for _WIN32_WINNT_VISTA and later), must contend with the omission of
282    * the following functions from their DLL of choice, thus requiring these
283    * brain damaged mappings, in terms of an ambiguously defined 'time_t';
284    * thus, when 'time_t' is declared to be equivalent to '__time32_t':
285    */
286 __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t time (time_t *__v)
287  { return _time32 (__v); }
288
289 __CRT_ALIAS __cdecl __MINGW_NOTHROW  double difftime (time_t __v1, time_t __v2)
290  { return _difftime32 (__v1, __v2); }
291
292 __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t mktime (struct tm *__v)
293  { return _mktime32 (__v); }
294
295 __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t _mkgmtime (struct tm *__v)
296  { return _mkgmtime32 (__v); }
297
298 __CRT_ALIAS __cdecl __MINGW_NOTHROW  char *ctime (const time_t *__v)
299  { return _ctime32 (__v); }
300
301 __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *gmtime (const time_t *__v)
302  { return _gmtime32 (__v); }
303
304 __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *localtime (const time_t *__v)
305  { return _localtime32 (__v); }
306
307 # elif __MSVCRT_VERSION__ >= __MSVCR80_DLL
308   /* Correspondingly, for users of MSVCR80.DLL and later only, when there
309    * is no explicit declaration to direct the specification of 'time_t', and
310    * thus 'time_t' is assumed to be equivalent to '__time64_t':
311    */
312 __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t time (time_t *__v)
313  { return _time64 (__v); }
314
315 __CRT_ALIAS __cdecl __MINGW_NOTHROW  double difftime (time_t __v1, time_t __v2)
316  { return _difftime64 (__v1, __v2); }
317
318 __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t mktime (struct tm *__v)
319  { return _mktime64 (__v); }
320
321 __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t _mkgmtime (struct tm *__v)
322  { return _mkgmtime64 (__v); }
323
324 __CRT_ALIAS __cdecl __MINGW_NOTHROW  char *ctime (const time_t *__v)
325  { return _ctime64 (__v); }
326
327 __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *gmtime (const time_t *__v)
328  { return _gmtime64 (__v); }
329
330 __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *localtime (const time_t *__v)
331  { return _localtime64 (__v); }
332
333 # endif /* _USE_32BIT_TIME_T brain damage */
334 #endif  /* >=__MSVCR80.DLL || >=_WIN32_WINNT_VISTA */
335
336 /* _daylight: non zero if daylight savings time is used.
337  * _timezone: difference in seconds between GMT and local time.
338  * _tzname: standard/daylight savings time zone names (an array with two
339  *          elements).
340  */
341 #ifdef __MSVCRT__
342 /* These are for compatibility with pre-VC 5.0 supplied MSVCRT.DLL
343  */
344 extern _CRTIMP __cdecl __MINGW_NOTHROW  int   *__p__daylight (void);
345 extern _CRTIMP __cdecl __MINGW_NOTHROW  long  *__p__timezone (void);
346 extern _CRTIMP __cdecl __MINGW_NOTHROW  char **__p__tzname (void);
347
348 __MINGW_IMPORT int   _daylight;
349 __MINGW_IMPORT long  _timezone;
350 __MINGW_IMPORT char *_tzname[2];
351
352 #else /* !__MSVCRT__ (i.e. using CRTDLL.DLL) */
353 #ifndef __DECLSPEC_SUPPORTED
354
355 extern int   *_imp___daylight_dll;
356 extern long  *_imp___timezone_dll;
357 extern char **_imp___tzname;
358
359 #define _daylight  (*_imp___daylight_dll)
360 #define _timezone  (*_imp___timezone_dll)
361 #define _tzname    (*_imp___tzname)
362
363 #else /* __DECLSPEC_SUPPORTED */
364
365 __MINGW_IMPORT int   _daylight_dll;
366 __MINGW_IMPORT long  _timezone_dll;
367 __MINGW_IMPORT char *_tzname[2];
368
369 #define _daylight  _daylight_dll
370 #define _timezone  _timezone_dll
371
372 #endif /* __DECLSPEC_SUPPORTED */
373 #endif /* ! __MSVCRT__ */
374 #endif /* ! __STRICT_ANSI__ */
375
376 #ifndef _NO_OLDNAMES
377 #ifdef __MSVCRT__
378
379 /* These go in the oldnames import library for MSVCRT.
380  */
381 __MINGW_IMPORT int   daylight;
382 __MINGW_IMPORT long  timezone;
383 __MINGW_IMPORT char *tzname[2];
384
385 #else /* ! __MSVCRT__ */
386 /* CRTDLL is royally messed up when it comes to these macros.
387  * TODO: import and alias these via oldnames import library instead
388  * of macros.
389  */
390 #define daylight  _daylight
391
392 /* NOTE: timezone not defined as a macro because it would conflict with
393  * struct timezone in sys/time.h.  Also, tzname used to a be macro, but
394  * now it's in moldname.
395  */
396 __MINGW_IMPORT char     *tzname[2];
397
398 #endif  /* ! __MSVCRT__ */
399 #endif  /* ! _NO_OLDNAMES */
400
401 #if _POSIX_C_SOURCE
402 /* The nanosleep() function provides the most general purpose API for
403  * process/thread suspension; it provides for specification of periods
404  * ranging from ~7.5 ms mean, (on WinNT derivatives; ~27.5 ms on Win9x),
405  * extending up to ~136 years, (effectively eternity).
406  */
407 __cdecl __MINGW_NOTHROW
408 int nanosleep( const struct timespec *, struct timespec * );
409
410 #ifndef __NO_INLINE__
411 /* We may conveniently provide an in-line implementation here,
412  * in terms of the __mingw_sleep() helper function.
413  */
414 __cdecl __MINGW_NOTHROW
415 int __mingw_sleep( unsigned long, unsigned long );
416
417 __CRT_INLINE __LIBIMPL__(( FUNCTION = nanosleep ))
418 int nanosleep( const struct timespec *period, struct timespec *residual )
419 {
420   if( residual != (void *)(0) )
421     residual->tv_sec = (__time64_t)(residual->tv_nsec = 0);
422   return __mingw_sleep((unsigned)(period->tv_sec), (period->tv_sec < 0LL)
423     ? (unsigned)(-1) : (unsigned)(period->tv_nsec));
424 }
425 #endif  /* !__NO_INLINE__ */
426
427 #if _POSIX_C_SOURCE >= 199309L
428 /* POSIX.1b-1993 introduced the optional POSIX clocks API; it
429  * was subsequently moved to "base", as of POSIX.1-2008, to the
430  * extent required to support the CLOCK_REALTIME feature, with
431  * the remainder of its features remaining optional.  We choose
432  * to provide a subset, supporting CLOCK_MONOTONIC in addition
433  * to the aforementioned CLOCK_REALTIME feature.
434  *
435  * We define the POSIX clockid_t type as a pointer to an opaque
436  * structure; user code should never need to know details of the
437  * internal layout of this structure.
438  */
439 typedef struct __clockid__ *clockid_t;
440
441 /* POSIX prefers to have the standard clockid_t entities defined
442  * as macros, each of which represents an entity of type clockid_t.
443  * Since this is not an integer data type, POSIX does not strictly
444  * require such macros to expand to constant expressions; however,
445  * some ill-behaved applications, (GCC's Ada implementation is one
446  * such), depend on such expansions.  Thus, although it will incur
447  * a small additional run-time overhead to interpret them, we map
448  * such entities in terms of pseudo-pointer references, (which we
449  * discriminate from real pointer references, which we assume to
450  * be always to even valued addresses, by forcing odd values for
451  * the pseudo-pointer references).
452  */
453 #define __MINGW_POSIX_CLOCKAPI(ID)  ((clockid_t)(1 + ((ID) << 1)))
454
455 /* The standard clockid_t entities which we choose to support.
456  */
457 #define CLOCK_REALTIME  __MINGW_POSIX_CLOCKAPI (0)
458 #define CLOCK_MONOTONIC __MINGW_POSIX_CLOCKAPI (1)
459
460 /* Prototypes for the standard POSIX functions which provide the
461  * API to these standard clockid_t entities.
462  */
463 int clock_getres (clockid_t, struct timespec *);
464 int clock_gettime (clockid_t, struct timespec *);
465 int clock_settime (clockid_t, const struct timespec *);
466
467 #endif  /* _POSIX_C_SOURCE >= 199309L */
468 #endif  /* _POSIX_C_SOURCE */
469
470 _END_C_DECLS
471
472 #endif  /* _TIME_H included in its own right */
473
474 #if __need_wchar_decls && ! (defined _TIME_H && defined _WCHAR_H)
475 /* Wide character time function prototypes.  These are nominally declared
476  * both here, in <time.h>, and also in <wchar.h>; we declare them here, and
477  * make them available for selective inclusion by <wchar.h>, but such that
478  * the declarations, and in particular any in-line implementation of the
479  * _wctime() function, are visible only on the first time parse, when
480  * one of either _TIME_H, or _WCHAR_H, but not both, is defined.
481  */
482 _BEGIN_C_DECLS
483
484 #if defined __MSVCRT__ && ! defined __STRICT_ANSI__
485 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wasctime (const struct tm *);
486 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wstrdate (wchar_t *);
487 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wstrtime (wchar_t *);
488
489 #if __MSVCRT_VERSION__ >= __MSVCR61_DLL || _WIN32_WINNT >= _WIN32_WINNT_WIN2K
490 /* A __time64_t specific variant of _wctime(), identified as _wctime64(),
491  * first appeared in the non-free MSVC specific MSVCR61.DLL, and was added
492  * to the freely available platform MSVCRT.DLL from Win2K onwards...
493  */
494 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wctime64 (const __time64_t *);
495 #endif
496 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
497 /* ...whereas its __time32_t specific counterpart, _wctime32(), did not
498  * make an appearance until MSVCR80.DLL, and was not added to MSVCRT.DLL
499  * until the release of Vista.
500  */
501 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wctime32 (const __time32_t *);
502 #endif
503 #if __MSVCRT_VERSION__ < __MSVCR80_DLL
504 /* Present in all versions of MSVCRT.DLL, but withdrawn from non-free
505  * MSVC specific releases from MSVCR80.DLL onwards; in all versions of
506  * MSVCRT.DLL, _wctime() accepts a 32-bit time_t argument pointer.
507  */
508 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wctime (const time_t *);
509
510 #else /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */
511 /* For users of the non-free MSVC libraries, we must deal with both the
512  * absence of _wctime(), and with Microsoft's attendant _USE_32BIT_TIME_T
513  * brain damage, as we map an inline replacement...
514  */
515 __CRT_ALIAS __cdecl __MINGW_NOTHROW  wchar_t *_wctime (const time_t *__v)
516 {
517   /* ...in terms of an appropriately selected time_t size specific
518    * alternative function, which should be available...
519    */
520 # ifdef _USE_32BIT_TIME_T
521   /* ...i.e. the __time32_t specific _wctime32(), when the user has
522    * enabled this choice; (the only sane choice, if compatibility with
523    * MSVCRT.DLL is desired)...
524    */
525   return _wctime32 (__v);
526
527 # else  /* !_USE_32BIT_TIME_T */
528   /* ...or otherwise, the __time64_t specific _wctime64(), (in which
529    * case, compatibility with MSVCRT.DLL must be sacrificed).
530    */
531   return _wctime64 (__v);
532 # endif /* !_USE_32BIT_TIME_T */
533 }
534 #endif  /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */
535 #endif  /* __MSVCRT__ && !__STRICT_ANSI__ */
536
537 _CRTIMP __cdecl __MINGW_NOTHROW
538 size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *);
539
540 _END_C_DECLS
541
542 #endif  /* ! (defined _TIME_H && defined _WCHAR_H) */
543
544 /* We're done with all <time.h> specific content selectors; clear them.
545  */
546 #undef __need_time_t
547 #undef __need_struct_timespec
548 #undef __need_wchar_decls
549
550 #endif /* ! RC_INVOKED */
551 #endif /* !_TIME_H after __need_time_t processing */
552 #endif /* !_TIME_H: $RCSfile$: end of file */