ReactOS  0.4.14-dev-41-g31d7680
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 NULL
67 #ifdef __cplusplus
68 #define NULL 0
69 #else
70 #define NULL ((void *)0)
71 #endif
72 #endif
73 
74 #ifndef _TM_DEFINED
75 #define _TM_DEFINED
76  struct tm {
77  int tm_sec;
78  int tm_min;
79  int tm_hour;
80  int tm_mday;
81  int tm_mon;
82  int tm_year;
83  int tm_wday;
84  int tm_yday;
85  int tm_isdst;
86  };
87 #endif
88 
89 #define CLOCKS_PER_SEC 1000
90 
91  _CRTDATA(extern int _daylight);
92  _CRTDATA(extern long _dstbias);
93  _CRTDATA(extern long _timezone);
94  _CRTDATA(extern char * _tzname[2]);
95 
96  _CRTIMP errno_t __cdecl _get_daylight(_Out_ int *_Daylight);
97  _CRTIMP errno_t __cdecl _get_dstbias(_Out_ long *_Daylight_savings_bias);
98  _CRTIMP errno_t __cdecl _get_timezone(_Out_ long *_Timezone);
99 
100  _CRTIMP
101  errno_t
102  __cdecl
103  _get_tzname(
104  _Out_ size_t *_ReturnValue,
105  _Out_writes_z_(_SizeInBytes) char *_Buffer,
106  _In_ size_t _SizeInBytes,
107  _In_ int _Index);
108 
110  _CRTIMP
112  char *
113  __cdecl
114  asctime(
115  _In_ const struct tm *_Tm);
116 
117  _CRTIMP
118  _CRT_INSECURE_DEPRECATE(_ctime32_s)
119  char *
120  __cdecl
121  _ctime32(
122  _In_ const __time32_t *_Time);
123 
125 
126  _CRTIMP
127  double
128  __cdecl
129  _difftime32(
130  _In_ __time32_t _Time1,
131  _In_ __time32_t _Time2);
132 
134  _CRTIMP
136  struct tm *
137  __cdecl
138  _gmtime32(
139  _In_ const __time32_t *_Time);
140 
141  _CRTIMP
143  struct tm *
144  __cdecl
145  _localtime32(
146  _In_ const __time32_t *_Time);
147 
148  _Success_(return > 0)
149  _CRTIMP
150  size_t
151  __cdecl
152  strftime(
153  _Out_writes_z_(_SizeInBytes) char *_Buf,
157 
158  _Success_(return > 0)
159  _CRTIMP
160  size_t
161  __cdecl
162  _strftime_l(
163  _Out_writes_z_(_Max_size) char *_Buf,
164  _In_ size_t _Max_size,
168 
169  _CRTIMP char *__cdecl _strdate(_Out_writes_z_(9) char *_Buffer);
170  _CRTIMP char *__cdecl _strtime(_Out_writes_z_(9) char *_Buffer);
174  _CRTIMP void __cdecl _tzset(void);
176 
178  unsigned
179  __cdecl
180  _setsystime(
181  _In_ struct tm *_Tm,
182  unsigned _MilliSec);
183 
185  _CRTIMP
186  errno_t
187  __cdecl
188  asctime_s(
190  _In_range_(>= , 26) size_t _SizeInBytes,
191  _In_ const struct tm *_Tm);
192 
193  _Success_(return == 0)
194  _CRTIMP
195  errno_t
196  __cdecl
197  _ctime32_s(
201 
203  _CRTIMP
204  errno_t
205  __cdecl
206  _gmtime32_s(
207  _In_ struct tm *_Tm,
209 
210  _CRTIMP
211  errno_t
212  __cdecl
214  _Out_ struct tm *_Tm,
216 
218  _CRTIMP
219  errno_t
220  __cdecl
221  _strdate_s(
223  _In_range_(>= , 9) size_t _SizeInBytes);
224 
226  _CRTIMP
227  errno_t
228  __cdecl
229  _strtime_s(
231  _In_range_(>= , 9) size_t _SizeInBytes);
232 
233 #if _INTEGRAL_MAX_BITS >= 64
234 
236  _CRTIMP
237  double
238  __cdecl
239  _difftime64(
240  _In_ __time64_t _Time1,
241  _In_ __time64_t _Time2);
242 
243  _CRTIMP
245  char *
246  __cdecl
247  _ctime64(
248  _In_ const __time64_t *_Time);
249 
250  _CRTIMP
252  struct tm *
253  __cdecl
254  _gmtime64(
255  _In_ const __time64_t *_Time);
256 
257  _CRTIMP
259  struct tm *
260  __cdecl
261  _localtime64(
262  _In_ const __time64_t *_Time);
263 
267 
268  _CRTIMP
269  errno_t
270  __cdecl
271  _ctime64_s(
272  _Out_writes_z_(_SizeInBytes) char *_Buf,
273  _In_ size_t _SizeInBytes,
274  _In_ const __time64_t *_Time);
275 
276  _CRTIMP
277  errno_t
278  __cdecl
279  _gmtime64_s(
280  _Out_ struct tm *_Tm,
281  _In_ const __time64_t *_Time);
282 
283  _CRTIMP
284  errno_t
285  __cdecl
287  _Out_ struct tm *_Tm,
288  _In_ const __time64_t *_Time);
289 
290 #endif /* _INTEGRAL_MAX_BITS >= 64 */
291 
292 #ifndef _WTIME_DEFINED
293 #define _WTIME_DEFINED
294 
295  _CRTIMP
297  wchar_t *
298  __cdecl
299  _wasctime(
300  _In_ const struct tm *_Tm);
301 
302  _CRTIMP wchar_t *__cdecl _wctime(const time_t *_Time);
303 
304  _CRTIMP
306  wchar_t *
307  __cdecl
308  _wctime32(
309  _In_ const __time32_t *_Time);
310 
311  _Success_(return > 0)
312  _CRTIMP
313  size_t
314  __cdecl
315  wcsftime(
316  _Out_writes_z_(_SizeInWords) wchar_t *_Buf,
319  _In_ const struct tm *_Tm);
320 
321  _Success_(return > 0)
322  _CRTIMP
323  size_t
324  __cdecl
325  _wcsftime_l(
326  _Out_writes_z_(_SizeInWords) wchar_t *_Buf,
327  _In_ size_t _SizeInWords,
331 
332  _CRTIMP wchar_t *__cdecl _wstrdate(_Out_writes_z_(9) wchar_t *_Buffer);
333  _CRTIMP wchar_t *__cdecl _wstrtime(_Out_writes_z_(9) wchar_t *_Buffer);
334 
335  _CRTIMP
336  errno_t
337  __cdecl
338  _wasctime_s(
340  _In_range_(>= , 26) size_t _SizeInWords,
341  _In_ const struct tm *_Tm);
342 
343  _Success_(return == 0)
344  _CRTIMP
345  errno_t
346  __cdecl
347  _wctime32_s(
349  _In_ size_t _SizeInWords,
351 
352  _CRTIMP
353  errno_t
354  __cdecl
355  _wstrdate_s(
357  _In_ size_t _SizeInWords);
358 
359  _CRTIMP
360  errno_t
361  __cdecl
362  _wstrtime_s(
364  _In_range_(>= , 9) size_t _SizeInWords);
365 
366 #if _INTEGRAL_MAX_BITS >= 64
367 
368  _CRTIMP
370  wchar_t *
371  __cdecl
372  _wctime64(
373  _In_ const __time64_t *_Time);
374 
375  _Success_(return == 0)
376  _CRTIMP
377  errno_t
378  __cdecl
379  _wctime64_s(
381  _In_ size_t _SizeInWords,
383 
384 #endif /* _INTEGRAL_MAX_BITS >= 64 */
385 
386 #if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL)
387 #define _INC_WTIME_INL
388 #ifdef _USE_32BIT_TIME_T
389 /* Do it like this to be compatible to msvcrt.dll on 32 bit windows XP and before */
390 __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); }
391 #else
392 __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
393 #endif
394 #endif
395 
396 #endif /* !_WTIME_DEFINED */
397 
398  _CRTIMP double __cdecl difftime(time_t _Time1,time_t _Time2);
399  _CRTIMP char *__cdecl ctime(const time_t *_Time);
400  _CRTIMP struct tm *__cdecl gmtime(const time_t *_Time);
401  _CRTIMP struct tm *__cdecl localtime(const time_t *_Time);
402  _CRTIMP struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *);
403 
404  _CRTIMP time_t __cdecl mktime(struct tm *_Tm);
407 
408 #if !defined(RC_INVOKED) && !defined(_NO_INLINING) && !defined(_CRTBLD)
409 #ifdef _USE_32BIT_TIME_T
410 #if 0
411 __CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); }
412 __CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); }
413 __CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); }
414 __CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); }
415 __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); }
416 __CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); }
417 __CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); }
418 __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); }
419 #endif
420 #else
421 __CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); }
422 __CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); }
423 __CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); }
424 __CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); }
425 __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); }
426 __CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); }
427 __CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); }
428 __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); }
429 #endif
430 #endif
431 
432 #if !defined(NO_OLDNAMES) || defined(_POSIX)
433 #define CLK_TCK CLOCKS_PER_SEC
434 
435  _CRTIMP extern int daylight;
436  _CRTIMP extern long timezone;
437  _CRTIMP extern char *tzname[2];
438  _CRTIMP void __cdecl tzset(void);
439 #endif
440 
441 #ifdef __cplusplus
442 }
443 #endif
444 
445 #pragma pack(pop)
446 
447 #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:78
_CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _getsystime(_Out_ struct tm *_Tm)
#define __cdecl
Definition: accygwin.h:79
_CRTIMP wchar_t *__cdecl _wctime(const time_t *_Time)
Definition: time.h:392
_CRTIMP void __cdecl _tzset(void)
Definition: timezone.c:92
#define _CRTIMP
Definition: crtdefs.h:60
_In_ size_t _Max_size
Definition: time.h:164
_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:80
_CRTIMP errno_t __cdecl _localtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
long __time32_t
Definition: crtdefs.h:358
#define _Post_readable_size_(size)
Definition: no_sal2.h:464
#define _Check_return_
Definition: no_sal2.h:13
int tm_year
Definition: time.h:82
_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)
#define __attribute__(Spec)
Definition: hlsl.tab.c:1213
_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)
#define _In_opt_
Definition: no_sal2.h:213
#define _Out_writes_z_(size)
Definition: no_sal2.h:384
_CRTIMP char *__cdecl _ctime64(_In_ const __time64_t *_Time)
_CRTIMP wchar_t *__cdecl _wctime64(_In_ const __time64_t *_Time)
#define _Out_writes_(size)
Definition: no_sal2.h:367
unsigned int _getsystime(struct tm *tp)
Definition: systime.c:18
_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:154
#define __MINGW_EXTENSION
Definition: _mingw.h:164
#define _Out_
Definition: no_sal2.h:323
_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)
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
int tm_mon
Definition: time.h:81
_CRTIMP wchar_t *__cdecl _wctime32(_In_ const __time32_t *_Time)
int errno_t
Definition: crtdefs.h:353
_CRTIMP time_t __cdecl _mkgmtime(struct tm *_Tm)
Definition: time.h:427
_In_ size_t _SizeInWords
Definition: time.h:317
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
#define _Out_opt_
Definition: no_sal2.h:339
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:156
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm _In_opt_ _locale_t _Locale
Definition: time.h:166
_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]
#define _Inout_
Definition: no_sal2.h:244
_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
_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:76
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:424
GLenum mode
Definition: glext.h:6217
_CRTIMP char *__cdecl _ctime32(_In_ const __time32_t *_Time)
int tm_wday
Definition: time.h:83
_CRTIMP errno_t __cdecl _localtime32_s(_Out_ struct tm *_Tm, _In_ const __time32_t *_Time)
long _timezone
Definition: timezone.c:46
_CRTIMP int daylight
#define _In_
Definition: no_sal2.h:204
int tm_yday
Definition: time.h:84
_Check_return_ _CRTIMP struct tm *__cdecl _gmtime32(_In_ const __time32_t *_Time)
_CRTIMP wchar_t *__cdecl _wstrdate(_Out_writes_z_(9) wchar_t *_Buffer)
#define _Check_return_wat_
Definition: specstrings.h:74
_CRTIMP struct tm *__cdecl _gmtime64(_In_ const __time64_t *_Time)
_CRTIMP errno_t __cdecl _get_tzname(_Out_ size_t *_ReturnValue, _Out_writes_z_(_SizeInBytes) char *_Buffer, _In_ size_t _SizeInBytes, _In_ int _Index)
__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm, const time_t *_Time)
Definition: time.h:425
__kernel_time_t time_t
Definition: linux.h:252
#define _In_z_
Definition: no_sal2.h:239
#define _CRT_INSECURE_DEPRECATE(_Replacement)
Definition: crtdefs.h:190
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
Definition: time.h:426
_CRTIMP char *__cdecl ctime(const time_t *_Time)
Definition: time.h:422
_Check_return_ _CRTIMP clock_t __cdecl clock(void)
Definition: clock.c:23
_In_ size_t _In_ const __time32_t * _Time
Definition: time.h:199
int tm_sec
Definition: time.h:77
_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:79
#define const
Definition: zconf.h:230
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
Definition: time.h:423
_In_ size_t _SizeInBytes
Definition: time.h:154
_CRTIMP errno_t __cdecl _gmtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
#define _In_range_(lb, ub)
Definition: no_sal2.h:227
_CRTIMP errno_t __cdecl _get_timezone(_Out_ long *_Timezone)
_CRTIMP time_t __cdecl time(time_t *_Time)
Definition: time.h:428
int tm_isdst
Definition: time.h:85
#define _Printf_format_string_
Definition: no_sal2.h:569
_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:364
_CRTIMP errno_t __cdecl _ctime64_s(_Out_writes_z_(_SizeInBytes) char *_Buf, _In_ size_t _SizeInBytes, _In_ const __time64_t *_Time)
_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:421