Checking at configure time for timezone integer variable.
This commit is contained in:
parent
288eb75745
commit
cdc336a02b
12
acinclude.m4
12
acinclude.m4
@ -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"
|
||||
])
|
||||
|
||||
|
10
configure.ac
10
configure.ac
@ -114,6 +114,16 @@ AC_CHECK_DECL([timegm],
|
||||
,
|
||||
[#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
|
||||
AC_CHECK_DECL([eaccess],
|
||||
[AC_DEFINE(HAVE_EACCESS, 1, [Define this if eaccess function is available])],
|
||||
|
@ -1574,7 +1574,10 @@ void iso_datetime_7(unsigned char *buf, time_t t, int always_gmt)
|
||||
#else
|
||||
if (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
|
||||
|
||||
if (tzoffset > 52 || tzoffset < -48 || always_gmt) {
|
||||
|
Loading…
Reference in New Issue
Block a user