Commit 5ae53d6ce712b9d01dbccc529c92a684f0517706

Authored by Perry Werneck
1 parent 1a61394c
Exists in master and in 1 other branch develop

Fixing windows build.

configure.ac
... ... @@ -328,6 +328,7 @@ AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))
328 328 AC_CHECK_FUNCS(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) )
329 329 AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF) )
330 330 AC_CHECK_FUNC(strtok_r, AC_DEFINE(HAVE_STRTOK_R) )
  331 +AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R) )
331 332  
332 333 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" ])
333 334  
... ...
src/filetransfer/v3270ftprogress.c
... ... @@ -485,9 +485,15 @@ void v3270ftprogress_update(GtkWidget *widget, unsigned long current, unsigned l
485 485 char buffer[40];
486 486 double seconds = ((double) remaining) / kbytes_sec;
487 487 time_t eta = time(0) + ((time_t) seconds);
488   - struct tm tm;
489 488  
490   - strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm));
  489 +#ifdef HAVE_LOCALTIME_R
  490 + {
  491 + struct tm tm;
  492 + strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm));
  493 + }
  494 +#else
  495 + strftime(buffer, 39, "%H:%M:%S", localtime(&eta));
  496 +#endif // HAVE_LOCALTIME_R
491 497  
492 498 gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],buffer);
493 499  
... ...
src/filetransfer/worker.c
... ... @@ -455,8 +455,15 @@
455 455 char buffer[40];
456 456 double seconds = ((double) remaining) / update->kbytes_sec;
457 457 time_t eta = time(NULL) + ((time_t) seconds);
458   - struct tm tm;
459   - strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm));
  458 +
  459 +#ifdef HAVE_LOCALTIME_R
  460 + {
  461 + struct tm tm;
  462 + strftime(buffer, 39, "%H:%M:%S", localtime_r(&eta,&tm));
  463 + }
  464 +#else
  465 + strftime(buffer, 39, "%H:%M:%S", localtime(&eta));
  466 +#endif // HAVE_LOCALTIME_R
460 467  
461 468 gtk_entry_set_text(update->worker->field[PROGRESS_FIELD_ETA],buffer);
462 469  
... ...
src/include/config.h.in
... ... @@ -43,6 +43,6 @@
43 43 #undef RPQ_REVISION
44 44 #undef SCCS_USER
45 45 #undef SCCS_DATE
46   -
  46 + #undef HAVE_LOCALTIME_R
47 47  
48 48 #endif /* LIBV3270_CONFIG_INCLUDED */
... ...