Sync with trunk.
[reactos.git] / include / crt / time.h
index b868ab9..d332eb4 100644 (file)
@@ -3,6 +3,7 @@
  * This file is part of the w64 mingw-runtime package.
  * No warranty is given; refer to the file DISCLAIMER within this package.
  */
+
 #ifndef _TIME_H_
 #define _TIME_H_
 
@@ -92,67 +93,295 @@ extern "C" {
   _CRTDATA(extern long _timezone);
   _CRTDATA(extern char * _tzname[2]);
 
-  _CRTIMP errno_t __cdecl _get_daylight(int *_Daylight);
-  _CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias);
-  _CRTIMP errno_t __cdecl _get_timezone(long *_Timezone);
-  _CRTIMP errno_t __cdecl _get_tzname(size_t *_ReturnValue,char *_Buffer,size_t _SizeInBytes,int _Index);
-
-  _CRTIMP _CRT_INSECURE_DEPRECATE(asctime_s) char *__cdecl asctime(const struct tm *_Tm);
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_ctime32_s) char *__cdecl _ctime32(const __time32_t *_Time);
-  _CRTIMP clock_t __cdecl clock(void);
-  _CRTIMP double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2);
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_gmtime32_s) struct tm *__cdecl _gmtime32(const __time32_t *_Time);
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_localtime32_s) struct tm *__cdecl _localtime32(const __time32_t *_Time);
-  _CRTIMP size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm);
-  _CRTIMP size_t __cdecl _strftime_l(char *_Buf,size_t _Max_size,const char *_Format,const struct tm *_Tm,_locale_t _Locale);
-  _CRTIMP char *__cdecl _strdate(char *_Buffer);
-  _CRTIMP char *__cdecl _strtime(char *_Buffer);
-  _CRTIMP __time32_t __cdecl _time32(__time32_t *_Time);
-  _CRTIMP __time32_t __cdecl _mktime32(struct tm *_Tm);
-  _CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm);
+  _CRTIMP errno_t __cdecl _get_daylight(_Out_ int *_Daylight);
+  _CRTIMP errno_t __cdecl _get_dstbias(_Out_ long *_Daylight_savings_bias);
+  _CRTIMP errno_t __cdecl _get_timezone(_Out_ long *_Timezone);
+
+  _CRTIMP
+  errno_t
+  __cdecl
+  _get_tzname(
+    _Out_ size_t *_ReturnValue,
+    _Out_writes_z_(_SizeInBytes) char *_Buffer,
+    _In_ size_t _SizeInBytes,
+    _In_ int _Index);
+
+  _Check_return_
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(asctime_s)
+  char *
+  __cdecl
+  asctime(
+    _In_ const struct tm *_Tm);
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_ctime32_s)
+  char *
+  __cdecl
+  _ctime32(
+    _In_ const __time32_t *_Time);
+
+  _Check_return_ _CRTIMP clock_t __cdecl clock(void);
+
+  _CRTIMP
+  double
+  __cdecl
+  _difftime32(
+    _In_ __time32_t _Time1,
+    _In_ __time32_t _Time2);
+
+  _Check_return_
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_gmtime32_s)
+  struct tm *
+  __cdecl
+  _gmtime32(
+    _In_ const __time32_t *_Time);
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_localtime32_s)
+  struct tm *
+  __cdecl
+  _localtime32(
+    _In_ const __time32_t *_Time);
+
+  _Success_(return > 0)
+  _CRTIMP
+  size_t
+  __cdecl
+  strftime(
+    _Out_writes_z_(_SizeInBytes) char *_Buf,
+    _In_ size_t _SizeInBytes,
+    _In_z_ _Printf_format_string_ const char *_Format,
+    _In_ const struct tm *_Tm);
+
+  _Success_(return > 0)
+  _CRTIMP
+  size_t
+  __cdecl
+  _strftime_l(
+    _Out_writes_z_(_Max_size) 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);
+
+  _CRTIMP char *__cdecl _strdate(_Out_writes_z_(9) char *_Buffer);
+  _CRTIMP char *__cdecl _strtime(_Out_writes_z_(9) char *_Buffer);
+  _CRTIMP __time32_t __cdecl _time32(_Out_opt_ __time32_t *_Time);
+  _CRTIMP __time32_t __cdecl _mktime32(_Inout_ struct tm *_Tm);
+  _CRTIMP __time32_t __cdecl _mkgmtime32(_Inout_ struct tm *_Tm);
   _CRTIMP void __cdecl _tzset(void);
-  _CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _getsystime(struct tm *_Tm);
-  _CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec);
+  _CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _getsystime(_Out_ struct tm *_Tm);
 
