ReactOS  0.4.15-dev-3287-gfec35dc
time.h
Go to the documentation of this file.
1 
7 #ifndef _TIME_H_
8 #define _TIME_H_
9 
10 #include <crtdefs.h>
11 
12 #ifndef _WIN32
13 #error Only Win32 target is supported!
14 #endif
15 
16 #pragma pack(push,_CRT_PACKING)
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #ifndef _TIME32_T_DEFINED
23 #define _TIME32_T_DEFINED
24  typedef long __time32_t;
25 #endif
26 
27 #ifndef _TIME64_T_DEFINED
28 #define _TIME64_T_DEFINED
29 #if _INTEGRAL_MAX_BITS >= 64
30 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
31  typedef int _time64_t __attribute__ ((mode (DI)));
32 #else
34 #endif
35 #endif
36 #endif
37 
38 #ifndef _TIME_T_DEFINED
39 #define _TIME_T_DEFINED
40 #ifdef _USE_32BIT_TIME_T
41  typedef __time32_t time_t;
42 #else
43  typedef __time64_t time_t;
44 #endif
45 #endif
46 
47 #ifndef _CLOCK_T_DEFINED
48 #define _CLOCK_T_DEFINED
49  typedef long clock_t;
50 #endif
51 
52 #ifndef _SIZE_T_DEFINED
53 #define _SIZE_T_DEFINED
54 #undef size_t
55 #ifdef _WIN64
56 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
57  typedef unsigned int size_t __attribute__ ((mode (DI)));
58 #else
59  __MINGW_EXTENSION typedef unsigned __int64 size_t;
60 #endif
61 #else
62  typedef unsigned int size_t;
63 #endif
64 #endif
65 
66 #ifndef _TM_DEFINED
67 #define _TM_DEFINED
68  struct tm {
69  int tm_sec;
70  int tm_min;
71  int tm_hour;
72  int tm_mday;
73  int tm_mon;
74  int tm_year;
75  int tm_wday;
76  int tm_yday;
77  int tm_isdst;
78  };
79 #endif
80 
81 #define CLOCKS_PER_SEC 1000
82 
83  _CRTDATA(extern int _daylight);
84  _CRTDATA(extern long _dstbias);
85  _CRTDATA(extern long _timezone);
86  _CRTDATA(extern char * _tzname[2]);
87 
88  _CRTIMP errno_t __cdecl _get_daylight(_Out_ int *_Daylight);
89  _CRTIMP errno_t __cdecl _get_dstbias(_Out_ long *_Daylight_savings_bias);
90  _CRTIMP errno_t __cdecl _get_timezone(_Out_ long *_Timezone);
91 
92  _CRTIMP
93  errno_t
94  __cdecl
96  _Out_ size_t *_ReturnValue,
97  _Out_writes_z_(_SizeInBytes) char *_Buffer,
98  _In_ size_t _SizeInBytes,
99  _In_ int _Index);
100 
102  _CRTIMP
104  char *
105  __cdecl
106  asctime(
107  _In_ const struct tm *_Tm);
108 
109  _CRTIMP
110  _CRT_INSECURE_DEPRECATE(_ctime32_s)
111  char *
112  __cdecl
113  _ctime32(
114  _In_ const __time32_t *_Time);
115 
117 
118  _CRTIMP
119  double
120  __cdecl
121  _difftime32(
122  _In_ __time32_t _Time1,
123  _In_ __time32_t _Time2);
124 
126  _CRTIMP
128  struct tm *
129  __cdecl
130  _gmtime32(
131  _In_ const __time32_t *_Time);
132 
133  _CRTIMP
135  struct tm *
136  __cdecl
137  _localtime32(
138  _In_ const __time32_t *_Time);
139 
140  _Success_(return > 0)
141  _CRTIMP
142  size_t
143  __cdecl
144  strftime(
145  _Out_writes_z_(_SizeInBytes) char *_Buf,
149 
150  _Success_(return > 0)
151  _CRTIMP
152  size_t
153  __cdecl
154  _strftime_l(
155  _Out_writes_z_(_Max_size) char *_Buf,
156  _In_ size_t _Max_size,
160 
161  _CRTIMP char *__cdecl _strdate(_Out_writes_z_(9) char *_Buffer);
162  _CRTIMP char *__cdecl _strtime(_Out_writes_z_(9) char *_Buffer);
166  _CRTIMP void __cdecl _tzset(void);
168 
170  unsigned
171  __cdecl
172  _setsystime(
173  _In_ struct tm *_Tm,
174  unsigned _MilliSec);
175 
177  _CRTIMP
178  errno_t
179  __cdecl
180  asctime_s(
182  _In_range_(>= , 26) size_t _SizeInBytes,
183  _In_ const struct tm *_Tm);
184 
185  _Success_(return == 0)
186  _CRTIMP
187  errno_t
188  __cdecl
189  _ctime32_s(
193 
195  _CRTIMP
196  errno_t
197  __cdecl
198  _gmtime32_s(
199  _In_ struct tm *_Tm,
201 
202  _CRTIMP
203  errno_t
204  __cdecl
206  _Out_ struct tm *_Tm,
208 
210  _CRTIMP
211  errno_t
212  __cdecl
213  _strdate_s(
215  _In_range_(>= , 9) size_t _SizeInBytes);
216 
218  _CRTIMP
219  errno_t
220  __cdecl
221  _strtime_s(
223  _In_range_(>= , 9) size_t _SizeInBytes);
224 
225 #if _INTEGRAL_MAX_BITS >= 64
226 
228  _CRTIMP
229  double
230  __cdecl
231  _difftime64(
232  _In_ __time64_t _Time1,
233  _In_ __time64_t _Time2);
234 
235  _CRTIMP
237  char *
238  __cdecl
239  _ctime64(
240  _In_ const __time64_t *_Time);
241 
242  _CRTIMP
244  struct tm *
245  __cdecl
246  _gmtime64(
247  _In_ const __time64_t *_Time);
248 
249  _CRTIMP
251  struct tm *
252  __cdecl
253  _localtime64(
254  _In_ const __time64_t *_Time);
255 
259 
260  _CRTIMP
261  errno_t
262  __cdecl
263  _ctime64_s(
264  _Out_writes_z_(_SizeInBytes) char *_Buf,
265  _In_ size_t _SizeInBytes,
266  _In_ const __time64_t *_Time);
267 
268  _CRTIMP
269  errno_t
270  __cdecl
271  _gmtime64_s(
272  _Out_ struct tm *_Tm,
273  _In_ const __time64_t *_Time);
274 
275  _CRTIMP
276  errno_t
277  __cdecl
279  _Out_ struct tm *_Tm,
280  _In_ const __time64_t *_Time);
281 
282 #endif /* _INTEGRAL_MAX_BITS >= 64 */
283 
284 #ifndef _WTIME_DEFINED
285 #define _WTIME_DEFINED
286 
287  _CRTIMP
289  wchar_t *
290  __cdecl
291  _wasctime(
292  _In_ const struct tm *_Tm);
293 
294  _CRTIMP wchar_t *__cdecl _wctime(const time_t *_Time);
295 
296  _CRTIMP
298  wchar_t *
299  __cdecl
300  _wctime32(
301  _In_ const __time32_t *_Time);
302 
303  _Success_(return > 0)
304  _CRTIMP
305  size_t
306  __cdecl
307  wcsftime(
308  _Out_writes_z_(_SizeInWords) wchar_t *_Buf,
311  _In_ const struct tm *_Tm);
312 
313  _Success_(return > 0)
314  _CRTIMP
315  size_t
316  __cdecl
317  _wcsftime_l(
318  _Out_writes_z_(_SizeInWords) wchar_t *_Buf,
319  _In_ size_t _SizeInWords,
323 
324  _CRTIMP wchar_t *__cdecl _wstrdate(_Out_writes_z_(9) wchar_t *_Buffer);
325  _CRTIMP wchar_t *__cdecl _wstrtime(_Out_writes_z_(9) wchar_t *_Buffer);
326 
327  _CRTIMP
328  errno_t
329  __cdecl
330  _wasctime_s(
332  _In_range_(>= , 26) size_t _SizeInWords,
333  _In_ const struct tm *_Tm);
334 
335  _Success_(return == 0)
336  _CRTIMP
337  errno_t
338  __cdecl
339  _wctime32_s(
341  _In_ size_t _SizeInWords,
343 
344  _CRTIMP
345  errno_t
346  __cdecl
347  _wstrdate_s(
349  _In_ size_t _SizeInWords);
350 
351  _CRTIMP
352  errno_t
353  __cdecl
354  _wstrtime_s(
356  _In_range_(>= , 9) size_t _SizeInWords);
357 
358 #if _INTEGRAL_MAX_BITS >= 64
359 
360  _CRTIMP
362  wchar_t *
363  __cdecl
364  _wctime64(
365  _In_ const __time64_t *_Time);
366 
367  _Success_(return == 0)
368  _CRTIMP
369  errno_t
370  __cdecl
371  _wctime64_s(
373  _In_ size_t _SizeInWords,
375 
376 #endif /* _INTEGRAL_MAX_BITS >= 64 */
377 
378 #if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL)
379 #define _INC_WTIME_INL
380 #ifdef _USE_32BIT_TIME_T
381 /* Do it like this to be compatible to msvcrt.dll on 32 bit windows XP and before */
382 __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); }
383 #else
384 __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
385 #endif
386 #endif
387 
388 #endif /* !_WTIME_DEFINED */
389 
390  _CRTIMP double __cdecl difftime(time_t _Time1,time_t _Time2);
391  _CRTIMP char *__cdecl ctime(const time_t *_Time);
392  _CRTIMP struct tm *__cdecl gmtime(const time_t *_Time);
393  _CRTIMP struct tm *__cdecl localtime(const time_t *_Time);
394  _CRTIMP struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *);
395 
396  _CRTIMP time_t __cdecl mktime(struct tm *_Tm);
399 
400 #if !defined(RC_INVOKED) && !defined(_NO_INLINING) && !defined(_CRTBLD)
401 #ifdef _USE_32BIT_TIME_T
402 #if 0
403 __CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); }
404 __CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); }
405 __CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); }
406 __CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); }
407 __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); }
408 __CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); }
409 __CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); }
410 __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); }
411 #endif
412 #else
413 __CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); }
414 __CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); }
415 __CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); }
416 __CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); }
417 __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); }
418 __CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); }
419 __CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); }
420 __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); }
421 #endif
422 #endif
423 
424 #if !defined(NO_OLDNAMES) || defined(_POSIX)
425 #define CLK_TCK CLOCKS_PER_SEC
426 
427  _CRTIMP extern int daylight;
428  _CRTIMP extern long timezone;
429  _CRTIMP extern char *tzname[2];
430  _CRTIMP void __cdecl tzset(void);
431 #endif
432 
433 #ifdef __cplusplus
434 }
435 #endif
436 
437 #pragma pack(pop)
438 
439 #endif /* End _TIME_H_ */
_CRTIMP errno_t __cdecl _wctime64_s(_Out_writes_(_SizeInWords) _Post_readable_size_(26) wchar_t *_Buf, _In_ size_t _SizeInWords, _In_ const __time64_t *_Time)
_Success_(return > 0) _CRTIMP size_t __cdecl strftime(_Out_writes_z_(_SizeInBytes) char *_Buf
_Check_return_wat_ _CRTIMP errno_t __cdecl _gmtime32_s(_In_ struct tm *_Tm, _In_ const __time32_t *_Time)
_CRTIMP void __cdecl tzset(void)
return
Definition: dirsup.c:529
_CRTIMP char *__cdecl _strdate(_Out_writes_z_(9) char *_Buffer)
int tm_min
Definition: time.h:70
#define _In_range_(lb, ub)
Definition: ms_sal.h:571
#define _In_opt_
Definition: ms_sal.h:309
_CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _getsystime(_Out_ struct tm *_Tm)
#define _Inout_
Definition: ms_sal.h:378
#define _Post_readable_size_(size)
Definition: ms_sal.h:649
#define __cdecl
Definition: accygwin.h:79
#define _Out_
Definition: ms_sal.h:345
_CRTIMP wchar_t *__cdecl _wctime(const time_t *_Time)
Definition: time.h:384
_CRTIMP void __cdecl _tzset(void)
Definition: timezone.c:92
#define _CRTIMP
Definition: crtdefs.h:72
_In_ size_t _Max_size
Definition: time.h:156
_CRTIMP __time64_t __cdecl _mkgmtime64(_Inout_ struct tm *_Tm)
_CRTIMP long timezone
_CRTIMP __time32_t __cdecl _mkgmtime32(_Inout_ struct tm *_Tm)
int tm_mday
Definition: time.h:72
_CRTIMP errno_t __cdecl _localtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
long __time32_t
Definition: crtdefs.h:379
int tm_year
Definition: time.h:74
_CRTIMP errno_t __cdecl _get_daylight(_Out_ int *_Daylight)
_CRTIMP struct tm *__cdecl _localtime32(_In_ const __time32_t *_Time)
_CRTIMP wchar_t *__cdecl _wasctime(_In_ const struct tm *_Tm)
_CRTIMP char *__cdecl _strtime(_Out_writes_z_(9) char *_Buffer)
size_t CDECL wcsftime(wchar_t *str, size_t max, const wchar_t *format, const struct tm *mstm)
Definition: strftime.c:302
_Check_return_ _CRTIMP char *__cdecl asctime(_In_ const struct tm *_Tm)
_CRTIMP struct tm *__cdecl localtime_r(const time_t *_Time, struct tm *)
_CRTIMP __time64_t __cdecl _time64(_Out_opt_ __time64_t *_Time)
_CRTIMP char *__cdecl _ctime64(_In_ const __time64_t *_Time)
_CRTIMP wchar_t *__cdecl _wctime64(_In_ const __time64_t *_Time)
unsigned int _getsystime(struct tm *tp)
Definition: systime.c:18
#define __attribute__(x)
Definition: wpp_private.h:207
_Check_return_wat_ _CRTIMP errno_t __cdecl _strtime_s(_Out_writes_(_SizeInBytes) _Post_readable_size_(9) char *_Buf, _In_range_(>=, 9) size_t _SizeInBytes)
__kernel_clock_t clock_t
Definition: linux.h:257
_Check_return_ _CRTIMP double __cdecl _difftime64(_In_ __time64_t _Time1, _In_ __time64_t _Time2)
_In_ size_t _In_z_ _Printf_format_string_ const char * _Format
Definition: time.h:146
#define __MINGW_EXTENSION
Definition: _mingw.h:166
#define _In_
Definition: ms_sal.h:308
_CRTIMP errno_t __cdecl _wasctime_s(_Out_writes_(_SizeInWords) _Post_readable_size_(26) wchar_t *_Buf, _In_range_(>=, 26) size_t _SizeInWords, _In_ const struct tm *_Tm)
#define _In_z_
Definition: ms_sal.h:313
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
int tm_mon
Definition: time.h:73
_CRTIMP wchar_t *__cdecl _wctime32(_In_ const __time32_t *_Time)
int errno_t
Definition: crtdefs.h:374
_CRTIMP time_t __cdecl _mkgmtime(struct tm *_Tm)
Definition: time.h:419
_In_ size_t _SizeInWords
Definition: time.h:309
long _dstbias
Definition: timezone.c:62
size_t CDECL strftime(char *str, size_t max, const char *format, const struct tm *mstm)
Definition: strftime.c:293
__kernel_size_t size_t
Definition: linux.h:237
long clock_t
Definition: time.h:49
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm * _Tm
Definition: time.h:148
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm _In_opt_ _locale_t _Locale
Definition: time.h:158
_CRTIMP wchar_t *__cdecl _wstrtime(_Out_writes_z_(9) wchar_t *_Buffer)
_CRTIMP __time32_t __cdecl _mktime32(_Inout_ struct tm *_Tm)
_CRTIMP struct tm *__cdecl _localtime64(_In_ const __time64_t *_Time)
_Check_return_wat_ _CRTIMP errno_t __cdecl asctime_s(_Out_writes_(_SizeInBytes) _Post_readable_size_(26) char *_Buf, _In_range_(>=, 26) size_t _SizeInBytes, _In_ const struct tm *_Tm)
_CRTIMP char * tzname[2]
_CRTIMP errno_t __cdecl _wstrtime_s(_Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t *_Buf, _In_range_(>=, 9) size_t _SizeInWords)
int _daylight
Definition: timezone.c:30
_CRTIMP __time32_t __cdecl _time32(_Out_opt_ __time32_t *_Time)
char * _tzname[2]
Definition: timezone.c:22
#define _Out_writes_z_(size)
Definition: ms_sal.h:352
_Check_return_wat_ _CRTIMP errno_t __cdecl _strdate_s(_Out_writes_(_SizeInBytes) _Post_readable_size_(9) char *_Buf, _In_range_(>=, 9) size_t _SizeInBytes)
_CRTIMP errno_t __cdecl _get_dstbias(_Out_ long *_Daylight_savings_bias)
Definition: time.h:68
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:416
GLenum mode
Definition: glext.h:6217
_CRTIMP char *__cdecl _ctime32(_In_ const __time32_t *_Time)
int tm_wday
Definition: time.h:75
_CRTIMP errno_t __cdecl _localtime32_s(_Out_ struct tm *_Tm, _In_ const __time32_t *_Time)
long _timezone
Definition: timezone.c:46
_CRTIMP int daylight
int tm_yday
Definition: time.h:76
_Check_return_ _CRTIMP struct tm *__cdecl _gmtime32(_In_ const __time32_t *_Time)
_CRTIMP wchar_t *__cdecl _wstrdate(_Out_writes_z_(9) wchar_t *_Buffer)
_CRTIMP struct tm *__cdecl _gmtime64(_In_ const __time64_t *_Time)
#define _Check_return_
Definition: ms_sal.h:557
_CRTIMP errno_t __cdecl _get_tzname(_Out_ size_t *_ReturnValue, _Out_writes_z_(_SizeInBytes) char *_Buffer, _In_ size_t _SizeInBytes, _In_ int _Index)
#define _Check_return_wat_
Definition: crtdefs.h:459
__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm, const time_t *_Time)
Definition: time.h:417
__kernel_time_t time_t
Definition: linux.h:252
#define _CRT_INSECURE_DEPRECATE(_Replacement)
Definition: crtdefs.h:211
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
Definition: time.h:418
#define _Out_opt_
Definition: ms_sal.h:346
_CRTIMP char *__cdecl ctime(const time_t *_Time)
Definition: time.h:414
_Check_return_ _CRTIMP clock_t __cdecl clock(void)
Definition: clock.c:23
_In_ size_t _In_ const __time32_t * _Time
Definition: time.h:191
#define _Printf_format_string_
Definition: ms_sal.h:561
int tm_sec
Definition: time.h:69
_CRTIMP __time64_t __cdecl _mktime64(_Inout_ struct tm *_Tm)
_CRTIMP errno_t __cdecl _wstrdate_s(_Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t *_Buf, _In_ size_t _SizeInWords)
unsigned __cdecl _setsystime(_In_ struct tm *_Tm, unsigned _MilliSec)
_CRTDATA(extern int _daylight)
int tm_hour
Definition: time.h:71
#define const
Definition: zconf.h:230
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
Definition: time.h:415
_In_ size_t _SizeInBytes
Definition: time.h:146
_CRTIMP errno_t __cdecl _gmtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
_CRTIMP errno_t __cdecl _get_timezone(_Out_ long *_Timezone)
_CRTIMP time_t __cdecl time(time_t *_Time)
Definition: time.h:420
int tm_isdst
Definition: time.h:77
_CRTIMP double __cdecl _difftime32(_In_ __time32_t _Time1, _In_ __time32_t _Time2)
#define __int64
Definition: basetyps.h:16
__MINGW_EXTENSION typedef __int64 __time64_t
Definition: crtdefs.h:385
_CRTIMP errno_t __cdecl _ctime64_s(_Out_writes_z_(_SizeInBytes) char *_Buf, _In_ size_t _SizeInBytes, _In_ const __time64_t *_Time)
#define _Out_writes_(size)
Definition: ms_sal.h:348
_CRTIMP errno_t __cdecl _wctime32_s(_Out_writes_(_SizeInWords) _Post_readable_size_(26) wchar_t *_Buf, _In_ size_t _SizeInWords, _In_ const __time32_t *_Time)
_CRTIMP double __cdecl difftime(time_t _Time1, time_t _Time2)
Definition: time.h:413