Commit 96176f16 authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi

ut0ut.c If localtime_r not available in Unix, use localtime

configure.in	If localtime_r not available in Unix, use localtime
parent 444afa75
No related merge requests found
...@@ -38,6 +38,7 @@ AC_CHECK_HEADERS(aio.h sched.h) ...@@ -38,6 +38,7 @@ AC_CHECK_HEADERS(aio.h sched.h)
AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(int, 4)
AC_CHECK_FUNCS(sched_yield) AC_CHECK_FUNCS(sched_yield)
AC_CHECK_FUNCS(fdatasync) AC_CHECK_FUNCS(fdatasync)
AC_CHECK_FUNCS(localtime_r)
#AC_C_INLINE Already checked in MySQL #AC_C_INLINE Already checked in MySQL
AC_C_BIGENDIAN AC_C_BIGENDIAN
......
...@@ -72,19 +72,25 @@ ut_print_timestamp( ...@@ -72,19 +72,25 @@ ut_print_timestamp(
#else #else
struct tm cal_tm; struct tm cal_tm;
struct tm* cal_tm_ptr;
time_t tm; time_t tm;
time(&tm); time(&tm);
#ifdef HAVE_LOCALTIME_R
localtime_r(&tm, &cal_tm); localtime_r(&tm, &cal_tm);
cal_tm_ptr = &cal_tm;
#else
cal_tm_ptr = localtime(&tm);
#endif
fprintf(file,"%02d%02d%02d %2d:%02d:%02d", fprintf(file,"%02d%02d%02d %2d:%02d:%02d",
cal_tm.tm_year % 100, cal_tm_ptr->tm_year % 100,
cal_tm.tm_mon+1, cal_tm_ptr->tm_mon+1,
cal_tm.tm_mday, cal_tm_ptr->tm_mday,
cal_tm.tm_hour, cal_tm_ptr->tm_hour,
cal_tm.tm_min, cal_tm_ptr->tm_min,
cal_tm.tm_sec); cal_tm_ptr->tm_sec);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment