/* 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] */
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;
#define SKIPTOSP() { while ( !isspace((unsigned char) *cp++) ) ; \
--cp; }
-#ifdef ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# endif
tw->tw_zone -= 60;
}
}
-#endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */
%}
sun ([Ss]un(day)?)
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();
}