diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 3d4c071ac..d6eea5cb7 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -4923,24 +4923,30 @@ static int _put_UINT32_as_localtime(CONFIG_PUT_ARGS) { time_t camtime,newcamtime; struct tm *ptm; +#if HAVE_SETENV char *tz; +#endif camtime = 0; CR (gp_widget_get_value (widget, &camtime)); ptm = localtime(&camtime); +#if HAVE_SETENV tz = getenv("TZ"); if (tz) C_MEM (tz = strdup(tz)); setenv("TZ", "", 1); tzset(); +#endif newcamtime = mktime(ptm); +#if HAVE_SETENV if (tz) { setenv("TZ", tz, 1); free(tz); } else unsetenv("TZ"); tzset(); +#endif propval->u32 = newcamtime; return (GP_OK); diff --git a/configure.ac b/configure.ac index f8d2351ce..9eadd20b5 100644 --- a/configure.ac +++ b/configure.ac @@ -314,7 +314,7 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T dnl Checks for library functions. -AC_CHECK_FUNCS([getopt getopt_long mkdir strdup strncpy strcpy snprintf sprintf vsnprintf gmtime_r statfs localtime_r lstat inet_aton rand_r]) +AC_CHECK_FUNCS([getenv getopt getopt_long mkdir setenv strdup strncpy strcpy snprintf sprintf vsnprintf gmtime_r statfs localtime_r lstat inet_aton rand_r]) dnl Find out how to get struct tm AC_STRUCT_TM