X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fdtime.c;h=48e13dbbdccdfd3174c4ccf6d5846f80e21ec8bd;hp=5a73934cf00a62c77a679c3fcada67dadb5e739f;hb=6195a89359453dc49064c8f7a28c02165d2cb972;hpb=5a4836db0e18fe3fa32ba5d3deff2010d8a1b418 diff --git a/sbr/dtime.c b/sbr/dtime.c index 5a73934..48e13db 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -11,6 +11,10 @@ #include #include +#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) +extern long timezone; +#endif + #ifndef abs # define abs(a) (a >= 0 ? a : -a) #endif @@ -102,8 +106,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;