From 311bed3fbafec4ec6dc1792d73b18b910da4c8f6 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 27 Oct 2005 03:26:39 +0000 Subject: [PATCH] Attempt to deal with OS's (like BSDI) that don't have an extern long timezone. --- configure.ac | 21 ++++++++++++++++++++- lib/udf/udf_time.c | 6 +++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 698787e3..a0b62ef3 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ define(RELEASE_NUM, 77) define(CDIO_VERSION_STR, 0.$1cvs) AC_PREREQ(2.52) -AC_REVISION([$Id: configure.ac,v 1.178 2005/10/27 03:03:42 rocky Exp $])dnl +AC_REVISION([$Id: configure.ac,v 1.179 2005/10/27 03:26:39 rocky Exp $])dnl AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM)) AC_CONFIG_SRCDIR(src/cd-info.c) @@ -283,6 +283,25 @@ else fi dnl +dnl bitfield order +AC_MSG_CHECKING(extern long timezone variable) +AC_TRY_RUN([ +#ifdef NEED_TIMEZONEVAR +#define timezonevar 1 +#endif + +#include +extern long timezone; +int main(int argc, char **argv) { + long test_timezone = timezone; + return 0; +} +], [AC_MSG_RESULT(yes); + AC_DEFINE([HAVE_TIMEZONE_VAR], 1, + [Define if you have an extern long timenzone variable.])], + [AC_MSG_RESULT(no)]) +dnl + dnl AM_PROG_LIBTOOL tests whether we have GNU ld dnl this must come before checking --with-versioned-libs dnl which requires GNU ld. diff --git a/lib/udf/udf_time.c b/lib/udf/udf_time.c index c971c621..2e09bd68 100644 --- a/lib/udf/udf_time.c +++ b/lib/udf/udf_time.c @@ -93,7 +93,9 @@ static time_t year_seconds[MAX_YEAR_SECONDS]= { /*2038*/ SPY(68,17,0) }; +#ifdef HAVE_TIMEZONE_VAR extern long timezone; +#endif #define SECS_PER_HOUR (60 * 60) #define SECS_PER_DAY (SECS_PER_HOUR * 24) @@ -142,8 +144,10 @@ udf_time_to_stamp(udf_timestamp_t *dest, struct timespec ts) long int days, rem, y; const unsigned short int *ip; int16_t offset; - + +#ifdef HAVE_TIMEZONE_VAR offset = -timezone; +#endif if (!dest) return NULL;