Checking at configure time for timezone integer variable.

This commit is contained in:
Thomas Schmitt 2014-11-26 14:26:14 +01:00
parent 288eb75745
commit cdc336a02b
3 changed files with 26 additions and 1 deletions

View File

@ -198,3 +198,15 @@ dnl For debugging only
]) ])
dnl LIBBURNIA_TRY_TIMEZONE is by Thomas Schmitt, libburnia project
dnl It tests whether the global variable exists and is suitable for
dnl integer arithmetics.
AC_DEFUN([LIBBURNIA_TRY_TIMEZONE],
[
echo -n "checking for timezone variable ... "
AC_TRY_LINK([ #include <time.h> ], [long int i; i = 1 - timezone; ],
[LIBBURNIA_TIMEZONE="timezone"], [LIBBURNIA_TIMEZONE="0"]
)
echo "$LIBBURNIA_TIMEZONE"
])

View File

@ -114,6 +114,16 @@ AC_CHECK_DECL([timegm],
, ,
[#include <time.h>]) [#include <time.h>])
dnl Whether timezone is an integer variable
AH_TEMPLATE([Libburnia_timezonE], [Either timezone or 0])
LIBBURNIA_TRY_TIMEZONE
if test x$LIBBURNIA_TIMEZONE = xtimezone
then
AC_DEFINE([Libburnia_timezonE], [timezone])
else
AC_DEFINE([Libburnia_timezonE], [0])
fi
dnl Check if non standard eaccess() function is available dnl Check if non standard eaccess() function is available
AC_CHECK_DECL([eaccess], AC_CHECK_DECL([eaccess],
[AC_DEFINE(HAVE_EACCESS, 1, [Define this if eaccess function is available])], [AC_DEFINE(HAVE_EACCESS, 1, [Define this if eaccess function is available])],

View File

@ -1574,7 +1574,10 @@ void iso_datetime_7(unsigned char *buf, time_t t, int always_gmt)
#else #else
if (tm.tm_isdst < 0) if (tm.tm_isdst < 0)
tm.tm_isdst = 0; tm.tm_isdst = 0;
tzoffset = ( - timezone / 60 / 15 ) + 4 * tm.tm_isdst; #ifndef Libburnia_timezonE
#define Libburnia_timezonE timezone
#endif
tzoffset = ( - Libburnia_timezonE / 60 / 15 ) + 4 * tm.tm_isdst;
#endif #endif
if (tzoffset > 52 || tzoffset < -48 || always_gmt) { if (tzoffset > 52 || tzoffset < -48 || always_gmt) {