1 // 2 // corecrt_wtime.h 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // This file declares the wide character (wchar_t) time functionality, shared 7 // by <time.h> and <wchar.h>. 8 // 9 #pragma once 10 11 #include <corecrt.h> 12 13 #pragma warning(push) 14 #pragma warning(disable: _UCRT_DISABLED_WARNINGS) 15 _UCRT_DISABLE_CLANG_WARNINGS 16 17 _CRT_BEGIN_C_HEADER 18 19 20 21 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 22 // 23 // Types 24 // 25 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 26 struct tm 27 { 28 int tm_sec; // seconds after the minute - [0, 60] including leap second 29 int tm_min; // minutes after the hour - [0, 59] 30 int tm_hour; // hours since midnight - [0, 23] 31 int tm_mday; // day of the month - [1, 31] 32 int tm_mon; // months since January - [0, 11] 33 int tm_year; // years since 1900 34 int tm_wday; // days since Sunday - [0, 6] 35 int tm_yday; // days since January 1 - [0, 365] 36 int tm_isdst; // daylight savings time flag 37 }; 38 39 40 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 41 // 42 // Wide String Time Functions 43 // 44 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 45 _Check_return_ _CRT_INSECURE_DEPRECATE(_wasctime_s) 46 _Success_(return != 0) 47 _Ret_writes_z_(26) 48 _ACRTIMP wchar_t* __cdecl _wasctime( 49 _In_ struct tm const* _Tm 50 ); 51 52 _Success_(return == 0) 53 _Check_return_wat_ 54 _ACRTIMP errno_t __cdecl _wasctime_s( 55 _Out_writes_z_(_SizeInWords) _Post_readable_size_(26) wchar_t* _Buffer, 56 _In_range_(>=,26) size_t _SizeInWords, 57 _In_ struct tm const* _Tm 58 ); 59 60 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1( 61 _Success_(return == 0) 62 errno_t, _wasctime_s, 63 _Post_readable_size_(26) wchar_t, _Buffer, 64 _In_ struct tm const*, _Time 65 ) 66 67 _Success_(return > 0) 68 _Check_return_wat_ 69 _ACRTIMP size_t __cdecl wcsftime( 70 _Out_writes_z_(_SizeInWords) wchar_t* _Buffer, 71 _In_ size_t _SizeInWords, 72 _In_z_ wchar_t const* _Format, 73 _In_ struct tm const* _Tm 74 ); 75 76 _Success_(return > 0) 77 _Check_return_wat_ 78 _ACRTIMP size_t __cdecl _wcsftime_l( 79 _Out_writes_z_(_SizeInWords) wchar_t* _Buffer, 80 _In_ size_t _SizeInWords, 81 _In_z_ wchar_t const* _Format, 82 _In_ struct tm const* _Tm, 83 _In_opt_ _locale_t _Locale 84 ); 85 86 _Success_(return != 0) 87 _Check_return_ _CRT_INSECURE_DEPRECATE(_wctime32_s) 88 _ACRTIMP wchar_t* __cdecl _wctime32( 89 _In_ __time32_t const* _Time 90 ); 91 92 _Check_return_wat_ 93 _ACRTIMP errno_t __cdecl _wctime32_s( 94 _Out_writes_z_(_SizeInWords) _Post_readable_size_(26) wchar_t* _Buffer, 95 _In_ _In_range_(>=, 26) size_t _SizeInWords, 96 _In_ __time32_t const* _Time 97 ); 98 99 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1( 100 errno_t, _wctime32_s, 101 _Post_readable_size_(26) wchar_t, _Buffer, 102 _In_ __time32_t const*, _Time 103 ) 104 105 _Success_(return != 0) 106 _Ret_writes_z_(26) 107 _Check_return_ _CRT_INSECURE_DEPRECATE(_wctime64_s) 108 _ACRTIMP wchar_t* __cdecl _wctime64( 109 _In_ __time64_t const* _Time 110 ); 111 112 _Check_return_wat_ 113 _ACRTIMP errno_t __cdecl _wctime64_s( 114 _Out_writes_z_(_SizeInWords) _Post_readable_size_(26) wchar_t* _Buffer, 115 _In_ _In_range_(>=, 26) size_t _SizeInWords, 116 _In_ __time64_t const* _Time); 117 118 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1( 119 errno_t, _wctime64_s, 120 _Post_readable_size_(26) wchar_t, _Buffer, 121 _In_ __time64_t const*, _Time 122 ) 123 124 _Check_return_wat_ 125 _ACRTIMP errno_t __cdecl _wstrdate_s( 126 _Out_writes_z_(_SizeInWords) _When_(_SizeInWords >=9, _Post_readable_size_(9)) wchar_t* _Buffer, 127 _In_ size_t _SizeInWords 128 ); 129 130 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0( 131 errno_t, _wstrdate_s, 132 _Post_readable_size_(9) wchar_t, _Buffer 133 ) 134 135 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0( 136 _Success_(return != 0) _Ret_writes_z_(9) wchar_t*, __RETURN_POLICY_DST, _ACRTIMP, _wstrdate, 137 _Out_writes_z_(9), wchar_t, _Buffer 138 ) 139 140 _Check_return_wat_ 141 _ACRTIMP errno_t __cdecl _wstrtime_s( 142 _Out_writes_z_(_SizeInWords) _When_(_SizeInWords >=9, _Post_readable_size_(9)) wchar_t* _Buffer, 143 _In_ size_t _SizeInWords 144 ); 145 146 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0( 147 errno_t, _wstrtime_s, 148 _Post_readable_size_(9) wchar_t, _Buffer 149 ) 150 151 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0( 152 _Success_(return != 0) _Ret_writes_z_(9) wchar_t*, __RETURN_POLICY_DST, _ACRTIMP, _wstrtime, 153 _Out_writes_z_(9), wchar_t, _Buffer 154 ) 155 156 157 158 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 159 // 160 // Inline Definitions 161 // 162 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 163 #if !defined RC_INVOKED && !defined __midl && !defined _INC_WTIME_INL && !defined _CRT_NO_TIME_T 164 #ifdef _USE_32BIT_TIME_T 165 166 _Check_return_ 167 static __inline wchar_t* __CRTDECL _wctime( 168 _In_ time_t const* const _Time 169 ) 170 { 171 return _wctime32(_Time); 172 } 173 174 _Check_return_wat_ 175 static __inline errno_t __CRTDECL _wctime_s( 176 _Pre_notnull_ _Post_z_ _Out_writes_z_(_SizeInWords) wchar_t* const _Buffer, 177 _In_ size_t const _SizeInWords, 178 _In_ time_t const* const _Time) 179 { 180 return _wctime32_s(_Buffer, _SizeInWords, _Time); 181 } 182 183 #else // ^^^ _USE_32BIT_TIME_T ^^^ // vvv !_USE_32BIT_TIME_T vvv // 184 185 _Check_return_ 186 static __inline wchar_t * __CRTDECL _wctime( 187 _In_ time_t const* const _Time) 188 { 189 return _wctime64(_Time); 190 } 191 192 _Check_return_wat_ 193 static __inline errno_t __CRTDECL _wctime_s( 194 _Pre_notnull_ _Post_z_ _Out_writes_z_(_SizeInWords) wchar_t* const _Buffer, 195 _In_ size_t const _SizeInWords, 196 _In_ time_t const* const _Time 197 ) 198 { 199 return _wctime64_s(_Buffer, _SizeInWords, _Time); 200 } 201 202 #endif // !_USE_32BIT_TIME_T 203 #endif 204 205 _CRT_END_C_HEADER 206 _UCRT_RESTORE_CLANG_WARNINGS 207 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS 208