X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/0c926c599d9def7f70e674b7628a4bafd8cd6698..ec68c7d9fca00e976df02842dc2c9d5a523567af:/sbr/dtime.c diff --git a/sbr/dtime.c b/sbr/dtime.c index 6acfaeb6..52f3a790 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -1,6 +1,4 @@ - -/* - * dtime.c -- time/date routines +/* dtime.c -- time/date routines * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -41,12 +39,6 @@ char *tw_ldotw[] = { "Saturday", NULL }; -struct zone { - char *std; - char *dst; - int shift; -}; - static int dmsize[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; @@ -108,7 +100,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 +231,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); } @@ -402,20 +401,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 }