1ca0d3fbobrien%{
2ca0d3fbobrien/*
3ca0d3fbobrien**  Originally written by Steven M. Bellovin <smb@research.att.com> while
4ca0d3fbobrien**  at the University of North Carolina at Chapel Hill.  Later tweaked by
5ca0d3fbobrien**  a couple of people on Usenet.  Completely overhauled by Rich $alz
6ca0d3fbobrien**  <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
7ca0d3fbobrien**
8ca0d3fbobrien**  This grammar has 10 shift/reduce conflicts.
9ca0d3fbobrien**
10ca0d3fbobrien**  This code is in the public domain and has no copyright.
11ca0d3fbobrien*/
12ca0d3fbobrien/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
13ca0d3fbobrien/* SUPPRESS 288 on yyerrlab *//* Label unused */
14ca0d3fbobrien
150a322f4markm#include <sys/cdefs.h>
160a322f4markm__FBSDID("$FreeBSD$");
17ca0d3fbobrien
180842b7ddelphij#include <stdio.h>
19ca0d3fbobrien#include <ctype.h>
20ca0d3fbobrien
21ca0d3fbobrien/* The code at the top of get_date which figures out the offset of the
22ca0d3fbobrien   current time zone checks various CPP symbols to see if special
23ca0d3fbobrien   tricks are need, but defaults to using the gettimeofday system call.
24ca0d3fbobrien   Include <sys/time.h> if that will be used.  */
25ca0d3fbobrien
26ca0d3fbobrien# include <sys/types.h>
27ca0d3fbobrien# include <sys/time.h>
28ca0d3fbobrien
2937b3235obrien#if defined (__STDC__) || defined (USG)
30ca0d3fbobrien#include <string.h>
31ca0d3fbobrien#endif
32ca0d3fbobrien
3337b3235obrien#if defined (__STDC__)
34ca0d3fbobrien#include <stdlib.h>
35ca0d3fbobrien#endif
36ca0d3fbobrien
37ca0d3fbobrien/* NOTES on rebuilding getdate.c (particularly for inclusion in CVS
38ca0d3fbobrien   releases):
39ca0d3fbobrien
40ca0d3fbobrien   We don't want to mess with all the portability hassles of alloca.
41ca0d3fbobrien   In particular, most (all?) versions of bison will use alloca in
42ca0d3fbobrien   their parser.  If bison works on your system (e.g. it should work
43ca0d3fbobrien   with gcc), then go ahead and use it, but the more general solution
44ca0d3fbobrien   is to use byacc instead of bison, which should generate a portable
45ca0d3fbobrien   parser.  I played with adding "#define alloca dont_use_alloca", to
46ca0d3fbobrien   give an error if the parser generator uses alloca (and thus detect
47ca0d3fbobrien   unportable getdate.c's), but that seems to cause as many problems
48ca0d3fbobrien   as it solves.  */
49ca0d3fbobrien
500a322f4markm#include <time.h>
51ca0d3fbobrien
52ca0d3fbobrien#define yylex getdate_yylex
53ca0d3fbobrien#define yyerror getdate_yyerror
54ca0d3fbobrien
550a322f4markmstatic int yylex(void);
560a322f4markmstatic int yyerror(const char *);
570a322f4markm
58d09bdfeedtime_t get_date(char *);
59ca0d3fbobrien
60ca0d3fbobrien#define EPOCH		1970
61ca0d3fbobrien#define HOUR(x)		((time_t)(x) * 60)
62ca0d3fbobrien#define SECSPERDAY	(24L * 60L * 60L)
63ca0d3fbobrien
64ca0d3fbobrien
65ca0d3fbobrien/*
66ca0d3fbobrien**  An entry in the lexical lookup table.
67ca0d3fbobrien*/
68ca0d3fbobrientypedef struct _TABLE {
690a322f4markm    const char	*name;
70ca0d3fbobrien    int		type;
71ca0d3fbobrien    time_t	value;
72ca0d3fbobrien} TABLE;
73ca0d3fbobrien
74ca0d3fbobrien
75ca0d3fbobrien/*
76ca0d3fbobrien**  Daylight-savings mode:  on, off, or not yet known.
77ca0d3fbobrien*/
78ca0d3fbobrientypedef enum _DSTMODE {
79ca0d3fbobrien    DSTon, DSToff, DSTmaybe
80ca0d3fbobrien} DSTMODE;
81ca0d3fbobrien
82ca0d3fbobrien/*
83ca0d3fbobrien**  Meridian:  am, pm, or 24-hour style.
84ca0d3fbobrien*/
85ca0d3fbobrientypedef enum _MERIDIAN {
86ca0d3fbobrien    MERam, MERpm, MER24
87ca0d3fbobrien} MERIDIAN;
88ca0d3fbobrien
89ca0d3fbobrien
90ca0d3fbobrien/*
91ca0d3fbobrien**  Global variables.  We could get rid of most of these by using a good
92ca0d3fbobrien**  union as the yacc stack.  (This routine was originally written before
93ca0d3fbobrien**  yacc had the %union construct.)  Maybe someday; right now we only use
94ca0d3fbobrien**  the %union very rarely.
95ca0d3fbobrien*/
96ca0d3fbobrienstatic char	*yyInput;
97ca0d3fbobrienstatic DSTMODE	yyDSTmode;
98ca0d3fbobrienstatic time_t	yyDayOrdinal;
99ca0d3fbobrienstatic time_t	yyDayNumber;
100ca0d3fbobrienstatic int	yyHaveDate;
101ca0d3fbobrienstatic int	yyHaveDay;
102ca0d3fbobrienstatic int	yyHaveRel;
103ca0d3fbobrienstatic int	yyHaveTime;
104ca0d3fbobrienstatic int	yyHaveZone;
105ca0d3fbobrienstatic time_t	yyTimezone;
106ca0d3fbobrienstatic time_t	yyDay;
107ca0d3fbobrienstatic time_t	yyHour;
108ca0d3fbobrienstatic time_t	yyMinutes;
109ca0d3fbobrienstatic time_t	yyMonth;
110ca0d3fbobrienstatic time_t	yySeconds;
111ca0d3fbobrienstatic time_t	yyYear;
112ca0d3fbobrienstatic MERIDIAN	yyMeridian;
113ca0d3fbobrienstatic time_t	yyRelMonth;
114ca0d3fbobrienstatic time_t	yyRelSeconds;
115ca0d3fbobrien
116ca0d3fbobrien%}
117ca0d3fbobrien
118ca0d3fbobrien%union {
119ca0d3fbobrien    time_t		Number;
120ca0d3fbobrien    enum _MERIDIAN	Meridian;
121ca0d3fbobrien}
122ca0d3fbobrien
123ca0d3fbobrien%token	tAGO tDAY tDAYZONE tID tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
124ca0d3fbobrien%token	tSEC_UNIT tSNUMBER tUNUMBER tZONE tDST
125ca0d3fbobrien
126ca0d3fbobrien%type	<Number>	tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT
127ca0d3fbobrien%type	<Number>	tSEC_UNIT tSNUMBER tUNUMBER tZONE
128ca0d3fbobrien%type	<Meridian>	tMERIDIAN o_merid
129ca0d3fbobrien
130ca0d3fbobrien%%
131ca0d3fbobrien
132ca0d3fbobrienspec	: /* NULL */
133ca0d3fbobrien	| spec item
134ca0d3fbobrien	;
135ca0d3fbobrien
136ca0d3fbobrienitem	: time {
137ca0d3fbobrien	    yyHaveTime++;
138ca0d3fbobrien	}
139ca0d3fbobrien	| zone {
140ca0d3fbobrien	    yyHaveZone++;
141ca0d3fbobrien	}
142ca0d3fbobrien	| date {
143ca0d3fbobrien	    yyHaveDate++;
144ca0d3fbobrien	}
145ca0d3fbobrien	| day {
146ca0d3fbobrien	    yyHaveDay++;
147ca0d3fbobrien	}
148ca0d3fbobrien	| rel {
149ca0d3fbobrien	    yyHaveRel++;
150ca0d3fbobrien	}
151ca0d3fbobrien	| number
152ca0d3fbobrien	;
153ca0d3fbobrien
154ca0d3fbobrientime	: tUNUMBER tMERIDIAN {
155ca0d3fbobrien	    yyHour = $1;
156ca0d3fbobrien	    yyMinutes = 0;
157ca0d3fbobrien	    yySeconds = 0;
158ca0d3fbobrien	    yyMeridian = $2;
159ca0d3fbobrien	}
160ca0d3fbobrien	| tUNUMBER ':' tUNUMBER o_merid {
161ca0d3fbobrien	    yyHour = $1;
162ca0d3fbobrien	    yyMinutes = $3;
163ca0d3fbobrien	    yySeconds = 0;
164ca0d3fbobrien	    yyMeridian = $4;
165ca0d3fbobrien	}
166ca0d3fbobrien	| tUNUMBER ':' tUNUMBER tSNUMBER {
167ca0d3fbobrien	    yyHour = $1;
168ca0d3fbobrien	    yyMinutes = $3;
169ca0d3fbobrien	    yyMeridian = MER24;
170ca0d3fbobrien	    yyDSTmode = DSToff;
171ca0d3fbobrien	    yyTimezone = - ($4 % 100 + ($4 / 100) * 60);
172ca0d3fbobrien	}
173ca0d3fbobrien	| tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
174ca0d3fbobrien	    yyHour = $1;
175ca0d3fbobrien	    yyMinutes = $3;
176ca0d3fbobrien	    yySeconds = $5;
177ca0d3fbobrien	    yyMeridian = $6;
178ca0d3fbobrien	}
179ca0d3fbobrien	| tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
180ca0d3fbobrien	    yyHour = $1;
181ca0d3fbobrien	    yyMinutes = $3;
182ca0d3fbobrien	    yySeconds = $5;
183ca0d3fbobrien	    yyMeridian = MER24;
184ca0d3fbobrien	    yyDSTmode = DSToff;
185ca0d3fbobrien	    yyTimezone = - ($6 % 100 + ($6 / 100) * 60);
186ca0d3fbobrien	}
187ca0d3fbobrien	;
188ca0d3fbobrien
189ca0d3fbobrienzone	: tZONE {
190ca0d3fbobrien	    yyTimezone = $1;
191ca0d3fbobrien	    yyDSTmode = DSToff;
192ca0d3fbobrien	}
193ca0d3fbobrien	| tDAYZONE {
194ca0d3fbobrien	    yyTimezone = $1;
195ca0d3fbobrien	    yyDSTmode = DSTon;
196ca0d3fbobrien	}
197ca0d3fbobrien	|
198ca0d3fbobrien	  tZONE tDST {
199ca0d3fbobrien	    yyTimezone = $1;
200ca0d3fbobrien	    yyDSTmode = DSTon;
201ca0d3fbobrien	}
202ca0d3fbobrien	;
203ca0d3fbobrien
204ca0d3fbobrienday	: tDAY {
205ca0d3fbobrien	    yyDayOrdinal = 1;
206ca0d3fbobrien	    yyDayNumber = $1;
207ca0d3fbobrien	}
208ca0d3fbobrien	| tDAY ',' {
209ca0d3fbobrien	    yyDayOrdinal = 1;
210ca0d3fbobrien	    yyDayNumber = $1;
211ca0d3fbobrien	}
212ca0d3fbobrien	| tUNUMBER tDAY {
213ca0d3fbobrien	    yyDayOrdinal = $1;
214ca0d3fbobrien	    yyDayNumber = $2;
215ca0d3fbobrien	}
216ca0d3fbobrien	;
217ca0d3fbobrien
218ca0d3fbobriendate	: tUNUMBER '/' tUNUMBER {
219ca0d3fbobrien	    yyMonth = $1;
220ca0d3fbobrien	    yyDay = $3;
221ca0d3fbobrien	}
222ca0d3fbobrien	| tUNUMBER '/' tUNUMBER '/' tUNUMBER {
223ca0d3fbobrien	    if ($1 >= 100) {
224ca0d3fbobrien		yyYear = $1;
225ca0d3fbobrien		yyMonth = $3;
226ca0d3fbobrien		yyDay = $5;
227ca0d3fbobrien	    } else {
228ca0d3fbobrien		yyMonth = $1;
229ca0d3fbobrien		yyDay = $3;
230ca0d3fbobrien		yyYear = $5;
231ca0d3fbobrien	    }
232ca0d3fbobrien	}
233ca0d3fbobrien	| tUNUMBER tSNUMBER tSNUMBER {
234ca0d3fbobrien	    /* ISO 8601 format.  yyyy-mm-dd.  */
235ca0d3fbobrien	    yyYear = $1;
236ca0d3fbobrien	    yyMonth = -$2;
237ca0d3fbobrien	    yyDay = -$3;
238ca0d3fbobrien	}
239ca0d3fbobrien	| tUNUMBER tMONTH tSNUMBER {
240ca0d3fbobrien	    /* e.g. 17-JUN-1992.  */
241ca0d3fbobrien	    yyDay = $1;
242ca0d3fbobrien	    yyMonth = $2;
243ca0d3fbobrien	    yyYear = -$3;
244ca0d3fbobrien	}
245ca0d3fbobrien	| tMONTH tUNUMBER {
246ca0d3fbobrien	    yyMonth = $1;
247ca0d3fbobrien	    yyDay = $2;
248ca0d3fbobrien	}
249ca0d3fbobrien	| tMONTH tUNUMBER ',' tUNUMBER {
250ca0d3fbobrien	    yyMonth = $1;
251ca0d3fbobrien	    yyDay = $2;
252ca0d3fbobrien	    yyYear = $4;
253ca0d3fbobrien	}
254ca0d3fbobrien	| tUNUMBER tMONTH {
255ca0d3fbobrien	    yyMonth = $2;
256ca0d3fbobrien	    yyDay = $1;
257ca0d3fbobrien	}
258ca0d3fbobrien	| tUNUMBER tMONTH tUNUMBER {
259ca0d3fbobrien	    yyMonth = $2;
260ca0d3fbobrien	    yyDay = $1;
261ca0d3fbobrien	    yyYear = $3;
262ca0d3fbobrien	}
263ca0d3fbobrien	;
264ca0d3fbobrien
265ca0d3fbobrienrel	: relunit tAGO {
266ca0d3fbobrien	    yyRelSeconds = -yyRelSeconds;
267ca0d3fbobrien	    yyRelMonth = -yyRelMonth;
268ca0d3fbobrien	}
269ca0d3fbobrien	| relunit
270ca0d3fbobrien	;
271ca0d3fbobrien
272ca0d3fbobrienrelunit	: tUNUMBER tMINUTE_UNIT {
273ca0d3fbobrien	    yyRelSeconds += $1 * $2 * 60L;
274ca0d3fbobrien	}
275ca0d3fbobrien	| tSNUMBER tMINUTE_UNIT {
276ca0d3fbobrien	    yyRelSeconds += $1 * $2 * 60L;
277ca0d3fbobrien	}
278ca0d3fbobrien	| tMINUTE_UNIT {
279ca0d3fbobrien	    yyRelSeconds += $1 * 60L;
280ca0d3fbobrien	}
281ca0d3fbobrien	| tSNUMBER tSEC_UNIT {
282ca0d3fbobrien	    yyRelSeconds += $1;
283ca0d3fbobrien	}
284ca0d3fbobrien	| tUNUMBER tSEC_UNIT {
285ca0d3fbobrien	    yyRelSeconds += $1;
286ca0d3fbobrien	}
287ca0d3fbobrien	| tSEC_UNIT {
288ca0d3fbobrien	    yyRelSeconds++;
289ca0d3fbobrien	}
290ca0d3fbobrien	| tSNUMBER tMONTH_UNIT {
291ca0d3fbobrien	    yyRelMonth += $1 * $2;
292ca0d3fbobrien	}
293ca0d3fbobrien	| tUNUMBER tMONTH_UNIT {
294ca0d3fbobrien	    yyRelMonth += $1 * $2;
295ca0d3fbobrien	}
296ca0d3fbobrien	| tMONTH_UNIT {
297ca0d3fbobrien	    yyRelMonth += $1;
298ca0d3fbobrien	}
299ca0d3fbobrien	;
300ca0d3fbobrien
301ca0d3fbobriennumber	: tUNUMBER {
302ca0d3fbobrien	    if (yyHaveTime && yyHaveDate && !yyHaveRel)
303ca0d3fbobrien		yyYear = $1;
304ca0d3fbobrien	    else {
305ca0d3fbobrien		if($1>10000) {
306ca0d3fbobrien		    yyHaveDate++;
307ca0d3fbobrien		    yyDay= ($1)%100;
308ca0d3fbobrien		    yyMonth= ($1/100)%100;
309ca0d3fbobrien		    yyYear = $1/10000;
310ca0d3fbobrien		}
311ca0d3fbobrien		else {
312ca0d3fbobrien		    yyHaveTime++;
313ca0d3fbobrien		    if ($1 < 100) {
314ca0d3fbobrien			yyHour = $1;
315ca0d3fbobrien			yyMinutes = 0;
316ca0d3fbobrien		    }
317ca0d3fbobrien		    else {
318ca0d3fbobrien		    	yyHour = $1 / 100;
319ca0d3fbobrien		    	yyMinutes = $1 % 100;
320ca0d3fbobrien		    }
321ca0d3fbobrien		    yySeconds = 0;
322ca0d3fbobrien		    yyMeridian = MER24;
323ca0d3fbobrien	        }
324ca0d3fbobrien	    }
325ca0d3fbobrien	}
326ca0d3fbobrien	;
327ca0d3fbobrien
328ca0d3fbobrieno_merid	: /* NULL */ {
329ca0d3fbobrien	    $$ = MER24;
330ca0d3fbobrien	}
331ca0d3fbobrien	| tMERIDIAN {
332ca0d3fbobrien	    $$ = $1;
333ca0d3fbobrien	}
334ca0d3fbobrien	;
335ca0d3fbobrien
336ca0d3fbobrien%%
337ca0d3fbobrien
338ca0d3fbobrien/* Month and day table. */
339ca0d3fbobrienstatic TABLE const MonthDayTable[] = {
340ca0d3fbobrien    { "january",	tMONTH,  1 },
341ca0d3fbobrien    { "february",	tMONTH,  2 },
342ca0d3fbobrien    { "march",		tMONTH,  3 },
343ca0d3fbobrien    { "april",		tMONTH,  4 },
344ca0d3fbobrien    { "may",		tMONTH,  5 },
345ca0d3fbobrien    { "june",		tMONTH,  6 },
346ca0d3fbobrien    { "july",		tMONTH,  7 },
347ca0d3fbobrien    { "august",		tMONTH,  8 },
348ca0d3fbobrien    { "september",	tMONTH,  9 },
349ca0d3fbobrien    { "sept",		tMONTH,  9 },
350ca0d3fbobrien    { "october",	tMONTH, 10 },
351ca0d3fbobrien    { "november",	tMONTH, 11 },
352ca0d3fbobrien    { "december",	tMONTH, 12 },
353ca0d3fbobrien    { "sunday",		tDAY, 0 },
354ca0d3fbobrien    { "monday",		tDAY, 1 },
355ca0d3fbobrien    { "tuesday",	tDAY, 2 },
356ca0d3fbobrien    { "tues",		tDAY, 2 },
357ca0d3fbobrien    { "wednesday",	tDAY, 3 },
358ca0d3fbobrien    { "wednes",		tDAY, 3 },
359ca0d3fbobrien    { "thursday",	tDAY, 4 },
360ca0d3fbobrien    { "thur",		tDAY, 4 },
361ca0d3fbobrien    { "thurs",		tDAY, 4 },
362ca0d3fbobrien    { "friday",		tDAY, 5 },
363ca0d3fbobrien    { "saturday",	tDAY, 6 },
3640a322f4markm    { NULL,		0, 0 }
365ca0d3fbobrien};
366ca0d3fbobrien
367ca0d3fbobrien/* Time units table. */
368ca0d3fbobrienstatic TABLE const UnitsTable[] = {
369ca0d3fbobrien    { "year",		tMONTH_UNIT,	12 },
370ca0d3fbobrien    { "month",		tMONTH_UNIT,	1 },
371ca0d3fbobrien    { "fortnight",	tMINUTE_UNIT,	14 * 24 * 60 },
372ca0d3fbobrien    { "week",		tMINUTE_UNIT,	7 * 24 * 60 },
373ca0d3fbobrien    { "day",		tMINUTE_UNIT,	1 * 24 * 60 },
374ca0d3fbobrien    { "hour",		tMINUTE_UNIT,	60 },
375ca0d3fbobrien    { "minute",		tMINUTE_UNIT,	1 },
376ca0d3fbobrien    { "min",		tMINUTE_UNIT,	1 },
377ca0d3fbobrien    { "second",		tSEC_UNIT,	1 },
378ca0d3fbobrien    { "sec",		tSEC_UNIT,	1 },
3790a322f4markm    { NULL,		0,		0 }
380ca0d3fbobrien};
381ca0d3fbobrien
382ca0d3fbobrien/* Assorted relative-time words. */
383ca0d3fbobrienstatic TABLE const OtherTable[] = {
384ca0d3fbobrien    { "tomorrow",	tMINUTE_UNIT,	1 * 24 * 60 },
385ca0d3fbobrien    { "yesterday",	tMINUTE_UNIT,	-1 * 24 * 60 },
386ca0d3fbobrien    { "today",		tMINUTE_UNIT,	0 },
387ca0d3fbobrien    { "now",		tMINUTE_UNIT,	0 },
388ca0d3fbobrien    { "last",		tUNUMBER,	-1 },
389ca0d3fbobrien    { "this",		tMINUTE_UNIT,	0 },
390ca0d3fbobrien    { "next",		tUNUMBER,	2 },
391ca0d3fbobrien    { "first",		tUNUMBER,	1 },
392ca0d3fbobrien/*  { "second",		tUNUMBER,	2 }, */
393ca0d3fbobrien    { "third",		tUNUMBER,	3 },
394ca0d3fbobrien    { "fourth",		tUNUMBER,	4 },
395ca0d3fbobrien    { "fifth",		tUNUMBER,	5 },
396ca0d3fbobrien    { "sixth",		tUNUMBER,	6 },
397ca0d3fbobrien    { "seventh",	tUNUMBER,	7 },
398ca0d3fbobrien    { "eighth",		tUNUMBER,	8 },
399ca0d3fbobrien    { "ninth",		tUNUMBER,	9 },
400ca0d3fbobrien    { "tenth",		tUNUMBER,	10 },
401ca0d3fbobrien    { "eleventh",	tUNUMBER,	11 },
402ca0d3fbobrien    { "twelfth",	tUNUMBER,	12 },
4030a322f4markm    { "ago",		tAGO,		1 },
4040a322f4markm    { NULL,		0,		0 }
405ca0d3fbobrien};
406ca0d3fbobrien
407ca0d3fbobrien/* The timezone table. */
408ca0d3fbobrien/* Some of these are commented out because a time_t can't store a float. */
409ca0d3fbobrienstatic TABLE const TimezoneTable[] = {
410ca0d3fbobrien    { "gmt",	tZONE,     HOUR( 0) },	/* Greenwich Mean */
411ca0d3fbobrien    { "ut",	tZONE,     HOUR( 0) },	/* Universal (Coordinated) */
412ca0d3fbobrien    { "utc",	tZONE,     HOUR( 0) },
413ca0d3fbobrien    { "wet",	tZONE,     HOUR( 0) },	/* Western European */
414ca0d3fbobrien    { "bst",	tDAYZONE,  HOUR( 0) },	/* British Summer */
415ca0d3fbobrien    { "wat",	tZONE,     HOUR( 1) },	/* West Africa */
416ca0d3fbobrien    { "at",	tZONE,     HOUR( 2) },	/* Azores */
417ca0d3fbobrien#if	0
418ca0d3fbobrien    /* For completeness.  BST is also British Summer, and GST is
419ca0d3fbobrien     * also Guam Standard. */
420ca0d3fbobrien    { "bst",	tZONE,     HOUR( 3) },	/* Brazil Standard */
421ca0d3fbobrien    { "gst",	tZONE,     HOUR( 3) },	/* Greenland Standard */
422ca0d3fbobrien#endif
423ca0d3fbobrien#if 0
424ca0d3fbobrien    { "nft",	tZONE,     HOUR(3.5) },	/* Newfoundland */
425ca0d3fbobrien    { "nst",	tZONE,     HOUR(3.5) },	/* Newfoundland Standard */
426ca0d3fbobrien    { "ndt",	tDAYZONE,  HOUR(3.5) },	/* Newfoundland Daylight */
427ca0d3fbobrien#endif
428ca0d3fbobrien    { "ast",	tZONE,     HOUR( 4) },	/* Atlantic Standard */
429ca0d3fbobrien    { "adt",	tDAYZONE,  HOUR( 4) },	/* Atlantic Daylight */
430ca0d3fbobrien    { "est",	tZONE,     HOUR( 5) },	/* Eastern Standard */
431ca0d3fbobrien    { "edt",	tDAYZONE,  HOUR( 5) },	/* Eastern Daylight */
432ca0d3fbobrien    { "cst",	tZONE,     HOUR( 6) },	/* Central Standard */
433ca0d3fbobrien    { "cdt",	tDAYZONE,  HOUR( 6) },	/* Central Daylight */
434ca0d3fbobrien    { "mst",	tZONE,     HOUR( 7) },	/* Mountain Standard */
435ca0d3fbobrien    { "mdt",	tDAYZONE,  HOUR( 7) },	/* Mountain Daylight */
436ca0d3fbobrien    { "pst",	tZONE,     HOUR( 8) },	/* Pacific Standard */
437ca0d3fbobrien    { "pdt",	tDAYZONE,  HOUR( 8) },	/* Pacific Daylight */
438ca0d3fbobrien    { "yst",	tZONE,     HOUR( 9) },	/* Yukon Standard */
439ca0d3fbobrien    { "ydt",	tDAYZONE,  HOUR( 9) },	/* Yukon Daylight */
440ca0d3fbobrien    { "hst",	tZONE,     HOUR(10) },	/* Hawaii Standard */
441ca0d3fbobrien    { "hdt",	tDAYZONE,  HOUR(10) },	/* Hawaii Daylight */
442ca0d3fbobrien    { "cat",	tZONE,     HOUR(10) },	/* Central Alaska */
443ca0d3fbobrien    { "ahst",	tZONE,     HOUR(10) },	/* Alaska-Hawaii Standard */
444ca0d3fbobrien    { "nt",	tZONE,     HOUR(11) },	/* Nome */
445ca0d3fbobrien    { "idlw",	tZONE,     HOUR(12) },	/* International Date Line West */
446ca0d3fbobrien    { "cet",	tZONE,     -HOUR(1) },	/* Central European */
447ca0d3fbobrien    { "met",	tZONE,     -HOUR(1) },	/* Middle European */
448ca0d3fbobrien    { "mewt",	tZONE,     -HOUR(1) },	/* Middle European Winter */
449ca0d3fbobrien    { "mest",	tDAYZONE,  -HOUR(1) },	/* Middle European Summer */
450ca0d3fbobrien    { "swt",	tZONE,     -HOUR(1) },	/* Swedish Winter */
451ca0d3fbobrien    { "sst",	tDAYZONE,  -HOUR(1) },	/* Swedish Summer */
452ca0d3fbobrien    { "fwt",	tZONE,     -HOUR(1) },	/* French Winter */
453ca0d3fbobrien    { "fst",	tDAYZONE,  -HOUR(1) },	/* French Summer */
454ca0d3fbobrien    { "eet",	tZONE,     -HOUR(2) },	/* Eastern Europe, USSR Zone 1 */
455ca0d3fbobrien    { "bt",	tZONE,     -HOUR(3) },	/* Baghdad, USSR Zone 2 */
456ca0d3fbobrien#if 0
457ca0d3fbobrien    { "it",	tZONE,     -HOUR(3.5) },/* Iran */
458ca0d3fbobrien#endif
459ca0d3fbobrien    { "zp4",	tZONE,     -HOUR(4) },	/* USSR Zone 3 */
460ca0d3fbobrien    { "zp5",	tZONE,     -HOUR(5) },	/* USSR Zone 4 */
461ca0d3fbobrien#if 0
462ca0d3fbobrien    { "ist",	tZONE,     -HOUR(5.5) },/* Indian Standard */
463ca0d3fbobrien#endif
464ca0d3fbobrien    { "zp6",	tZONE,     -HOUR(6) },	/* USSR Zone 5 */
465ca0d3fbobrien#if	0
466ca0d3fbobrien    /* For completeness.  NST is also Newfoundland Stanard, and SST is
467ca0d3fbobrien     * also Swedish Summer. */
468ca0d3fbobrien    { "nst",	tZONE,     -HOUR(6.5) },/* North Sumatra */
469ca0d3fbobrien    { "sst",	tZONE,     -HOUR(7) },	/* South Sumatra, USSR Zone 6 */
470ca0d3fbobrien#endif	/* 0 */
471ca0d3fbobrien    { "wast",	tZONE,     -HOUR(7) },	/* West Australian Standard */
472ca0d3fbobrien    { "wadt",	tDAYZONE,  -HOUR(7) },	/* West Australian Daylight */
473ca0d3fbobrien#if 0
474ca0d3fbobrien    { "jt",	tZONE,     -HOUR(7.5) },/* Java (3pm in Cronusland!) */
475ca0d3fbobrien#endif
476ca0d3fbobrien    { "cct",	tZONE,     -HOUR(8) },	/* China Coast, USSR Zone 7 */
477ca0d3fbobrien    { "jst",	tZONE,     -HOUR(9) },	/* Japan Standard, USSR Zone 8 */
478ca0d3fbobrien#if 0
479ca0d3fbobrien    { "cast",	tZONE,     -HOUR(9.5) },/* Central Australian Standard */
480ca0d3fbobrien    { "cadt",	tDAYZONE,  -HOUR(9.5) },/* Central Australian Daylight */
481ca0d3fbobrien#endif
482ca0d3fbobrien    { "east",	tZONE,     -HOUR(10) },	/* Eastern Australian Standard */
483ca0d3fbobrien    { "eadt",	tDAYZONE,  -HOUR(10) },	/* Eastern Australian Daylight */
484ca0d3fbobrien    { "gst",	tZONE,     -HOUR(10) },	/* Guam Standard, USSR Zone 9 */
485ca0d3fbobrien    { "nzt",	tZONE,     -HOUR(12) },	/* New Zealand */
486ca0d3fbobrien    { "nzst",	tZONE,     -HOUR(12) },	/* New Zealand Standard */
487ca0d3fbobrien    { "nzdt",	tDAYZONE,  -HOUR(12) },	/* New Zealand Daylight */
488ca0d3fbobrien    { "idle",	tZONE,     -HOUR(12) },	/* International Date Line East */
4890a322f4markm    {  NULL,	0,	   0 }
490ca0d3fbobrien};
491ca0d3fbobrien
492ca0d3fbobrien/* Military timezone table. */
493ca0d3fbobrienstatic TABLE const MilitaryTable[] = {
494ca0d3fbobrien    { "a",	tZONE,	HOUR(  1) },
495ca0d3fbobrien    { "b",	tZONE,	HOUR(  2) },
496ca0d3fbobrien    { "c",	tZONE,	HOUR(  3) },
497ca0d3fbobrien    { "d",	tZONE,	HOUR(  4) },
498ca0d3fbobrien    { "e",	tZONE,	HOUR(  5) },
499ca0d3fbobrien    { "f",	tZONE,	HOUR(  6) },
500ca0d3fbobrien    { "g",	tZONE,	HOUR(  7) },
501ca0d3fbobrien    { "h",	tZONE,	HOUR(  8) },
502ca0d3fbobrien    { "i",	tZONE,	HOUR(  9) },
503ca0d3fbobrien    { "k",	tZONE,	HOUR( 10) },
504ca0d3fbobrien    { "l",	tZONE,	HOUR( 11) },
505ca0d3fbobrien    { "m",	tZONE,	HOUR( 12) },
506ca0d3fbobrien    { "n",	tZONE,	HOUR(- 1) },
507ca0d3fbobrien    { "o",	tZONE,	HOUR(- 2) },
508ca0d3fbobrien    { "p",	tZONE,	HOUR(- 3) },
509ca0d3fbobrien    { "q",	tZONE,	HOUR(- 4) },
510ca0d3fbobrien    { "r",	tZONE,	HOUR(- 5) },
511ca0d3fbobrien    { "s",	tZONE,	HOUR(- 6) },
512