1 /***
2 *time.h - definitions/declarations for time routines
3 *
4 *           Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 *           This file has declarations of time routines and defines
8 *           the structure returned by the localtime and gmtime routines and
9 *           used by asctime.
10 *           [ANSI/System V]
11 *
12 *           [Public]
13 *
14 ****/
15
16 #if        _MSC_VER > 1000
17 #pragma once
18 #endif
19
20 #ifndef _INC_TIME
21 #define _INC_TIME
22
23 #include <crtdefs.h>
24
25 #if        !defined(_WIN32)
26 #error ERROR: Only Win32 target supported!
27 #endif
28
29
30 #ifdef  _MSC_VER
31 /*
32  * Currently, all MS C compilers for Win32 platforms default to 8 byte
33  * alignment.
34  */
35 #pragma pack(push,_CRT_PACKING)
36 #endif  /* _MSC_VER */
37
38 #ifdef  __cplusplus
39 extern "C" {
40 #endif
41
42
43 #if !defined(_W64)
44 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
45 #define _W64 __w64
46 #else
47 #define _W64
48 #endif
49 #endif
50
51 /* Define _CRTIMP */
52
53 #ifndef _CRTIMP
54 #ifdef  _DLL
55 #define _CRTIMP __declspec(dllimport)
56 #else     /* ndef _DLL */
57 #define _CRTIMP
58 #endif  /* _DLL */
59 #endif  /* _CRTIMP */
60
61
62 /* Define __cdecl for non-Microsoft compilers */
63
64 #if        ( !defined(_MSC_VER) && !defined(__cdecl) )
65 #define __cdecl
66 #endif
67
68 #ifndef _WCHAR_T_DEFINED
69 typedef unsigned short wchar_t;
70 #define _WCHAR_T_DEFINED
71 #endif
72
73 #ifndef _TIME32_T_DEFINED
74 typedef _W64 long __time32_t;     /* 32-bit time value */
75 #define _TIME32_T_DEFINED
76 #endif
77
78 #ifndef _TIME64_T_DEFINED
79 typedef __int64 __time64_t;        /* 64-bit time value */
80 #define _TIME64_T_DEFINED
81 #endif
82
83 #ifndef _TIME_T_DEFINED
84 #ifdef _USE_32BIT_TIME_T
85 typedef __time32_t time_t;          /* time value */
86 #else
87 typedef __time64_t time_t;          /* time value */
88 #endif
89 #define _TIME_T_DEFINED               /* avoid multiple def's of time_t */
90 #endif
91
92 #ifndef _CLOCK_T_DEFINED
93 typedef long clock_t;
94 #define _CLOCK_T_DEFINED
95 #endif
96
97 #ifndef _SIZE_T_DEFINED
98 #ifdef  _WIN64
99 typedef unsigned __int64      size_t;
100 #else
101 typedef _W64 unsigned int     size_t;
102 #endif
103 #define _SIZE_T_DEFINED
104 #endif
105
106 /* Define NULL pointer value */
107 #ifndef NULL
108 #ifdef __cplusplus
109 #define NULL      0
110 #else
111 #define NULL      ((void *)0)
112 #endif
113 #endif
114
115
116 #ifndef _TM_DEFINED
117 struct tm {
118              int tm_sec;        /* seconds after the minute - [0,59] */
119              int tm_min;        /* minutes after the hour - [0,59] */
120              int tm_hour;      /* hours since midnight - [0,23] */
121              int tm_mday;      /* day of the month - [1,31] */
122              int tm_mon;        /* months since January - [0,11] */
123              int tm_year;      /* years since 1900 */
124              int tm_wday;      /* days since Sunday - [0,6] */
125              int tm_yday;      /* days since January 1 - [0,365] */
126              int tm_isdst;     /* daylight savings time flag */
127              };
128 #define _TM_DEFINED
129 #endif
130
131
132 /* Clock ticks macro - ANSI version */
133
134 #define CLOCKS_PER_SEC  1000
135
136
137 /* Extern declarations for the global variables used by the ctime family of
138  * routines.
139  */
140
141 /* non-zero if daylight savings time is used */
Lines 142 ... 151 are skipped.
152
153 /* standard/daylight savings time zone names */
154 _Check_return_ _Deref_ret_z_ _CRT_INSECURE_DEPRECATE_GLOBALS(_get_tzname) _CRTIMP char ** __cdecl __tzname(void);
155 #define _tzname (__tzname())
156
157 _CRTIMP errno_t __cdecl _get_daylight(_Out_ int * _Daylight);
158 _CRTIMP errno_t __cdecl _get_dstbias(_Out_ long * _Daylight_savings_bias);
159 _CRTIMP errno_t __cdecl _get_timezone(_Out_ long * _Timezone);
160 _CRTIMP errno_t __cdecl _get_tzname(_Out_ size_t *_ReturnValue, _Out_z_cap_(_SizeInBytes) char *_Buffer, _In_ size_t _SizeInBytes, _In_ int _Index);
161
162
163 /* Function prototypes */
164 _Check_return_ _CRT_INSECURE_DEPRECATE(asctime_s) _CRTIMP char * __cdecl asctime(_In_ const struct tm * _Tm);
165 #if __STDC_WANT_SECURE_LIB__
166 _Check_return_wat_ _CRTIMP errno_t __cdecl asctime_s(_Out_cap_(_SizeInBytes) _Post_count_c_(26) char *_Buf, _In_ size_t _SizeInBytes, _In_ const struct tm * _Tm);
167 #endif
168 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, asctime_s, _Deref_post_count_c_(26) char, _Buffer, _In_ const struct tm *, _Time)
169
170 _CRT_INSECURE_DEPRECATE(_ctime32_s) _CRTIMP char * __cdecl _ctime32(_In_ const __time32_t * _Time);
171 _CRTIMP errno_t __cdecl _ctime32_s(_Out_cap_(_SizeInBytes) _Post_count_c_(26) char *_Buf, _In_ size_t _SizeInBytes, _In_ const __time32_t *_Time);
172 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _ctime32_s, _Deref_post_count_c_(26) char, _Buffer, _In_ const __time32_t *, _Time)
173
174 _Check_return_ _CRTIMP clock_t __cdecl clock(void);
175 _CRTIMP double __cdecl _difftime32(_In_ __time32_t _Time1, _In_ __time32_t _Time2);
176
177 _Check_return_ _CRT_INSECURE_DEPRECATE(_gmtime32_s) _CRTIMP struct tm * __cdecl _gmtime32(_In_ const __time32_t * _Time);
178 _Check_return_wat_ _CRTIMP errno_t __cdecl _gmtime32_s(_In_ struct tm *_Tm, _In_ const __time32_t * _Time);
179
180 _CRT_INSECURE_DEPRECATE(_localtime32_s) _CRTIMP struct tm * __cdecl _localtime32(_In_ const __time32_t * _Time);
181 _CRTIMP errno_t __cdecl _localtime32_s(_Out_ struct tm *_Tm, _In_ const __time32_t * _Time);
182
183 _CRTIMP size_t __cdecl strftime(_Out_z_cap_(_SizeInBytes) char * _Buf, _In_ size_t _SizeInBytes, _In_z_ _Printf_format_string_ const char * _Format, _In_ const struct tm * _Tm);
184 _CRTIMP size_t __cdecl _strftime_l(_Pre_notnull_ _Post_z_ char *_Buf, _In_ size_t _Max_size, _In_z_ _Printf_format_string_ const char * _Format, _In_ const struct tm *_Tm, _In_opt_ _locale_t _Locale);
185
186 _Check_return_wat_ _CRTIMP errno_t __cdecl _strdate_s(_Out_cap_(_SizeInBytes) _Post_count_c_(9) char *_Buf, _In_ size_t _SizeInBytes);
187 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _strdate_s, _Deref_post_count_c_(9) char, _Buffer)
188 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(char *, __RETURN_POLICY_DST, _CRTIMP, _strdate, _Out_z_cap_c_(9), char, _Buffer)
189
190 _Check_return_wat_ _CRTIMP errno_t __cdecl _strtime_s(_Out_cap_(_SizeInBytes) _Post_count_c_(9) char *_Buf , _In_ size_t _SizeInBytes);
191 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _strtime_s, _Deref_post_count_c_(9) char, _Buffer)
192 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(char *, __RETURN_POLICY_DST, _CRTIMP, _strtime, _Out_z_cap_c_(9), char, _Buffer)
193
194 _CRTIMP __time32_t __cdecl _time32(_Out_opt_ __time32_t * _Time);
195 _CRTIMP __time32_t __cdecl _mktime32(_Inout_ struct tm * _Tm);
196 _CRTIMP __time32_t __cdecl _mkgmtime32(_Inout_ struct tm * _Tm);
197
198 #ifdef  _POSIX_
199 _CRTIMP void __cdecl tzset(void);
200 #else
201 _CRTIMP void __cdecl _tzset(void);
202 #endif
203
204 _Check_return_ _CRTIMP double __cdecl _difftime64(_In_ __time64_t _Time1, _In_ __time64_t _Time2);
205 _CRT_INSECURE_DEPRECATE(_ctime64_s) _CRTIMP char * __cdecl _ctime64(_In_ const __time64_t * _Time);
206 _CRTIMP errno_t __cdecl _ctime64_s(_Out_z_cap_(_SizeInBytes) char *_Buf, _In_ size_t _SizeInBytes, _In_ const __time64_t * _Time);
207 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _ctime64_s, char, _Buffer, _In_ const __time64_t *, _Time)
208
209 _CRT_INSECURE_DEPRECATE(_gmtime64_s) _CRTIMP struct tm * __cdecl _gmtime64(_In_ const __time64_t * _Time);
210 _CRTIMP errno_t __cdecl _gmtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time);
211
212 _CRT_INSECURE_DEPRECATE(_localtime64_s) _CRTIMP struct tm * __cdecl _localtime64(_In_ const __time64_t * _Time);
213 _CRTIMP errno_t __cdecl _localtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time);
214
215 _CRTIMP __time64_t __cdecl _mktime64(_Inout_ struct tm * _Tm);
216 _CRTIMP __time64_t __cdecl _mkgmtime64(_Inout_ struct tm * _Tm);
217 _CRTIMP __time64_t __cdecl _time64(_Out_opt_ __time64_t * _Time);
218
219 /* The Win32 API GetLocalTime and SetLocalTime should be used instead. */
220 _CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _getsystime(_Out_ struct tm * _Tm);
221 _CRT_OBSOLETE(SetLocalTime) unsigned __cdecl _setsystime(_In_ struct tm * _Tm, unsigned _MilliSec);
222
223
224 #ifndef _SIZE_T_DEFINED
225 typedef unsigned int size_t;
226 #define _SIZE_T_DEFINED
227 #endif
228
229 #ifndef _WTIME_DEFINED
230
231 /* wide function prototypes, also declared in wchar.h */
232  
233 _CRT_INSECURE_DEPRECATE(_wasctime_s) _CRTIMP wchar_t * __cdecl _wasctime(_In_ const struct tm * _Tm);
234 _CRTIMP errno_t __cdecl _wasctime_s(_Out_cap_(_SizeInWords) _Post_count_c_(26) wchar_t *_Buf, _In_ size_t _SizeInWords, _In_ const struct tm * _Tm);
235 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _wasctime_s, _Deref_post_count_c_(26) wchar_t, _Buffer, _In_ const struct tm *, _Time)
236
237 _CRT_INSECURE_DEPRECATE(_wctime32_s) _CRTIMP wchar_t * __cdecl _wctime32(_In_ const __time32_t *_Time);
238 _CRTIMP errno_t __cdecl _wctime32_s(_Out_cap_(_SizeInWords) _Post_count_c_(26) wchar_t* _Buf, _In_ size_t _SizeInWords, _In_ const __time32_t * _Time);
239 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _wctime32_s, _Deref_post_count_c_(26) wchar_t, _Buffer, _In_ const __time32_t *, _Time)
240
241 _CRTIMP size_t __cdecl wcsftime(_Out_z_cap_(_SizeInWords) wchar_t * _Buf, _In_ size_t _SizeInWords, _In_z_ _Printf_format_string_ const wchar_t * _Format,  _In_ const struct tm * _Tm);
242 _CRTIMP size_t __cdecl _wcsftime_l(_Out_z_cap_(_SizeInWords) wchar_t * _Buf, _In_ size_t _SizeInWords, _In_z_ _Printf_format_string_ const wchar_t *_Format, _In_ const struct tm *_Tm, _In_opt_ _locale_t _Locale);
243
244 _CRTIMP errno_t __cdecl _wstrdate_s(_Out_cap_(_SizeInWords) _Post_count_c_(9) wchar_t * _Buf, _In_ size_t _SizeInWords);
245 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _wstrdate_s, _Deref_post_count_c_(9) wchar_t, _Buffer)
246 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wstrdate, _Out_z_cap_c_(9), wchar_t, _Buffer)
247
248 _CRTIMP errno_t __cdecl _wstrtime_s(_Out_cap_(_SizeInWords) _Post_count_c_(9) wchar_t * _Buf, _In_ size_t _SizeInWords);
249 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _wstrtime_s, _Deref_post_count_c_(9) wchar_t, _Buffer)
250 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wstrtime, _Out_z_cap_c_(9), wchar_t, _Buffer)
251
252 _CRT_INSECURE_DEPRECATE(_wctime64_s) _CRTIMP wchar_t * __cdecl _wctime64(_In_ const __time64_t * _Time);
253 _CRTIMP errno_t __cdecl _wctime64_s(_Out_cap_(_SizeInWords) _Post_count_c_(26) wchar_t* _Buf, _In_ size_t _SizeInWords, _In_ const __time64_t *_Time);
254 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _wctime64_s, _Deref_post_count_c_(26) wchar_t, _Buffer, _In_ const __time64_t *, _Time)
255
256 #if !defined(RC_INVOKED) && !defined(__midl)
257 #include <wtime.inl>
258 #endif
259
260 #define _WTIME_DEFINED
261 #endif
262
263 #if !defined(RC_INVOKED) && !defined(__midl)
264 #include <time.inl>
265 #endif
266
267 #if        !__STDC__ || defined(_POSIX_)
268
269 /* Non-ANSI names for compatibility */
270
271 #define CLK_TCK  CLOCKS_PER_SEC
272
273 /*
274 daylight, timezone, and tzname are not available under /clr:pure.
275 Please use _daylight, _timezone, and _tzname or 
276 _get_daylight, _get_timezone, and _get_tzname instead.
277 */
278 #if !defined(_M_CEE_PURE)
279 _CRT_INSECURE_DEPRECATE_GLOBALS(_get_daylight) _CRTIMP extern int daylight;
280 _CRT_INSECURE_DEPRECATE_GLOBALS(_get_timezone) _CRTIMP extern long timezone;
281 _CRT_INSECURE_DEPRECATE_GLOBALS(_get_tzname) _CRTIMP extern char * tzname[2];
282 #endif /* !defined(_M_CEE_PURE) */
283
284 _CRT_NONSTDC_DEPRECATE(_tzset) _CRTIMP void __cdecl tzset(void);
285
286 #endif  /* __STDC__ */
287
288
289 #ifdef  __cplusplus
290 }
291 #endif
292
293 #ifdef  _MSC_VER
294 #pragma pack(pop)
295 #endif  /* _MSC_VER */
296
297 #endif  /* _INC_TIME */
298