-  _CRTIMP errno_t __cdecl asctime_s(char *_Buf,size_t _SizeInWords,const struct tm *_Tm);
-  _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time);
-  _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time);
-  _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time);
-  _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes);
-  _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes);
+  _CRT_OBSOLETE(GetLocalTime)
+  unsigned
+  __cdecl
+  _setsystime(
+    _In_ struct tm *_Tm,
+    unsigned _MilliSec);
+
+  _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);
+
+  _Success_(return == 0)
+  _CRTIMP
+  errno_t
+  __cdecl
+  _ctime32_s(
+    _Out_writes_(_SizeInBytes) _Post_readable_size_(26) char *_Buf,
+    _In_ size_t _SizeInBytes,
+    _In_ const __time32_t *_Time);
+
+  _Check_return_wat_
+  _CRTIMP
+  errno_t
+  __cdecl
+  _gmtime32_s(
+    _In_ struct tm *_Tm,
+    _In_ const __time32_t *_Time);
+
+  _CRTIMP
+  errno_t
+  __cdecl
+  _localtime32_s(
+    _Out_ struct tm *_Tm,
+    _In_ const __time32_t *_Time);
+
+  _Check_return_wat_
+  _CRTIMP
+  errno_t
+  __cdecl
+  _strdate_s(
+    _Out_writes_(_SizeInBytes) _Post_readable_size_(9) char *_Buf,
+    _In_range_(>= , 9) size_t _SizeInBytes);
+
+  _Check_return_wat_
+  _CRTIMP
+  errno_t
+  __cdecl
+  _strtime_s(
+    _Out_writes_(_SizeInBytes) _Post_readable_size_(9) char *_Buf,
+    _In_range_(>= , 9) size_t _SizeInBytes);
 
 #if _INTEGRAL_MAX_BITS >= 64
-  _CRTIMP double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2);
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_ctime64_s) char *__cdecl _ctime64(const __time64_t *_Time);
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_gmtime64_s) struct tm *__cdecl _gmtime64(const __time64_t *_Time);
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_localtime64_s) struct tm *__cdecl _localtime64(const __time64_t *_Time);
-  _CRTIMP __time64_t __cdecl _mktime64(struct tm *_Tm);
-  _CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *_Tm);
-  _CRTIMP __time64_t __cdecl _time64(__time64_t *_Time);
 
-  _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time);
-  _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time);
-  _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time);
-#endif
+  _Check_return_
+  _CRTIMP
+  double
+  __cdecl
+  _difftime64(
+    _In_ __time64_t _Time1,
+    _In_ __time64_t _Time2);
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_ctime64_s)
+  char *
+  __cdecl
+  _ctime64(
+    _In_ const __time64_t *_Time);
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_gmtime64_s)
+  struct tm *
+  __cdecl
+  _gmtime64(
+    _In_ const __time64_t *_Time);
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_localtime64_s)
+  struct tm *
+  __cdecl
+  _localtime64(
+    _In_ const __time64_t *_Time);
+
+  _CRTIMP __time64_t __cdecl _mktime64(_Inout_ struct tm *_Tm);
+  _CRTIMP __time64_t __cdecl _mkgmtime64(_Inout_ struct tm *_Tm);
+  _CRTIMP __time64_t __cdecl _time64(_Out_opt_ __time64_t *_Time);
+
+  _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
+  _gmtime64_s(
+    _Out_ struct tm *_Tm,
+    _In_ const __time64_t *_Time);
+
+  _CRTIMP
+  errno_t
+  __cdecl
+  _localtime64_s(
+    _Out_ struct tm *_Tm,
+    _In_ const __time64_t *_Time);
+
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
 
 #ifndef _WTIME_DEFINED
 #define _WTIME_DEFINED
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_wasctime_s) wchar_t *__cdecl _wasctime(const struct tm *_Tm);
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_wasctime_s)
+  wchar_t *
+  __cdecl
+  _wasctime(
+    _In_ const struct tm *_Tm);
+
   _CRTIMP wchar_t *__cdecl _wctime(const time_t *_Time);
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_wctime32_s) wchar_t *__cdecl _wctime32(const __time32_t *_Time);
-  _CRTIMP size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm);
-  _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale);
-  _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer);
-  _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer);
-
-  _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm);
-  _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time);
-  _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords);
-  _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords);
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_wctime32_s)
+  wchar_t *
+  __cdecl
+  _wctime32(
+    _In_ const __time32_t *_Time);
+
+  _Success_(return > 0)
+  _CRTIMP
+  size_t
+  __cdecl
+  wcsftime(
+    _Out_writes_z_(_SizeInWords) wchar_t *_Buf,
+    _In_ size_t _SizeInWords,
+    _In_z_ _Printf_format_string_ const wchar_t *_Format,
+    _In_ const struct tm *_Tm);
+
+  _Success_(return > 0)
+  _CRTIMP
+  size_t
+  __cdecl
+  _wcsftime_l(
+    _Out_writes_z_(_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);
+
+  _CRTIMP wchar_t *__cdecl _wstrdate(_Out_writes_z_(9) wchar_t *_Buffer);
+  _CRTIMP wchar_t *__cdecl _wstrtime(_Out_writes_z_(9) wchar_t *_Buffer);
+
+  _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);
+
+  _Success_(return == 0)
+  _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
+  errno_t
+  __cdecl
+  _wstrdate_s(
+    _Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t *_Buf,
+    _In_ size_t _SizeInWords);
+
+  _CRTIMP
+  errno_t
+  __cdecl
+  _wstrtime_s(
+    _Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t *_Buf,
+    _In_range_(>= , 9) size_t _SizeInWords);
+
 #if _INTEGRAL_MAX_BITS >= 64
-  _CRTIMP _CRT_INSECURE_DEPRECATE(_wctime64_s) wchar_t *__cdecl _wctime64(const __time64_t *_Time);
-  _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time);
-#endif
+
+  _CRTIMP
+  _CRT_INSECURE_DEPRECATE(_wctime64_s)
+  wchar_t *
+  __cdecl
+  _wctime64(
+    _In_ const __time64_t *_Time);
+
+  _Success_(return == 0)
+  _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);
+
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
 
 #if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL)
 #define _INC_WTIME_INL
@@ -218,4 +447,3 @@ __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); }
 #pragma pack(pop)
 
 #endif /* End _TIME_H_ */
-