From: Ralph Corderoy Date: Sun, 23 Apr 2017 15:10:59 +0000 (+0100) Subject: tws.h: Remove ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/c83acac4bb6fe61e1e0f4b8e4b2e4a0d2f00b416?ds=sidebyside;hp=2c5c74d8aff556e5cd7bc10c9d555a0b2a026ed7 tws.h: Remove ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST. Code that's conditional on its definition has been kept; just the tests removed. The comment explaining its purpose has been kept, just without the "If defined...". --- diff --git a/h/tws.h b/h/tws.h index 66e33613..9acda6a6 100644 --- a/h/tws.h +++ b/h/tws.h @@ -1,12 +1,11 @@ /* tws.h -- time routines. */ -/* If the following is #defined, a timezone given as a numeric-only offset will +/* A timezone given as a numeric-only offset will be treated specially if it's in a zone that observes Daylight Saving Time. For instance, during DST, a Date: like "Mon, 24 Jul 2000 12:31:44 -0700" will be printed as "Mon, 24 Jul 2000 12:31:44 PDT". Without the code activated by the following #define, that'd be incorrectly printed as "...MST". */ -#define ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST 1 struct tws { int tw_sec; /* seconds after the minute - [0, 61] */ diff --git a/sbr/dtime.c b/sbr/dtime.c index 58cb94eb..b4aaed8d 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -298,10 +298,8 @@ dtimezone (int offset, int flags) hours = offset / 60; } -#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST if (flags & TW_DST) hours++; -#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ snprintf (buffer, sizeof(buffer), "%s%02d%02d", offset < 0 ? "-" : "+", abs (hours), abs (mins)); return buffer; diff --git a/sbr/dtimep.l b/sbr/dtimep.l index d2483769..35c455db 100644 --- a/sbr/dtimep.l +++ b/sbr/dtimep.l @@ -159,7 +159,6 @@ static int day_map[] = { #define SKIPTOSP() { while ( !isspace((unsigned char) *cp++) ) ; \ --cp; } -#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST # ifdef HAVE_SYS_TIME_H # include # endif @@ -179,7 +178,6 @@ zonehack (struct tws *tw) tw->tw_zone -= 60; } } -#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ %} sun ([Ss]un(day)?) @@ -341,18 +339,14 @@ nl [ \t\n()] INIT(); SKIPTOD(); SETZONE(atoi(cp)); -#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST zonehack (&tw); -#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ yyterminate(); } "-"{D}{d}{d} { INIT(); SKIPTOD(); SETZONE(-atoi(cp)); -#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST zonehack (&tw); -#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ yyterminate(); }