check for setenv/getenv and only use if present (fixes mingw32)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user