CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD)
CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN)
CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK)
+CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R)
CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT)
CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES)
CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC)
CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY)
CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN)
CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB)
+CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE_LOCALTIME64_S)
CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64)
CHECK_SYMBOL_EXISTS(wmemcmp "wchar.h" HAVE_WMEMCMP)
CHECK_SYMBOL_EXISTS(wmemcpy "wchar.h" HAVE_WMEMCPY)
/* Define to 1 if you have the <locale.h> header file. */
#cmakedefine HAVE_LOCALE_H 1
+/* Define to 1 if you have the `localtime_r' function. */
+#cmakedefine HAVE_LOCALTIME_R 1
+
/* Define to 1 if the system has the type `long long int'. */
#cmakedefine HAVE_LONG_LONG_INT 1
/* Define to 1 if you have the <zlib.h> header file. */
#cmakedefine HAVE_ZLIB_H 1
+/* Define to 1 if you have the `_localtime64_s' function. */
+#cmakedefine HAVE__LOCALTIME64_S 1
+
/* Define to 1 if you have the `_mkgmtime64' function. */
#cmakedefine HAVE__MKGMTIME64 1
AC_CHECK_FUNCS([chflags chown chroot])
AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fork])
AC_CHECK_FUNCS([fstat ftruncate futimens futimes geteuid getpid])
-AC_CHECK_FUNCS([lchflags lchmod lchown link lstat])
+AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat])
AC_CHECK_FUNCS([lutimes mbrtowc memmove memset mkdir mkfifo mknod mkstemp])
AC_CHECK_FUNCS([nl_langinfo pipe poll readlink])
AC_CHECK_FUNCS([select setenv setlocale sigaction])
#include <stdint.h>
#endif
#include <stdio.h>
-#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <process.h>
#define link __la_link
#define lseek __la_lseek
#define lstat __la_stat
-#define localtime_r(time, tm) localtime_s(tm, time)
#define mbstowcs __la_mbstowcs
#define mkdir(d,m) __la_mkdir(d, m)
#define open __la_open
{
struct tm tm;
+#if HAVE_LOCALTIME_R
tzset();
localtime_r(&t, &tm);
+#elif HAVE__LOCALTIME64_S
+ _localtime64_s(&tm, &t)
+#else
+ memcpy(&tm, localtime(&t), sizeof(tm));
+#endif
set_digit(p, 4, tm.tm_year + 1900);
set_digit(p+4, 2, tm.tm_mon + 1);
set_digit(p+6, 2, tm.tm_mday);
{
struct tm tm;
+#if HAVE_LOCALTIME_R
tzset();
localtime_r(&t, &tm);
+#elif HAVE__LOCALTIME64_S
+ _localtime64_s(&tm, &t)
+#else
+ memcpy(&tm, localtime(&t), sizeof(tm));
+#endif
set_num_711(p+0, tm.tm_year);
set_num_711(p+1, tm.tm_mon+1);
set_num_711(p+2, tm.tm_mday);