From da12435096e47ec1d362215141fc8b21f24e5e01 Mon Sep 17 00:00:00 2001 From: Dan Harkless Date: Mon, 24 Jul 2000 23:24:22 +0000 Subject: [PATCH] Renamed DSTXXX as ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST and added an explanatory comment by its #definition. --- ChangeLog | 5 ++++- h/tws.h | 8 ++++++-- sbr/dtime.c | 4 ++-- sbr/dtimep.c | 12 ++++++------ sbr/dtimep.lex | 12 ++++++------ 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7789d87..2fd1854 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Mon Jul 24 16:06:18 2000 Dan Harkless +Mon Jul 24 16:20:45 2000 Dan Harkless * When Shantonu wrote the new, more portable dtimep.lex, he left out the #ifdef DSTXXX stuff for some reason. Not a good idea, as @@ -6,6 +6,9 @@ Mon Jul 24 16:06:18 2000 Dan Harkless timezones that have daylight saving time. Without that code, -0700 during DST gets printed as MST instead of PDT. + * Renamed DSTXXX as ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST and + added an explanatory comment by its #definition. + * Updated README.developers with the fact that zotnet/tws is going away. Thu Jul 20 20:30:52 2000 Dan Harkless diff --git a/h/tws.h b/h/tws.h index 83ec880..47a31b9 100644 --- a/h/tws.h +++ b/h/tws.h @@ -5,8 +5,12 @@ * $Id$ */ -/* DST vs. GMT nonsense */ -#define DSTXXX +/* If the following is #defined, 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 8de4b69..57b61c8 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -376,10 +376,10 @@ dtimezone (int offset, int flags) #endif } -#if defined(DSTXXX) +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST if (flags & TW_DST) hours += 1; -#endif /* defined(DSTXXX) */ +#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.c b/sbr/dtimep.c index 159c901..68616b8 100644 --- a/sbr/dtimep.c +++ b/sbr/dtimep.c @@ -945,7 +945,7 @@ static int day_map[] = { #define SKIPTOSP() { while ( !isspace(*cp++) ) ; \ --cp; } -#ifdef DSTXXX +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST # ifdef TIME_WITH_SYS_TIME # include # include @@ -971,7 +971,7 @@ zonehack (struct tws *tw) tw->tw_zone -= 60; } } -#endif /* DSTXXX */ +#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ /* The year can either be 2 digits, or 4. However, after Y2K, we found that some MUA were reporting the year 100, hence the middle term here. yyterminate() resolves the actual @@ -1386,9 +1386,9 @@ YY_RULE_SETUP INIT(); SKIPTOD(); SETZONE(atoi(cp)); -#ifdef DSTXXX +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST zonehack (&tw); -#endif /* DSTXXX */ +#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ } YY_BREAK case 13: @@ -1398,9 +1398,9 @@ YY_RULE_SETUP INIT(); SKIPTOD(); SETZONE(-atoi(cp)); -#ifdef DSTXXX +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST zonehack (&tw); -#endif /* DSTXXX */ +#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ } YY_BREAK case 14: diff --git a/sbr/dtimep.lex b/sbr/dtimep.lex index b4357a1..c36844d 100644 --- a/sbr/dtimep.lex +++ b/sbr/dtimep.lex @@ -154,7 +154,7 @@ static int day_map[] = { #define SKIPTOSP() { while ( !isspace(*cp++) ) ; \ --cp; } -#ifdef DSTXXX +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST # ifdef TIME_WITH_SYS_TIME # include # include @@ -180,7 +180,7 @@ zonehack (struct tws *tw) tw->tw_zone -= 60; } } -#endif /* DSTXXX */ +#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ %} sun ([Ss]un(day)?) @@ -355,17 +355,17 @@ d [0-9] INIT(); SKIPTOD(); SETZONE(atoi(cp)); -#ifdef DSTXXX +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST zonehack (&tw); -#endif /* DSTXXX */ +#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ } "-"{D}{d}{d} { INIT(); SKIPTOD(); SETZONE(-atoi(cp)); -#ifdef DSTXXX +#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST zonehack (&tw); -#endif /* DSTXXX */ +#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */ } "-"?("ut"|"UT") INIT(); SETZONE(0); "-"?("gmt"|"GMT") INIT(); SETZONE(0); -- 1.7.10.4