win32/include: enable _timezone etc variables.
[tinycc.git] / win32 / include / time.h
blob6c72e26606b0519444474274bb26cbffc4e4ff62
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #ifndef _TIME_H_
7 #define _TIME_H_
9 #include <_mingw.h>
11 #ifndef _WIN32
12 #error Only Win32 target is supported!
13 #endif
15 #pragma pack(push,_CRT_PACKING)
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
21 #ifndef _CRTIMP
22 #define _CRTIMP __declspec(dllimport)
23 #endif
25 #ifndef _WCHAR_T_DEFINED
26 #define _WCHAR_T_DEFINED
27 typedef unsigned short wchar_t;
28 #endif
30 #ifndef _TIME32_T_DEFINED
31 #define _TIME32_T_DEFINED
32 typedef long __time32_t;
33 #endif
35 #ifndef _TIME64_T_DEFINED
36 #define _TIME64_T_DEFINED
37 #if _INTEGRAL_MAX_BITS >= 64
38 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
39 typedef int _time64_t __attribute__ ((mode (DI)));
40 #else
41 typedef __int64 __time64_t;
42 #endif
43 #endif
44 #endif
46 #ifndef _TIME_T_DEFINED
47 #define _TIME_T_DEFINED
48 #ifdef _USE_32BIT_TIME_T
49 typedef __time32_t time_t;
50 #else
51 typedef __time64_t time_t;
52 #endif
53 #endif
55 #ifndef _CLOCK_T_DEFINED
56 #define _CLOCK_T_DEFINED
57 typedef long clock_t;
58 #endif
60 #ifndef _SIZE_T_DEFINED
61 #define _SIZE_T_DEFINED
62 #undef size_t
63 #ifdef _WIN64
64 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
65 typedef unsigned int size_t __attribute__ ((mode (DI)));
66 #else
67 typedef unsigned __int64 size_t;
68 #endif
69 #else
70 typedef unsigned int size_t;
71 #endif
72 #endif
74 #ifndef _SSIZE_T_DEFINED
75 #define _SSIZE_T_DEFINED
76 #undef ssize_t
77 #ifdef _WIN64
78 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
79 typedef int ssize_t __attribute__ ((mode (DI)));
80 #else
81 typedef __int64 ssize_t;
82 #endif
83 #else
84 typedef int ssize_t;
85 #endif
86 #endif
88 #ifndef NULL
89 #ifdef __cplusplus
90 #define NULL 0
91 #else
92 #define NULL ((void *)0)
93 #endif
94 #endif
96 #ifdef _USE_32BIT_TIME_T
97 #define _localtime32 localtime
98 #define _difftime32 difftime
99 #define _ctime32 ctime
100 #define _gmtime32 gmtime
101 #define _mktime32 mktime
102 #define _time32 time
103 #endif
105 #ifndef _TM_DEFINED
106 #define _TM_DEFINED
107 struct tm {
108 int tm_sec;
109 int tm_min;
110 int tm_hour;
111 int tm_mday;
112 int tm_mon;
113 int tm_year;
114 int tm_wday;
115 int tm_yday;
116 int tm_isdst;
118 #endif
120 #define CLOCKS_PER_SEC 1000
122 __MINGW_IMPORT int _daylight;
123 __MINGW_IMPORT long _dstbias;
124 __MINGW_IMPORT long _timezone;
125 __MINGW_IMPORT char * _tzname[2];
126 _CRTIMP errno_t __cdecl _get_daylight(int *_Daylight);
127 _CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias);
128 _CRTIMP errno_t __cdecl _get_timezone(long *_Timezone);
129 _CRTIMP errno_t __cdecl _get_tzname(size_t *_ReturnValue,char *_Buffer,size_t _SizeInBytes,int _Index);
130 char *__cdecl asctime(const struct tm *_Tm);
131 _CRTIMP char *__cdecl _ctime32(const __time32_t *_Time);
132 clock_t __cdecl clock(void);
133 _CRTIMP double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2);
134 _CRTIMP struct tm *__cdecl _gmtime32(const __time32_t *_Time);
135 _CRTIMP struct tm *__cdecl _localtime32(const __time32_t *_Time);
136 size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm);
137 _CRTIMP size_t __cdecl _strftime_l(char *_Buf,size_t _Max_size,const char *_Format,const struct tm *_Tm,_locale_t _Locale);
138 _CRTIMP char *__cdecl _strdate(char *_Buffer);
139 _CRTIMP char *__cdecl _strtime(char *_Buffer);
140 _CRTIMP __time32_t __cdecl _time32(__time32_t *_Time);
141 _CRTIMP __time32_t __cdecl _mktime32(struct tm *_Tm);
142 _CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm);
143 #if defined (_POSIX_) || defined(__GNUC__)
144 void __cdecl tzset(void);
145 #else
146 _CRTIMP void __cdecl _tzset(void);
147 #endif
149 #if _INTEGRAL_MAX_BITS >= 64
150 double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2);
151 _CRTIMP char *__cdecl _ctime64(const __time64_t *_Time);
152 _CRTIMP struct tm *__cdecl _gmtime64(const __time64_t *_Time);
153 _CRTIMP struct tm *__cdecl _localtime64(const __time64_t *_Time);
154 _CRTIMP __time64_t __cdecl _mktime64(struct tm *_Tm);
155 _CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *_Tm);
156 _CRTIMP __time64_t __cdecl _time64(__time64_t *_Time);
157 #endif
158 unsigned __cdecl _getsystime(struct tm *_Tm);
159 unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec);
161 #ifndef _SIZE_T_DEFINED
162 #define _SIZE_T_DEFINED
163 #ifdef _WIN64
164 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
165 typedef unsigned int size_t __attribute__ ((mode (DI)));
166 #else
167 typedef unsigned __int64 size_t;
168 #endif
169 #else
170 typedef unsigned long size_t;
171 #endif
172 #endif
174 #ifndef _SSIZE_T_DEFINED
175 #define _SSIZE_T_DEFINED
176 #ifdef _WIN64
177 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
178 typedef int ssize_t __attribute__ ((mode (DI)));
179 #else
180 typedef __int64 ssize_t;
181 #endif
182 #else
183 typedef long ssize_t;
184 #endif
185 #endif
187 #ifndef _WTIME_DEFINED
188 _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm);
189 _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time);
190 size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm);
191 _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale);
192 _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer);
193 _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer);
194 #if _INTEGRAL_MAX_BITS >= 64
195 _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time);
196 #endif
198 #if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL)
199 #define _INC_WTIME_INL
200 #ifdef _USE_32BIT_TIME_T
201 __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); }
202 #else
203 __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
204 #endif
205 #endif
207 #define _WTIME_DEFINED
208 #endif
210 #ifndef RC_INVOKED
211 double __cdecl difftime(time_t _Time1,time_t _Time2);
212 char *__cdecl ctime(const time_t *_Time);
213 struct tm *__cdecl gmtime(const time_t *_Time);
214 struct tm *__cdecl localtime(const time_t *_Time);
215 struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *);
217 time_t __cdecl mktime(struct tm *_Tm);
218 time_t __cdecl _mkgmtime(struct tm *_Tm);
219 time_t __cdecl time(time_t *_Time);
221 #ifdef _USE_32BIT_TIME_T
222 #if 0
223 __CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); }
224 __CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); }
225 __CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); }
226 __CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); }
227 __CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); }
228 __CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); }
229 __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); }
230 #endif
231 #else
232 __CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); }
233 __CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); }
234 __CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); }
235 __CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); }
236 __CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); }
237 __CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); }
238 __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); }
239 #endif
240 #endif
242 #if !defined(NO_OLDNAMES) || defined(_POSIX)
243 #define CLK_TCK CLOCKS_PER_SEC
245 __MINGW_IMPORT int daylight;
246 __MINGW_IMPORT long dstbias;
247 __MINGW_IMPORT long timezone;
248 __MINGW_IMPORT char *tzname[2];
249 void __cdecl tzset(void);
250 #endif
252 #ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */
253 #define _TIMEVAL_DEFINED
254 struct timeval {
255 long tv_sec;
256 long tv_usec;
258 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
259 #define timercmp(tvp,uvp,cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || (tvp)->tv_sec==(uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
260 #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
261 #endif /* _TIMEVAL_DEFINED */
263 #ifndef __STRICT_ANSI__
264 #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */
265 #define _TIMEZONE_DEFINED
266 struct timezone {
267 int tz_minuteswest;
268 int tz_dsttime;
271 extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z);
272 #endif
273 #endif /* __STRICT_ANSI__ */
275 #ifdef __cplusplus
277 #endif
279 #pragma pack(pop)
281 #include <sec_api/time_s.h>
283 /* Adding timespec definition. */
284 #include <sys/timeb.h>
286 #endif /* End _TIME_H_ */