Function _get_tzname() is available in msvcr80+ and UCRT. --- mingw-w64-crt/Makefile.am | 2 ++ mingw-w64-crt/misc/_get_tzname.c | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 mingw-w64-crt/misc/_get_tzname.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 52bb63de8bce..66d02c47bbd5 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -335,6 +335,7 @@ src_msvcrt=\ misc/_get_daylight.c \ misc/_get_dstbias.c \ misc/_get_timezone.c \ + misc/_get_tzname.c \ misc/_recalloc.c \ misc/_set_purecall_handler.c \ misc/imaxdiv.c \ @@ -884,6 +885,7 @@ src_pre_msvcr80=\ misc/_get_dstbias.c \ misc/_get_errno.c \ misc/_get_timezone.c \ + misc/_get_tzname.c \ misc/_initterm_e.c \ misc/_recalloc.c \ misc/_set_errno.c \ diff --git a/mingw-w64-crt/misc/_get_tzname.c b/mingw-w64-crt/misc/_get_tzname.c new file mode 100644 index 000000000000..b5a9186fd051 --- /dev/null +++ b/mingw-w64-crt/misc/_get_tzname.c @@ -0,0 +1,42 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include <time.h> +#include <errno.h> +#include <string.h> + +errno_t __cdecl _get_tzname(size_t *length, char *buffer, size_t size, int index) +{ + const char *tzname_ptr; + + if ((!buffer && size != 0) || (buffer && size == 0)) + { + errno = EINVAL; + return EINVAL; + } + + if (buffer) + buffer[0] = '\0'; + + if (!length || (index != 0 && index != 1)) + { + errno = EINVAL; + return EINVAL; + } + + tzname_ptr = _tzname[index]; + + *length = strlen(tzname_ptr) + 1; + + if (buffer) + { + if (*length > size) + return ERANGE; + memcpy(buffer, tzname_ptr, *length); + } + + return 0; +} +errno_t (__cdecl *__MINGW_IMP_SYMBOL(_get_tzname))(size_t *, char *, size_t, int) = _get_tzname; -- 2.20.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public