diff --git a/trunk/bootstrap b/trunk/bootstrap index ad2bf022..a0b64694 100755 --- a/trunk/bootstrap +++ b/trunk/bootstrap @@ -3,4 +3,5 @@ aclocal libtoolize --copy --force autoconf +autoheader automake --foreign --add-missing --copy --include-deps diff --git a/trunk/configure.ac b/trunk/configure.ac index d101994c..d7784f8f 100644 --- a/trunk/configure.ac +++ b/trunk/configure.ac @@ -7,6 +7,8 @@ AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([subdir-objects]) +AM_CONFIG_HEADER(config.h) + dnl Making releases: dnl BURN_MICRO_VERSION += 1; dnl BURN_INTERFACE_AGE += 1; @@ -69,6 +71,12 @@ AC_PROG_INSTALL AC_CHECK_HEADERS() +AC_CHECK_MEMBER([struct tm.tm_gmtoff], + [AC_DEFINE(HAVE_TM_GMTOFF, 1, + [Define this if tm structure includes a tm_gmtoff entry.])], + , + [#include ]) + THREAD_LIBS=-lpthread AC_SUBST(THREAD_LIBS) diff --git a/trunk/libisofs/util.c b/trunk/libisofs/util.c index 186c7951..2187b6fe 100755 --- a/trunk/libisofs/util.c +++ b/trunk/libisofs/util.c @@ -4,6 +4,9 @@ /** * Utility functions for the Libisofs library. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include #include @@ -421,16 +424,11 @@ void iso_bb(uint8_t *buf, uint32_t num, int bytes) void iso_datetime_7(unsigned char *buf, time_t t) { static int tzsetup = 0; - static int tzoffset; + int tzoffset; struct tm tm; if (!tzsetup) { tzset(); - - tzoffset = -timezone / 60 / 15; - if (tzoffset < -48) - tzoffset += 101; - tzsetup = 1; } @@ -442,6 +440,13 @@ void iso_datetime_7(unsigned char *buf, time_t t) buf[3] = tm.tm_hour; buf[4] = tm.tm_min; buf[5] = tm.tm_sec; +#ifdef HAVE_TM_GMTOFF + tzoffset = -tm.tm_gmtoff / 60 / 15; +#else + tzoffset = -timezone / 60 / 15; +#endif + if (tzoffset < -48) + tzoffset += 101; buf[6] = tzoffset; } @@ -472,11 +477,6 @@ void iso_datetime_17(unsigned char *buf, time_t t) } else { if (!tzsetup) { tzset(); - - tzoffset = -timezone / 60 / 15; - if (tzoffset < -48) - tzoffset += 101; - tzsetup = 1; } @@ -489,6 +489,13 @@ void iso_datetime_17(unsigned char *buf, time_t t) sprintf((char*)&buf[10], "%02d", tm.tm_min); sprintf((char*)&buf[12], "%02d", MIN(59, tm.tm_sec)); memcpy(&buf[14], "00", 2); +#ifdef HAVE_TM_GMTOFF + tzoffset = -tm.tm_gmtoff / 60 / 15; +#else + tzoffset = -timezone / 60 / 15; +#endif + if (tzoffset < -48) + tzoffset += 101; buf[16] = tzoffset; } }