headers/time: Add `__MINGW_STRFTIME_FORMAT` for `strftime()` This is exactly what we have done with `__MINGW_PRINTF_FORMAT` in `stdio.h` for `*printf()` functions. Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h index b2a1631..473597e 100644 --- a/mingw-w64-headers/crt/time.h +++ b/mingw-w64-headers/crt/time.h
@@ -132,6 +132,16 @@ __MINGW_IMPORT char * _tzname[2]; #endif +#undef __MINGW_STRFTIME_FORMAT + +#if defined(__clang__) +#define __MINGW_STRFTIME_FORMAT strftime +#elif defined(_UCRT) +#define __MINGW_STRFTIME_FORMAT gnu_strftime +#else +#define __MINGW_STRFTIME_FORMAT ms_strftime +#endif + _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); @@ -146,7 +156,7 @@ _SECIMP errno_t __cdecl _gmtime32_s (struct tm *_Tm,const __time32_t *_Time); _CRTIMP struct tm *__cdecl _localtime32(const __time32_t *_Time) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; _SECIMP errno_t __cdecl _localtime32_s (struct tm *_Tm,const __time32_t *_Time); - size_t __cdecl strftime(char * __restrict__ _Buf,size_t _SizeInBytes,const char * __restrict__ _Format,const struct tm * __restrict__ _Tm); + size_t __cdecl strftime(char * __restrict__ _Buf,size_t _SizeInBytes,const char * __restrict__ _Format,const struct tm * __restrict__ _Tm) __attribute__((__format__ (__MINGW_STRFTIME_FORMAT, 3, 0))); _CRTIMP size_t __cdecl _strftime_l(char * __restrict__ _Buf,size_t _Max_size,const char * __restrict__ _Format,const struct tm * __restrict__ _Tm,_locale_t _Locale); _CRTIMP char *__cdecl _strdate(char *_Buffer) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; _SECIMP errno_t __cdecl _strdate_s (char *_Buf,size_t _SizeInBytes);