From 21159328e7685e77c4595e49e10e1189f356db3e Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 15 May 2009 18:19:30 +0000 Subject: [PATCH] add configure checks for tm->tm_gmtoff and tm->tm_zone (FSBUILD-160) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13362 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- configure.in | 8 ++++++++ src/switch_time.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index c71bf2905c..7bc8e48591 100644 --- a/configure.in +++ b/configure.in @@ -337,6 +337,14 @@ AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])]) AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket)) +AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[ +#include +#include ]) + +AC_CHECK_MEMBERS([struct tm.tm_zone, struct tm.__tm_zone],,,[ +#include +#include ]) + AC_CHECK_DECL([RLIMIT_MEMLOCK], [AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],, [#ifdef HAVE_SYS_RESOURCE_H diff --git a/src/switch_time.c b/src/switch_time.c index 10f8be054c..8779e2e714 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -586,8 +586,8 @@ static void tm2switchtime(struct tm * tm, switch_time_exp_t *xt ) xt->tm_wday = tm->tm_wday; xt->tm_yday = tm->tm_yday; xt->tm_isdst = tm->tm_isdst; -#if !defined(WIN32) && !defined(__SVR4) && !defined(__sun) +#if defined(HAVE_STRUCT_TM_TM_GMTOFF) xt->tm_gmtoff = tm->tm_gmtoff; #endif @@ -1635,7 +1635,7 @@ static void timesub(const time_t * const timep, const long offset, register cons tmp->tm_mday = (int) (days + 1); tmp->tm_isdst = 0; -#if !defined(WIN32) && !defined(__SVR4) && !defined(__sun) +#if defined(HAVE_STRUCT_TM_TM_GMTOFF) tmp->tm_gmtoff = offset; #endif } @@ -1691,7 +1691,7 @@ static void tztime(const time_t * const timep, const char *tzstring, struct tm * { timesub( &t, ttisp->tt_gmtoff, sp, tmp); tmp->tm_isdst = ttisp->tt_isdst; -#if !defined(WIN32) && !defined(__SVR4) && !defined(__sun) +#if defined(HAVE_STRUCT_TM_TM_ZONE) tmp->tm_zone = &sp->chars[ttisp->tt_abbrind]; #endif }