X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/3ef341abe440ece07f8deed59fb026ab020e805a..7e5bac1a416e400bd3c8941b1c312577f2d9e9e4:/sbr/dtime.c diff --git a/sbr/dtime.c b/sbr/dtime.c index aa346216..a7c15747 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;