explanatory comment by its #definition.
-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
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>
* $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] */
#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;
#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>
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
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:
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:
#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>
tw->tw_zone -= 60;
}
}
-#endif /* DSTXXX */
+#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */
%}
sun ([Ss]un(day)?)
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);