From: David Levine Date: Thu, 26 Jan 2012 01:33:17 +0000 (-0600) Subject: Undid most of 3ef341abe440ece07f8deed59fb026ab020e805 because FreeBSD needs the HAVE_... X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=0cd4ef27dfd7ab539a3217287795d4d9732c18d0;p=mmh Undid most of 3ef341abe440ece07f8deed59fb026ab020e805 because FreeBSD needs the HAVE_STRUCT_TM_TM_GMTOFF test. It has a timezone() function, not a timezone global variable (that's visible with our default configuration. --- diff --git a/configure.ac b/configure.ac index 0756158..d73f376 100644 --- a/configure.ac +++ b/configure.ac @@ -716,6 +716,11 @@ dnl ---------------- dnl CHECK STRUCTURES dnl ---------------- +dnl For platforms such as FreeBSD that have tm_gmtoff in struct tm. +dnl (FreeBSD has a timezone() function but not a timezone global +dnl variable that is visible). +AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include ]) + AC_STRUCT_DIRENT_D_TYPE dnl Where is located? Needed as input for signames.awk diff --git a/sbr/dtime.c b/sbr/dtime.c index aa34621..a7c1574 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -12,6 +12,10 @@ #include #include +#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) +extern long timezone; +#endif + /* * The number of days in the year, accounting for leap years */ @@ -99,8 +103,14 @@ dlocaltime (time_t *clock) if (tm->tm_isdst) tw.tw_flags |= TW_DST; +#ifdef HAVE_STRUCT_TM_TM_GMTOFF + tw.tw_zone = tm->tm_gmtoff / 60; + if (tm->tm_isdst) /* if DST is in effect */ + tw.tw_zone -= 60; /* reset to normal offset */ +#else tzset(); tw.tw_zone = -(timezone / 60); +#endif tw.tw_flags &= ~TW_SDAY; tw.tw_flags |= TW_SEXP;