Renamed DSTXXX as ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST and added an
authorDan Harkless <dan@harkless.org>
Mon, 24 Jul 2000 23:24:22 +0000 (23:24 +0000)
committerDan Harkless <dan@harkless.org>
Mon, 24 Jul 2000 23:24:22 +0000 (23:24 +0000)
explanatory comment by its #definition.

ChangeLog
h/tws.h
sbr/dtime.c
sbr/dtimep.c
sbr/dtimep.lex

index 7789d87..2fd1854 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-Mon Jul 24 16:06:18 2000 Dan Harkless <dan-nmh@dilvish.speed.net>
+Mon Jul 24 16:20:45 2000 Dan Harkless <dan-nmh@dilvish.speed.net>
 
        * 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 <dan-nmh@dilvish.speed.net>
        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 <dan-nmh@dilvish.speed.net>
diff --git a/h/tws.h b/h/tws.h
index 83ec880..47a31b9 100644 (file)
--- 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] */
index 8de4b69..57b61c8 100644 (file)
@@ -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;
index 159c901..68616b8 100644 (file)
@@ -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 <sys/time.h>
 #  include <time.h>
@@ -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:
index b4357a1..c36844d 100644 (file)
@@ -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 <sys/time.h>
 #  include <time.h>
@@ -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);