diff --git a/configure.ac b/configure.ac index e100438..8f3c6ea 100644 --- a/configure.ac +++ b/configure.ac @@ -328,6 +328,7 @@ AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?])) AC_CHECK_FUNCS(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) ) AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF) ) AC_CHECK_FUNC(strtok_r, AC_DEFINE(HAVE_STRTOK_R) ) +AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R) ) AC_ARG_WITH([inet-ntop], [AS_HELP_STRING([--with-inet-ntop], [Assume that inet_nto() is available])], [ app_cv_inet_ntop="$withval" ],[ app_cv_inet_ntop="auto" ]) diff --git a/src/filetransfer/v3270ftprogress.c b/src/filetransfer/v3270ftprogress.c index 2f8baba..7c79ec0 100644 --- a/src/filetransfer/v3270ftprogress.c +++ b/src/filetransfer/v3270ftprogress.c @@ -485,9 +485,15 @@ void v3270ftprogress_update(GtkWidget *widget, unsigned long current, unsigned l char buffer[40]; double seconds = ((double) remaining) / kbytes_sec; time_t eta = time(0) + ((time_t) seconds); - struct tm tm; - strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm)); +#ifdef HAVE_LOCALTIME_R + { + struct tm tm; + strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm)); + } +#else + strftime(buffer, 39, "%H:%M:%S", localtime(&eta)); +#endif // HAVE_LOCALTIME_R gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],buffer); diff --git a/src/filetransfer/worker.c b/src/filetransfer/worker.c index 246525c..885312f 100644 --- a/src/filetransfer/worker.c +++ b/src/filetransfer/worker.c @@ -455,8 +455,15 @@ char buffer[40]; double seconds = ((double) remaining) / update->kbytes_sec; time_t eta = time(NULL) + ((time_t) seconds); - struct tm tm; - strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm)); + +#ifdef HAVE_LOCALTIME_R + { + struct tm tm; + strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm)); + } +#else + strftime(buffer, 39, "%H:%M:%S", localtime(&eta)); +#endif // HAVE_LOCALTIME_R gtk_entry_set_text(update->worker->field[PROGRESS_FIELD_ETA],buffer); diff --git a/src/include/config.h.in b/src/include/config.h.in index a1f5f3f..feb7789 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -43,6 +43,6 @@ #undef RPQ_REVISION #undef SCCS_USER #undef SCCS_DATE - + #undef HAVE_LOCALTIME_R #endif /* LIBV3270_CONFIG_INCLUDED */ -- libgit2 0.21.2