X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/0cd4ef27dfd7ab539a3217287795d4d9732c18d0..0e52f41f67c1f9699861f3d7aa5dbbcdbb428c3e:/sbr/dtime.c?ds=sidebyside diff --git a/sbr/dtime.c b/sbr/dtime.c index a7c15747..89f5dde8 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -108,7 +108,14 @@ dlocaltime (time_t *clock) if (tm->tm_isdst) /* if DST is in effect */ tw.tw_zone -= 60; /* reset to normal offset */ #else - tzset(); + { + static bool deja_vu; + + if (!deja_vu) { + deja_vu = true; + tzset(); + } + } tw.tw_zone = -(timezone / 60); #endif @@ -232,9 +239,9 @@ dtime (time_t *clock, int alpha_timezone) if (alpha_timezone) /* use alpha-numeric timezones */ return dasctime (dlocaltime (clock), TW_NULL); - else - /* use numeric timezones */ - return dasctime (dlocaltime (clock), TW_ZONE); + + /* use numeric timezones */ + return dasctime (dlocaltime (clock), TW_ZONE); } @@ -280,7 +287,10 @@ dasctime (struct tws *tw, int flags) /* - * Get the timezone for given offset + * Get the timezone for given offset. + * This used to return a three-letter abbreviation for some offset + * values. But not many. Until there's a good way to do that, + * return the string representation of the numeric offset. */ char * @@ -297,11 +307,6 @@ dtimezone (int offset, int flags) hours = offset / 60; } - if (!(flags & TW_ZONE) && mins == 0) { - tzset(); - return ((flags & TW_DST) ? tzname[1] : tzname[0]); - } - #ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST if (flags & TW_DST) hours += 1; @@ -404,20 +409,6 @@ void twscopy (struct tws *tb, struct tws *tw) { *tb = *tw; /* struct copy */ - -#if 0 - tb->tw_sec = tw->tw_sec; - tb->tw_min = tw->tw_min; - tb->tw_hour = tw->tw_hour; - tb->tw_mday = tw->tw_mday; - tb->tw_mon = tw->tw_mon; - tb->tw_year = tw->tw_year; - tb->tw_wday = tw->tw_wday; - tb->tw_yday = tw->tw_yday; - tb->tw_zone = tw->tw_zone; - tb->tw_clock = tw->tw_clock; - tb->tw_flags = tw->tw_flags; -#endif }