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