| 1 | /* | 
 
 
 
 
 | 2 | * time.h | 
 
 
 
 
 | 3 | * | 
 
 
 
 
 | 4 | * Type definitions and function declarations relating to date and time. | 
 
 
 
 
 | 5 | * | 
 
 
 
 
 | 6 | * $Id: time.h,v c96797f9657b 2016/04/12 14:36:20 keithmarshall $ | 
 
 
 
 
 | 7 | * | 
 
 
 
 
 | 8 | * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> | 
 
 
 
 
 | 9 | * Copyright (C) 1997-2007, 2011, 2015, 2016, MinGW.org 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 __WCHAR_H_SOURCED__ | 
 
 
 
 
 | 56 | /* This is selective inclusion by <wchar.h>; thus, we do not define the | 
 
 
 
 
 | 57 | * _TIME_H guard macro, and we select only the minimally required subset | 
 
 
 
 
 | 58 | * of declarations to be exposed from within <time.h> | 
 
 
 
 
 | 59 | */ | 
 
 
 
 
 | 60 | # define __need_wchar_decls  1 | 
 
 
 
 
 | 61 |  | 
 
 
 
 
 | 62 | /* Both ISO-C and POSIX stipulate that <wchar.h> shall declare "struct tm" | 
 
 
 
 
 | 63 | * as an incomplete structure, with its complete declaration to be provided | 
 
 
 
 
 | 64 | * by <time.h>; provide an incomplete forward declaration, to satisfy this | 
 
 
 
 
 | 65 | * minimal requirement for selective inclusion by <wchar.h> | 
 
 
 
 
 | 66 | */ | 
 
 
 
 
 | 67 | struct tm; | 
 
 
 
 
 | 68 |  | 
 
 
 
 
 | 69 | #else | 
 
 
 
 
 | 70 | #define _TIME_H | 
 
 
 
 
 | 71 | /* This is normal inclusion of <time.h>, in its own right.  All our system | 
 
 
 
 
 | 72 | * headers are required to include <_mingw.h>, but in the case of selective | 
 
 
 
 
 | 73 | * inclusion, we delegate that responsibility to the including header; when | 
 
 
 
 
 | 74 | * including <time.h> directly, we must fulfil this requirement now. | 
 
 
 
 
 | 75 | */ | 
 
 
 
 
 | 76 | #include <_mingw.h> | 
 
 
 
 
 | 77 |  | 
 
 
 
 
 | 78 | /* Number of clock ticks per second. A clock tick is the unit by which | 
 
 
 
 
 | 79 | * processor time is measured and is returned by 'clock'. | 
 
 
 
 
 | 80 | */ | 
 
 
 
 
 | 81 | #define CLOCKS_PER_SEC  ((clock_t)(1000)) | 
 
 
 
 
 | 82 | #define CLK_TCK         CLOCKS_PER_SEC | 
 
 
 
 
 | 83 |  | 
 
 
 
 
 | 84 | #define __need_struct_timespec  1 | 
 
 
 
 
 | 85 | #define __need_wchar_decls  1 | 
 
 
 
 
 | 86 | #endif | 
 
 
 
 
 | 87 |  | 
 
 
 
 
 | 88 | #ifndef RC_INVOKED | 
 
 
 
 
 | 89 | #if defined __need_struct_timespec && ! __struct_timespec_defined | 
 
 
 
 
 | 90 | /* Structure timespec is mandated by POSIX, for specification of | 
 
 
 
 
 | 91 | * intervals with the greatest precision supported by the OS kernel. | 
 
 
 
 
 | 92 | * Although this allows for specification to nanosecond precision, do | 
 
 
 
 
 | 93 | * not be deluded into any false expectation that such short intervals | 
 
 
 
 
 | 94 | * can be realized on Windows; on Win9x derivatives, the metronome used | 
 
 
 
 
 | 95 | * by the process scheduler has a period of ~55 milliseconds, while for | 
 
 
 
 
 | 96 | * WinNT derivatives, the corresponding period is ~15 milliseconds; thus, | 
 
 
 
 
 | 97 | * the shortest intervals which can be realistically timed will range | 
 
 
 
 
 | 98 | * from 0..55 milliseconds on Win9x hosts, and from 0..15 ms on WinNT, | 
 
 
 
 
 | 99 | * with period values normally distributed around means of ~27.5 ms | 
 
 
 
 
 | 100 | * and ~7.5 ms, for the two system types respectively. | 
 
 
 
 
 | 101 | */ | 
 
 
 
 
 | 102 | struct timespec | 
 
 
 
 
 | 103 | { /* Period is sum of tv_sec + tv_nsec; while 32-bits is sufficient | 
 
 
 
 
 | 104 | * to accommodate tv_nsec, we use 64-bit __time64_t for tv_sec, to | 
 
 
 
 
 | 105 | * ensure that we have a sufficiently large field to accommodate | 
 
 
 
 
 | 106 | * Microsoft's ambiguous __time32_t vs. __time64_t representation | 
 
 
 
 
 | 107 | * of time_t; we may resolve this ambiguity locally, by casting a | 
 
 
 
 
 | 108 | * pointer to a struct timespec to point to an identically sized | 
 
 
 
 
 | 109 | * struct __mingw32_timespec, which is defined below. | 
 
 
 
 
 | 110 | */ | 
 
 
 
 
 | 111 | __time64_t      tv_sec;       /* seconds; accept 32 or 64 bits */ | 
 
 
 
 
 | 112 | __int32         tv_nsec;      /* nanoseconds */ | 
 
 
 
 
 | 113 | }; | 
 
 
 
 
 | 114 |  | 
 
 
 
 
 | 115 | # ifdef _MINGW32_SOURCE_EXTENDED | 
 
 
 
 
 | 116 | struct __mingw32_expanded_timespec | 
 
 
 
 
 | 117 | { | 
 
 
 
 
 | 118 | /* Equivalent of struct timespec, with disambiguation for the | 
 
 
 
 
 | 119 | * 32-bit vs. 64-bit tv_sec field declaration.  Period is the | 
 
 
 
 
 | 120 | * sum of tv_sec + tv_nsec; we use explicitly sized types to | 
 
 
 
 
 | 121 | * avoid 32-bit vs. 64-bit time_t ambiguity... | 
 
 
 
 
 | 122 | */ | 
 
 
 
 
 | 123 | union | 
 
 
 
 
 | 124 | { /* ...within this anonymous union, allowing tv_sec to accommodate | 
 
 
 
 
 | 125 | * seconds expressed in either of Microsoft's (ambiguously sized) | 
 
 
 
 
 | 126 | * time_t representations. | 
 
 
 
 
 | 127 | */ | 
 
 
 
 
 | 128 | __time64_t  __tv64_sec;     /* unambiguously 64 bits */ | 
 
 
 
 
 | 129 | __time32_t  __tv32_sec;     /* unambiguously 32 bits */ | 
 
 
 
 
 | 130 | time_t        tv_sec;       /* ambiguously 32 or 64 bits */ | 
 
 
 
 
 | 131 | }; | 
 
 
 
 
 | 132 | __int32         tv_nsec;      /* nanoseconds */ | 
 
 
 
 
 | 133 | }; | 
 
 
 
 
 | 134 | # endif /* _MINGW32_SOURCE_EXTENDED */ | 
 
 
 
 
 | 135 |  | 
 
 
 
 
 | 136 | # define __struct_timespec_defined  1 | 
 
 
 
 
 | 137 | #endif | 
 
 
 
 
 | 138 |  | 
 
 
 
 
 | 139 | #ifdef _TIME_H | 
 
 
 
 
 | 140 | #ifdef _MINGW32_SOURCE_EXTENDED | 
 
 
 
 
 | 141 |  | 
 
 
 
 
 | 142 | _BEGIN_C_DECLS | 
 
 
 
 
 | 143 |  | 
 
 
 
 
 | 144 | __CRT_ALIAS __LIBIMPL__(( FUNCTION = mingw_timespec )) | 
 
 
 
 
 | 145 | /* This non-ANSI convenience function facilitates access to entities | 
 
 
 
 
 | 146 | * defined as struct timespec, while exposing the broken down form of | 
 
 
 
 
 | 147 | * the tv_sec field, as declared within struct __mingw32_timespec.  It | 
 
 
 
 
 | 148 | * is exposed only when _MINGW32_SOURCE_EXTENDED is defined, which is | 
 
 
 
 
 | 149 | * normally implicitly the case, except when in __STRICT_ANSI__ mode | 
 
 
 
 
 | 150 | * unless the user defines it explicitly. | 
 
 
 
 
 | 151 | */ | 
 
 
 
 
 | 152 | struct __mingw32_expanded_timespec *mingw_timespec( struct timespec *__tv ) | 
 
 
 
 
 | 153 | { return (struct __mingw32_expanded_timespec *)(__tv); } | 
 
 
 
 
 | 154 |  | 
 
 
 
 
 | 155 | _END_C_DECLS | 
 
 
 
 
 | 156 |  | 
 
 
 
 
 | 157 | #endif  /* _MINGW32_SOURCE_EXTENDED */ | 
 
 
 
 
 | 158 |  | 
 
 
 
 
 | 159 | /* <time.h> is also required to duplicate the following type definitions, | 
 
 
 
 
 | 160 | * which are nominally defined in <stddef.h> | 
 
 
 
 
 | 161 | */ | 
 
 
 
 
 | 162 | #define __need_NULL | 
 
 
 
 
 | 163 | #define __need_wchar_t | 
 
 
 
 
 | 164 | #define __need_size_t | 
 
 
 
 
 | 165 | #include <stddef.h> | 
 
 
 
 
 | 166 |  | 
 
 
 
 
 | 167 | /* A type for measuring processor time in clock ticks; (no need to | 
 
 
 
 
 | 168 | * guard this, since it isn't defined elsewhere). | 
 
 
 
 
 | 169 | */ | 
 
 
 
 
 | 170 | typedef long clock_t; | 
 
 
 
 
 | 171 |  | 
 
 
 
 
 | 172 | struct tm | 
 
 
 
 
 | 173 | { /* A structure for storing the attributes of a broken-down time; (once | 
 
 
 
 
 | 174 | * again, it isn't defined elsewhere, so no guard is necessary).  Note | 
 
 
 
 
 | 175 | * that we are within the scope of <time.h> itself, so we must provide | 
 
 
 
 
 | 176 | * the complete structure declaration here. | 
 
 
 
 
 | 177 | */ | 
 
 
 
 
 | 178 | int  tm_sec;          /* Seconds: 0-60 (to accommodate leap seconds) */ | 
 
 
 
 
 | 179 | int  tm_min;          /* Minutes: 0-59 */ | 
 
 
 
 
 | 180 | int  tm_hour;         /* Hours since midnight: 0-23 */ | 
 
 
 
 
 | 181 | int  tm_mday;         /* Day of the month: 1-31 */ | 
 
 
 
 
 | 182 | int  tm_mon;          /* Months *since* January: 0-11 */ | 
 
 
 
 
 | 183 | int  tm_year;         /* Years since 1900 */ | 
 
 
 
 
 | 184 | int  tm_wday;         /* Days since Sunday (0-6) */ | 
 
 
 
 
 | 185 | int  tm_yday;         /* Days since Jan. 1: 0-365 */ | 
 
 
 
 
 | 186 | int  tm_isdst;        /* +1=Daylight Savings Time, 0=No DST, -1=unknown */ | 
 
 
 
 
 | 187 | }; | 
 
 
 
 
 | 188 |  | 
 
 
 
 
 | 189 | _BEGIN_C_DECLS | 
 
 
 
 
 | 190 |  | 
 
 
 
 
 | 191 | _CRTIMP __cdecl __MINGW_NOTHROW  clock_t  clock (void); | 
 
 
 
 
 | 192 |  | 
 
 
 
 
 | 193 | #if __MSVCRT_VERSION__ < __MSVCR80_DLL | 
 
 
 
 
 | 194 | /* Although specified as ISO-C functions, Microsoft withdrew direct | 
 
 
 
 
 | 195 | * support for these, with their ISO-C names, from MSVCR80.DLL onwards, | 
 
 
 
 
 | 196 | * preferring to map them via header file macros, to alternatively named | 
 
 
 
 
 | 197 | * DLL functions with ambiguous time_t representations; they remain in | 
 
 
 
 
 | 198 | * MSVCRT.DLL, however, with their original ISO-C names, and time_t | 
 
 
 
 
 | 199 | * unambiguously represented as a 32-bit data type. | 
 
 
 
 
 | 200 | */ | 
 
 
 
 
 | 201 | _CRTIMP __cdecl __MINGW_NOTHROW  time_t time (time_t *); | 
 
 
 
 
 | 202 | _CRTIMP __cdecl __MINGW_NOTHROW  double difftime (time_t, time_t); | 
 
 
 
 
 | 203 | _CRTIMP __cdecl __MINGW_NOTHROW  time_t mktime (struct tm *); | 
 
 
 
 
 | 204 | #endif | 
 
 
 
 
 | 205 |  | 
 
 
 
 
 | 206 | /* These functions write to and return pointers to static buffers that may | 
 
 
 
 
 | 207 | * be overwritten by other function calls. Yikes! | 
 
 
 
 
 | 208 | * | 
 
 
 
 
 | 209 | * NOTE: localtime, and perhaps the others of the four functions grouped | 
 
 
 
 
 | 210 | * below may return NULL if their argument is not 'acceptable'. Also note | 
 
 
 
 
 | 211 | * that calling asctime with a NULL pointer will produce an Invalid Page | 
 
 
 
 
 | 212 | * Fault and crap out your program. Guess how I know. Hint: stat called on | 
 
 
 
 
 | 213 | * a directory gives 'invalid' times in st_atime etc... | 
 
 
 
 
 | 214 | */ | 
 
 
 
 
 | 215 | _CRTIMP __cdecl __MINGW_NOTHROW  char *asctime (const struct tm *); | 
 
 
 
 
 | 216 |  | 
 
 
 
 
 | 217 | #if __MSVCRT_VERSION__ < __MSVCR80_DLL | 
 
 
 
 
 | 218 | /* Once again, these have been withdrawn from MSVCR80.DLL, (and later), | 
 
 
 
 
 | 219 | * but remain in MSVCRT.DLL, with unambiguously 32-bit time_t. | 
 
 
 
 
 | 220 | */ | 
 
 
 
 
 | 221 | _CRTIMP __cdecl __MINGW_NOTHROW  char *ctime (const time_t *); | 
 
 
 
 
 | 222 | _CRTIMP __cdecl __MINGW_NOTHROW  struct tm *gmtime (const time_t *); | 
 
 
 
 
 | 223 | _CRTIMP __cdecl __MINGW_NOTHROW  struct tm *localtime (const time_t *); | 
 
 
 
 
 | 224 | #endif | 
 
 
 
 
 | 225 |  | 
 
 
 
 
 | 226 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 227 | size_t strftime (char *, size_t, const char *, const struct tm *); | 
 
 
 
 
 | 228 |  | 
 
 
 
 
 | 229 | #ifndef __STRICT_ANSI__ | 
 
 
 
 
 | 230 | extern _CRTIMP __cdecl __MINGW_NOTHROW  void _tzset (void); | 
 
 
 
 
 | 231 |  | 
 
 
 
 
 | 232 | #ifndef _NO_OLDNAMES | 
 
 
 
 
 | 233 | extern _CRTIMP __cdecl __MINGW_NOTHROW  void tzset (void); | 
 
 
 
 
 | 234 | #endif | 
 
 
 
 
 | 235 |  | 
 
 
 
 
 | 236 | _CRTIMP __cdecl __MINGW_NOTHROW  char *_strdate (char *); | 
 
 
 
 
 | 237 | _CRTIMP __cdecl __MINGW_NOTHROW  char *_strtime (char *); | 
 
 
 
 
 | 238 |  | 
 
 
 
 
 | 239 | #if __MSVCRT_VERSION__ >= __MSVCR61_DLL || _WIN32_WINNT >= _WIN32_WINNT_WIN2K | 
 
 
 
 
 | 240 | /* These 64-bit time_t variant functions first became available in | 
 
 
 
 
 | 241 | * MSVCR61.DLL, and its descendants; they were subsequently included | 
 
 
 
 
 | 242 | * in MSVCRT.DLL, from its Win2K release onwards. | 
 
 
 
 
 | 243 | */ | 
 
 
 
 
 | 244 | _CRTIMP __cdecl __MINGW_NOTHROW  __time64_t _time64( __time64_t *); | 
 
 
 
 
 | 245 | _CRTIMP __cdecl __MINGW_NOTHROW  __time64_t _mktime64 (struct tm *); | 
 
 
 
 
 | 246 | _CRTIMP __cdecl __MINGW_NOTHROW    char *_ctime64 (const __time64_t *); | 
 
 
 
 
 | 247 | _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_gmtime64 (const __time64_t *); | 
 
 
 
 
 | 248 | _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_localtime64 (const __time64_t *); | 
 
 
 
 
 | 249 |  | 
 
 
 
 
 | 250 | #endif  /* __MSVCR61_DLL, _WIN32_WINNT_WIN2K, and descendants. */ | 
 
 
 
 
 | 251 |  | 
 
 
 
 
 | 252 | #if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA | 
 
 
 
 
 | 253 | /* The following were introduced in MSVCR80.DLL, and they subsequently | 
 
 
 
 
 | 254 | * appeared in MSVCRT.DLL, from Windows-Vista onwards. | 
 
 
 
 
 | 255 | */ | 
 
 
 
 
 | 256 | _CRTIMP __cdecl __MINGW_NOTHROW    char *_ctime32 (const __time32_t *); | 
 
 
 
 
 | 257 | _CRTIMP __cdecl __MINGW_NOTHROW    double _difftime32 (__time32_t, __time32_t); | 
 
 
 
 
 | 258 | _CRTIMP __cdecl __MINGW_NOTHROW    double _difftime64 (__time64_t, __time64_t); | 
 
 
 
 
 | 259 | _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_gmtime32 (const __time32_t *); | 
 
 
 
 
 | 260 | _CRTIMP __cdecl __MINGW_NOTHROW    struct tm *_localtime32 (const __time32_t *); | 
 
 
 
 
 | 261 | _CRTIMP __cdecl __MINGW_NOTHROW  __time32_t _mktime32 (struct tm *); | 
 
 
 
 
 | 262 | _CRTIMP __cdecl __MINGW_NOTHROW  __time32_t _mkgmtime32 (struct tm *); | 
 
 
 
 
 | 263 | _CRTIMP __cdecl __MINGW_NOTHROW  __time64_t _mkgmtime64 (struct tm *); | 
 
 
 
 
 | 264 | _CRTIMP __cdecl __MINGW_NOTHROW  __time32_t _time32 (__time32_t *); | 
 
 
 
 
 | 265 |  | 
 
 
 
 
 | 266 | # if __MSVCRT_VERSION__ >= __MSVCR80_DLL && defined _USE_32BIT_TIME_T | 
 
 
 
 
 | 267 | /* Users of MSVCR80.DLL and later, (but not users of MSVCRT.DLL, even | 
 
 
 
 
 | 268 | * for _WIN32_WINNT_VISTA and later), must contend with the omission of | 
 
 
 
 
 | 269 | * the following functions from their DLL of choice, thus requiring these | 
 
 
 
 
 | 270 | * brain damaged mappings, in terms of an ambiguously defined 'time_t'; | 
 
 
 
 
 | 271 | * thus, when 'time_t' is declared to be equivalent to '__time32_t': | 
 
 
 
 
 | 272 | */ | 
 
 
 
 
 | 273 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t time (time_t *__v) | 
 
 
 
 
 | 274 | { return _time32 (__v); } | 
 
 
 
 
 | 275 |  | 
 
 
 
 
 | 276 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  double difftime (time_t __v1, time_t __v2) | 
 
 
 
 
 | 277 | { return _difftime32 (__v1, __v2); } | 
 
 
 
 
 | 278 |  | 
 
 
 
 
 | 279 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t mktime (struct tm *__v) | 
 
 
 
 
 | 280 | { return _mktime32 (__v); } | 
 
 
 
 
 | 281 |  | 
 
 
 
 
 | 282 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t _mkgmtime (struct tm *__v) | 
 
 
 
 
 | 283 | { return _mkgmtime32 (__v); } | 
 
 
 
 
 | 284 |  | 
 
 
 
 
 | 285 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  char *ctime (const time_t *__v) | 
 
 
 
 
 | 286 | { return _ctime32 (__v); } | 
 
 
 
 
 | 287 |  | 
 
 
 
 
 | 288 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *gmtime (const time_t *__v) | 
 
 
 
 
 | 289 | { return _gmtime32 (__v); } | 
 
 
 
 
 | 290 |  | 
 
 
 
 
 | 291 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *localtime (const time_t *__v) | 
 
 
 
 
 | 292 | { return _localtime32 (__v); } | 
 
 
 
 
 | 293 |  | 
 
 
 
 
 | 294 | # elif __MSVCRT_VERSION__ >= __MSVCR80_DLL | 
 
 
 
 
 | 295 | /* Correspondingly, for users of MSVCR80.DLL and later only, when there | 
 
 
 
 
 | 296 | * is no explicit declaration to direct the specification of 'time_t', and | 
 
 
 
 
 | 297 | * thus 'time_t' is assumed to be equivalent to '__time64_t': | 
 
 
 
 
 | 298 | */ | 
 
 
 
 
 | 299 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t time (time_t *__v) | 
 
 
 
 
 | 300 | { return _time64 (__v); } | 
 
 
 
 
 | 301 |  | 
 
 
 
 
 | 302 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  double difftime (time_t __v1, time_t __v2) | 
 
 
 
 
 | 303 | { return _difftime64 (__v1, __v2); } | 
 
 
 
 
 | 304 |  | 
 
 
 
 
 | 305 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t mktime (struct tm *__v) | 
 
 
 
 
 | 306 | { return _mktime64 (__v); } | 
 
 
 
 
 | 307 |  | 
 
 
 
 
 | 308 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  time_t _mkgmtime (struct tm *__v) | 
 
 
 
 
 | 309 | { return _mkgmtime64 (__v); } | 
 
 
 
 
 | 310 |  | 
 
 
 
 
 | 311 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  char *ctime (const time_t *__v) | 
 
 
 
 
 | 312 | { return _ctime64 (__v); } | 
 
 
 
 
 | 313 |  | 
 
 
 
 
 | 314 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *gmtime (const time_t *__v) | 
 
 
 
 
 | 315 | { return _gmtime64 (__v); } | 
 
 
 
 
 | 316 |  | 
 
 
 
 
 | 317 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  struct tm *localtime (const time_t *__v) | 
 
 
 
 
 | 318 | { return _localtime64 (__v); } | 
 
 
 
 
 | 319 |  | 
 
 
 
 
 | 320 | # endif /* _USE_32BIT_TIME_T brain damage */ | 
 
 
 
 
 | 321 | #endif  /* >=__MSVCR80.DLL || >=_WIN32_WINNT_VISTA */ | 
 
 
 
 
 | 322 |  | 
 
 
 
 
 | 323 | /* _daylight: non zero if daylight savings time is used. | 
 
 
 
 
 | 324 | * _timezone: difference in seconds between GMT and local time. | 
 
 
 
 
 | 325 | * _tzname: standard/daylight savings time zone names (an array with two | 
 
 
 
 
 | 326 | *          elements). | 
 
 
 
 
 | 327 | */ | 
 
 
 
 
 | 328 | #ifdef __MSVCRT__ | 
 
 
 
 
 | 329 | /* These are for compatibility with pre-VC 5.0 supplied MSVCRT.DLL | 
 
 
 
 
 | 330 | */ | 
 
 
 
 
 | 331 | extern _CRTIMP __cdecl __MINGW_NOTHROW  int   *__p__daylight (void); | 
 
 
 
 
 | 332 | extern _CRTIMP __cdecl __MINGW_NOTHROW  long  *__p__timezone (void); | 
 
 
 
 
 | 333 | extern _CRTIMP __cdecl __MINGW_NOTHROW  char **__p__tzname (void); | 
 
 
 
 
 | 334 |  | 
 
 
 
 
 | 335 | __MINGW_IMPORT int   _daylight; | 
 
 
 
 
 | 336 | __MINGW_IMPORT long  _timezone; | 
 
 
 
 
 | 337 | __MINGW_IMPORT char *_tzname[2]; | 
 
 
 
 
 | 338 |  | 
 
 
 
 
 | 339 | #else /* !__MSVCRT__ (i.e. using CRTDLL.DLL) */ | 
 
 
 
 
 | 340 | #ifndef __DECLSPEC_SUPPORTED | 
 
 
 
 
 | 341 |  | 
 
 
 
 
 | 342 | extern int   *_imp___daylight_dll; | 
 
 
 
 
 | 343 | extern long  *_imp___timezone_dll; | 
 
 
 
 
 | 344 | extern char **_imp___tzname; | 
 
 
 
 
 | 345 |  | 
 
 
 
 
 | 346 | #define _daylight  (*_imp___daylight_dll) | 
 
 
 
 
 | 347 | #define _timezone  (*_imp___timezone_dll) | 
 
 
 
 
 | 348 | #define _tzname    (*_imp___tzname) | 
 
 
 
 
 | 349 |  | 
 
 
 
 
 | 350 | #else /* __DECLSPEC_SUPPORTED */ | 
 
 
 
 
 | 351 |  | 
 
 
 
 
 | 352 | __MINGW_IMPORT int   _daylight_dll; | 
 
 
 
 
 | 353 | __MINGW_IMPORT long  _timezone_dll; | 
 
 
 
 
 | 354 | __MINGW_IMPORT char *_tzname[2]; | 
 
 
 
 
 | 355 |  | 
 
 
 
 
 | 356 | #define _daylight  _daylight_dll | 
 
 
 
 
 | 357 | #define _timezone  _timezone_dll | 
 
 
 
 
 | 358 |  | 
 
 
 
 
 | 359 | #endif /* __DECLSPEC_SUPPORTED */ | 
 
 
 
 
 | 360 | #endif /* ! __MSVCRT__ */ | 
 
 
 
 
 | 361 | #endif /* ! __STRICT_ANSI__ */ | 
 
 
 
 
 | 362 |  | 
 
 
 
 
 | 363 | #ifndef _NO_OLDNAMES | 
 
 
 
 
 | 364 | #ifdef __MSVCRT__ | 
 
 
 
 
 | 365 |  | 
 
 
 
 
 | 366 | /* These go in the oldnames import library for MSVCRT. | 
 
 
 
 
 | 367 | */ | 
 
 
 
 
 | 368 | __MINGW_IMPORT int   daylight; | 
 
 
 
 
 | 369 | __MINGW_IMPORT long  timezone; | 
 
 
 
 
 | 370 | __MINGW_IMPORT char *tzname[2]; | 
 
 
 
 
 | 371 |  | 
 
 
 
 
 | 372 | #else /* ! __MSVCRT__ */ | 
 
 
 
 
 | 373 | /* CRTDLL is royally messed up when it comes to these macros. | 
 
 
 
 
 | 374 | * TODO: import and alias these via oldnames import library instead | 
 
 
 
 
 | 375 | * of macros. | 
 
 
 
 
 | 376 | */ | 
 
 
 
 
 | 377 | #define daylight  _daylight | 
 
 
 
 
 | 378 |  | 
 
 
 
 
 | 379 | /* NOTE: timezone not defined as a macro because it would conflict with | 
 
 
 
 
 | 380 | * struct timezone in sys/time.h.  Also, tzname used to a be macro, but | 
 
 
 
 
 | 381 | * now it's in moldname. | 
 
 
 
 
 | 382 | */ | 
 
 
 
 
 | 383 | __MINGW_IMPORT char     *tzname[2]; | 
 
 
 
 
 | 384 |  | 
 
 
 
 
 | 385 | #endif  /* ! __MSVCRT__ */ | 
 
 
 
 
 | 386 | #endif  /* ! _NO_OLDNAMES */ | 
 
 
 
 
 | 387 |  | 
 
 
 
 
 | 388 | #if _POSIX_C_SOURCE | 
 
 
 
 
 | 389 | /* The nanosleep() function provides the most general purpose API for | 
 
 
 
 
 | 390 | * process/thread suspension; it provides for specification of periods | 
 
 
 
 
 | 391 | * ranging from ~7.5 ms mean, (on WinNT derivatives; ~27.5 ms on Win9x), | 
 
 
 
 
 | 392 | * extending up to ~136 years, (effectively eternity). | 
 
 
 
 
 | 393 | */ | 
 
 
 
 
 | 394 | __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 395 | int nanosleep( const struct timespec *, struct timespec * ); | 
 
 
 
 
 | 396 |  | 
 
 
 
 
 | 397 | #ifndef __NO_INLINE__ | 
 
 
 
 
 | 398 | /* We may conveniently provide an in-line implementation here, | 
 
 
 
 
 | 399 | * in terms of the __mingw_sleep() helper function. | 
 
 
 
 
 | 400 | */ | 
 
 
 
 
 | 401 | __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 402 | int __mingw_sleep( unsigned long, unsigned long ); | 
 
 
 
 
 | 403 |  | 
 
 
 
 
 | 404 | __CRT_INLINE __LIBIMPL__(( FUNCTION = nanosleep )) | 
 
 
 
 
 | 405 | int nanosleep( const struct timespec *period, struct timespec *residual ) | 
 
 
 
 
 | 406 | { | 
 
 
 
 
 | 407 | if( residual != (void *)(0) ) | 
 
 
 
 
 | 408 | residual->tv_sec = (__time64_t)(residual->tv_nsec = 0); | 
 
 
 
 
 | 409 | return __mingw_sleep((unsigned)(period->tv_sec), (period->tv_sec < 0LL) | 
 
 
 
 
 | 410 | ? (unsigned)(-1) : (unsigned)(period->tv_nsec)); | 
 
 
 
 
 | 411 | } | 
 
 
 
 
 | 412 | #endif  /* !__NO_INLINE__ */ | 
 
 
 
 
 | 413 | #endif  /* _POSIX_C_SOURCE */ | 
 
 
 
 
 | 414 |  | 
 
 
 
 
 | 415 | _END_C_DECLS | 
 
 
 
 
 | 416 |  | 
 
 
 
 
 | 417 | #endif  /* _TIME_H included in its own right */ | 
 
 
 
 
 | 418 |  | 
 
 
 
 
 | 419 | #if __need_wchar_decls && ! (defined _TIME_H && defined _WCHAR_H) | 
 
 
 
 
 | 420 | /* Wide character time function prototypes.  These are nominally declared | 
 
 
 
 
 | 421 | * both here, in <time.h>, and also in <wchar.h>; we declare them here, and | 
 
 
 
 
 | 422 | * make them available for selective inclusion by <wchar.h>, but such that | 
 
 
 
 
 | 423 | * the declarations, and in particular any in-line implementation of the | 
 
 
 
 
 | 424 | * _wctime() function, are visible only on the first time parse, when | 
 
 
 
 
 | 425 | * one of either _TIME_H, or _WCHAR_H, but not both, is defined. | 
 
 
 
 
 | 426 | */ | 
 
 
 
 
 | 427 | _BEGIN_C_DECLS | 
 
 
 
 
 | 428 |  | 
 
 
 
 
 | 429 | #if defined __MSVCRT__ && ! defined __STRICT_ANSI__ | 
 
 
 
 
 | 430 | _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wasctime (const struct tm *); | 
 
 
 
 
 | 431 | _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wstrdate (wchar_t *); | 
 
 
 
 
 | 432 | _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wstrtime (wchar_t *); | 
 
 
 
 
 | 433 |  | 
 
 
 
 
 | 434 | #if __MSVCRT_VERSION__ >= __MSVCR61_DLL || _WIN32_WINNT >= _WIN32_WINNT_WIN2K | 
 
 
 
 
 | 435 | /* A __time64_t specific variant of _wctime(), identified as _wctime64(), | 
 
 
 
 
 | 436 | * first appeared in the non-free MSVC specific MSVCR61.DLL, and was added | 
 
 
 
 
 | 437 | * to the freely available platform MSVCRT.DLL from Win2K onwards... | 
 
 
 
 
 | 438 | */ | 
 
 
 
 
 | 439 | _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wctime64 (const __time64_t *); | 
 
 
 
 
 | 440 | #endif | 
 
 
 
 
 | 441 | #if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA | 
 
 
 
 
 | 442 | /* ...whereas its __time32_t specific counterpart, _wctime32(), did not | 
 
 
 
 
 | 443 | * make an appearance until MSVCR80.DLL, and was not added to MSVCRT.DLL | 
 
 
 
 
 | 444 | * until the release of Vista. | 
 
 
 
 
 | 445 | */ | 
 
 
 
 
 | 446 | _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wctime32 (const __time32_t *); | 
 
 
 
 
 | 447 | #endif | 
 
 
 
 
 | 448 | #if __MSVCRT_VERSION__ < __MSVCR80_DLL | 
 
 
 
 
 | 449 | /* Present in all versions of MSVCRT.DLL, but withdrawn from non-free | 
 
 
 
 
 | 450 | * MSVC specific releases from MSVCR80.DLL onwards; in all versions of | 
 
 
 
 
 | 451 | * MSVCRT.DLL, _wctime() accepts a 32-bit time_t argument pointer. | 
 
 
 
 
 | 452 | */ | 
 
 
 
 
 | 453 | _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wctime (const time_t *); | 
 
 
 
 
 | 454 |  | 
 
 
 
 
 | 455 | #else /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */ | 
 
 
 
 
 | 456 | /* For users of the non-free MSVC libraries, we must deal with both the | 
 
 
 
 
 | 457 | * absence of _wctime(), and with Microsoft's attendant _USE_32BIT_TIME_T | 
 
 
 
 
 | 458 | * brain damage, as we map an inline replacement... | 
 
 
 
 
 | 459 | */ | 
 
 
 
 
 | 460 | __CRT_ALIAS __cdecl __MINGW_NOTHROW  wchar_t *_wctime (const time_t *__v) | 
 
 
 
 
 | 461 | { | 
 
 
 
 
 | 462 | /* ...in terms of an appropriately selected time_t size specific | 
 
 
 
 
 | 463 | * alternative function, which should be available... | 
 
 
 
 
 | 464 | */ | 
 
 
 
 
 | 465 | # ifdef _USE_32BIT_TIME_T | 
 
 
 
 
 | 466 | /* ...i.e. the __time32_t specific _wctime32(), when the user has | 
 
 
 
 
 | 467 | * enabled this choice; (the only sane choice, if compatibility with | 
 
 
 
 
 | 468 | * MSVCRT.DLL is desired)... | 
 
 
 
 
 | 469 | */ | 
 
 
 
 
 | 470 | return _wctime32 (__v); | 
 
 
 
 
 | 471 |  | 
 
 
 
 
 | 472 | # else  /* !_USE_32BIT_TIME_T */ | 
 
 
 
 
 | 473 | /* ...or otherwise, the __time64_t specific _wctime64(), (in which | 
 
 
 
 
 | 474 | * case, compatibility with MSVCRT.DLL must be sacrificed). | 
 
 
 
 
 | 475 | */ | 
 
 
 
 
 | 476 | return _wctime64 (__v); | 
 
 
 
 
 | 477 | # endif /* !_USE_32BIT_TIME_T */ | 
 
 
 
 
 | 478 | } | 
 
 
 
 
 | 479 | #endif  /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */ | 
 
 
 
 
 | 480 | #endif  /* __MSVCRT__ && !__STRICT_ANSI__ */ | 
 
 
 
 
 | 481 |  | 
 
 
 
 
 | 482 | _CRTIMP __cdecl __MINGW_NOTHROW | 
 
 
 
 
 | 483 | size_t wcsftime (wchar_t *, size_t, const wchar_t *, const struct tm *); | 
 
 
 
 
 | 484 |  | 
 
 
 
 
 | 485 | _END_C_DECLS | 
 
 
 
 
 | 486 |  | 
 
 
 
 
 | 487 | #endif  /* ! (defined _TIME_H && defined _WCHAR_H) */ | 
 
 
 
 
 | 488 |  | 
 
 
 
 
 | 489 | /* We're done with all <time.h> specific content selectors; clear them. | 
 
 
 
 
 | 490 | */ | 
 
 
 
 
 | 491 | #undef __need_time_t | 
 
 
 
 
 | 492 | #undef __need_struct_timespec | 
 
 
 
 
 | 493 | #undef __need_wchar_decls | 
 
 
 
 
 | 494 |  | 
 
 
 
 
 | 495 | #endif /* ! RC_INVOKED */ | 
 
 
 
 
 | 496 | #endif /* !_TIME_H after __need_time_t processing */ | 
 
 
 
 
 | 497 | #endif /* !_TIME_H: $RCSfile: time.h,v $: end of file */ |