Fix typo for default units for timespan input.

Place single-ticks around bad argument in elog messages.
Fix tabbing of large lookup tables (ugh).
This commit is contained in:
Thomas G. Lockhart 1997-09-20 16:20:29 +00:00
parent fbf12681ab
commit cc8dc825d8
1 changed files with 223 additions and 240 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.40 1997/09/08 21:48:23 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.41 1997/09/20 16:20:29 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -115,7 +115,7 @@ datetime_in(char *str)
if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0) if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
|| (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz) != 0)) || (DecodeDateTime(field, ftype, nf, &dtype, tm, &fsec, &tz) != 0))
elog(WARN, "Bad datetime external representation %s", str); elog(WARN, "Bad datetime external representation '%s'", str);
result = PALLOCTYPE(DateTime); result = PALLOCTYPE(DateTime);
@ -123,7 +123,7 @@ datetime_in(char *str)
{ {
case DTK_DATE: case DTK_DATE:
if (tm2datetime(tm, fsec, &tz, result) != 0) if (tm2datetime(tm, fsec, &tz, result) != 0)
elog(WARN, "Datetime out of range %s", str); elog(WARN, "Datetime out of range '%s'", str);
#ifdef DATEDEBUG #ifdef DATEDEBUG
printf("datetime_in- date is %f\n", *result); printf("datetime_in- date is %f\n", *result);
@ -243,7 +243,7 @@ timespan_in(char *str)
#if FALSE #if FALSE
TIMESPAN_INVALID(span); TIMESPAN_INVALID(span);
#endif #endif
elog(WARN, "Bad timespan external representation %s", str); elog(WARN, "Bad timespan external representation '%s'", str);
} }
break; break;
@ -1488,7 +1488,7 @@ datetime_trunc(text *units, DateTime *datetime)
break; break;
default: default:
elog(WARN, "Datetime units %s not supported", lowunits); elog(WARN, "Datetime units '%s' not supported", lowunits);
result = NULL; result = NULL;
} }
@ -1521,7 +1521,7 @@ datetime_trunc(text *units, DateTime *datetime)
} }
if (tm2datetime(tm, fsec, &tz, result) != 0) if (tm2datetime(tm, fsec, &tz, result) != 0)
elog(WARN, "Unable to truncate datetime to %s", lowunits); elog(WARN, "Unable to truncate datetime to '%s'", lowunits);
#if FALSE #if FALSE
} }
@ -1534,7 +1534,7 @@ datetime_trunc(text *units, DateTime *datetime)
} }
else else
{ {
elog(WARN, "Datetime units %s not recognized", lowunits); elog(WARN, "Datetime units '%s' not recognized", lowunits);
result = NULL; result = NULL;
} }
} }
@ -1631,12 +1631,12 @@ timespan_trunc(text *units, TimeSpan *timespan)
break; break;
default: default:
elog(WARN, "Timespan units %s not supported", lowunits); elog(WARN, "Timespan units '%s' not supported", lowunits);
result = NULL; result = NULL;
} }
if (tm2timespan(tm, fsec, result) != 0) if (tm2timespan(tm, fsec, result) != 0)
elog(WARN, "Unable to truncate timespan to %s", lowunits); elog(WARN, "Unable to truncate timespan to '%s'", lowunits);
} }
else else
@ -1660,7 +1660,7 @@ timespan_trunc(text *units, TimeSpan *timespan)
} }
else else
{ {
elog(WARN, "Timespan units %s not recognized", units); elog(WARN, "Timespan units '%s' not recognized", units);
result = NULL; result = NULL;
} }
@ -1782,7 +1782,7 @@ datetime_part(text *units, DateTime *datetime)
break; break;
default: default:
elog(WARN, "Datetime units %s not supported", lowunits); elog(WARN, "Datetime units '%s' not supported", lowunits);
*result = 0; *result = 0;
} }
@ -1804,14 +1804,14 @@ datetime_part(text *units, DateTime *datetime)
break; break;
default: default:
elog(WARN, "Datetime units %s not supported", lowunits); elog(WARN, "Datetime units '%s' not supported", lowunits);
*result = 0; *result = 0;
} }
} }
else else
{ {
elog(WARN, "Datetime units %s not recognized", lowunits); elog(WARN, "Datetime units '%s' not recognized", lowunits);
*result = 0; *result = 0;
} }
} }
@ -1925,7 +1925,7 @@ timespan_part(text *units, TimeSpan *timespan)
break; break;
default: default:
elog(WARN, "Timespan units %s not yet supported", units); elog(WARN, "Timespan units '%s' not yet supported", units);
result = NULL; result = NULL;
} }
@ -1949,7 +1949,7 @@ timespan_part(text *units, TimeSpan *timespan)
} }
else else
{ {
elog(WARN, "Timespan units %s not recognized", units); elog(WARN, "Timespan units '%s' not recognized", units);
*result = 0; *result = 0;
} }
@ -2039,7 +2039,7 @@ datetime_zone(text *zone, DateTime *datetime)
} }
else else
{ {
elog(WARN, "Time zone %s not recognized", lowzone); elog(WARN, "Time zone '%s' not recognized", lowzone);
result = NULL; result = NULL;
} }
@ -2066,237 +2066,221 @@ datetime_zone(text *zone, DateTime *datetime)
*/ */
static datetkn datetktbl[] = { static datetkn datetktbl[] = {
/* text token lexval */ /* text token lexval */
{EARLY, RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */ {EARLY, RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */
{"acsst", DTZ, 63}, /* Cent. Australia */ {"acsst", DTZ, 63}, /* Cent. Australia */
{"acst", TZ, 57}, /* Cent. Australia */ {"acst", TZ, 57}, /* Cent. Australia */
{DA_D, ADBC, AD}, /* "ad" for years >= 0 */ {DA_D, ADBC, AD}, /* "ad" for years >= 0 */
{"abstime", IGNORE, 0}, /* "abstime" for pre-v6.1 "Invalid {"abstime", IGNORE, 0}, /* "abstime" for pre-v6.1 "Invalid Abstime" */
* Abstime" */ {"adt", DTZ, NEG(18)}, /* Atlantic Daylight Time */
{"adt", DTZ, NEG(18)}, /* Atlantic Daylight Time */ {"aesst", DTZ, 66}, /* E. Australia */
{"aesst", DTZ, 66}, /* E. Australia */ {"aest", TZ, 60}, /* Australia Eastern Std Time */
{"aest", TZ, 60}, /* Australia Eastern Std Time */ {"ahst", TZ, 60}, /* Alaska-Hawaii Std Time */
{"ahst", TZ, 60}, /* Alaska-Hawaii Std Time */ {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */
{"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */ {"am", AMPM, AM},
{"am", AMPM, AM}, {"apr", MONTH, 4},
{"apr", MONTH, 4}, {"april", MONTH, 4},
{"april", MONTH, 4}, {"ast", TZ, NEG(24)}, /* Atlantic Std Time (Canada) */
{"ast", TZ, NEG(24)}, /* Atlantic Std Time (Canada) */ {"at", IGNORE, 0}, /* "at" (throwaway) */
{"at", IGNORE, 0}, /* "at" (throwaway) */ {"aug", MONTH, 8},
{"aug", MONTH, 8}, {"august", MONTH, 8},
{"august", MONTH, 8}, {"awsst", DTZ, 54}, /* W. Australia */
{"awsst", DTZ, 54}, /* W. Australia */ {"awst", TZ, 48}, /* W. Australia */
{"awst", TZ, 48}, /* W. Australia */ {DB_C, ADBC, BC}, /* "bc" for years < 0 */
{DB_C, ADBC, BC}, /* "bc" for years < 0 */ {"bst", TZ, 6}, /* British Summer Time */
{"bst", TZ, 6}, /* British Summer Time */ {"bt", TZ, 18}, /* Baghdad Time */
{"bt", TZ, 18}, /* Baghdad Time */ {"cadt", DTZ, 63}, /* Central Australian DST */
{"cadt", DTZ, 63}, /* Central Australian DST */ {"cast", TZ, 57}, /* Central Australian ST */
{"cast", TZ, 57}, /* Central Australian ST */ {"cat", TZ, NEG(60)}, /* Central Alaska Time */
{"cat", TZ, NEG(60)}, /* Central Alaska Time */ {"cct", TZ, 48}, /* China Coast */
{"cct", TZ, 48}, /* China Coast */ {"cdt", DTZ, NEG(30)}, /* Central Daylight Time */
{"cdt", DTZ, NEG(30)}, /* Central Daylight Time */ {"cet", TZ, 6}, /* Central European Time */
{"cet", TZ, 6}, /* Central European Time */ {"cetdst", DTZ, 12}, /* Central European Dayl.Time */
{"cetdst", DTZ, 12}, /* Central European Dayl.Time */ {"cst", TZ, NEG(36)}, /* Central Standard Time */
{"cst", TZ, NEG(36)}, /* Central Standard Time */ {DCURRENT, RESERV, DTK_CURRENT}, /* "current" is always now */
{DCURRENT, RESERV, DTK_CURRENT}, /* "current" is always now */ {"dec", MONTH, 12},
{"dec", MONTH, 12}, {"december", MONTH, 12},
{"december", MONTH, 12}, {"dnt", TZ, 6}, /* Dansk Normal Tid */
{"dnt", TZ, 6}, /* Dansk Normal Tid */ {"dow", RESERV, DTK_DOW}, /* day of week */
{"dow", RESERV, DTK_DOW}, /* day of week */ {"dst", DTZMOD, 6},
{"dst", DTZMOD, 6}, {"east", TZ, NEG(60)}, /* East Australian Std Time */
{"east", TZ, NEG(60)}, /* East Australian Std Time */ {"edt", DTZ, NEG(24)}, /* Eastern Daylight Time */
{"edt", DTZ, NEG(24)}, /* Eastern Daylight Time */ {"eet", TZ, 12}, /* East. Europe, USSR Zone 1 */
{"eet", TZ, 12}, /* East. Europe, USSR Zone 1 */ {"eetdst", DTZ, 18}, /* Eastern Europe */
{"eetdst", DTZ, 18}, /* Eastern Europe */ {EPOCH, RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
{EPOCH, RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
#if USE_AUSTRALIAN_RULES #if USE_AUSTRALIAN_RULES
{"est", TZ, 60}, /* Australia Eastern Std Time */ {"est", TZ, 60}, /* Australia Eastern Std Time */
#else #else
{"est", TZ, NEG(30)}, /* Eastern Standard Time */ {"est", TZ, NEG(30)}, /* Eastern Standard Time */
#endif #endif
{"feb", MONTH, 2}, {"feb", MONTH, 2},
{"february", MONTH, 2}, {"february", MONTH, 2},
{"fri", DOW, 5}, {"fri", DOW, 5},
{"friday", DOW, 5}, {"friday", DOW, 5},
{"fst", TZ, 6}, /* French Summer Time */ {"fst", TZ, 6}, /* French Summer Time */
{"fwt", DTZ, 12}, /* French Winter Time */ {"fwt", DTZ, 12}, /* French Winter Time */
{"gmt", TZ, 0}, /* Greenwish Mean Time */ {"gmt", TZ, 0}, /* Greenwish Mean Time */
{"gst", TZ, 60}, /* Guam Std Time, USSR Zone 9 */ {"gst", TZ, 60}, /* Guam Std Time, USSR Zone 9 */
{"hdt", DTZ, NEG(54)}, /* Hawaii/Alaska */ {"hdt", DTZ, NEG(54)}, /* Hawaii/Alaska */
{"hmt", DTZ, 18}, /* Hellas ? ? */ {"hmt", DTZ, 18}, /* Hellas ? ? */
{"hst", TZ, NEG(60)}, /* Hawaii Std Time */ {"hst", TZ, NEG(60)}, /* Hawaii Std Time */
{"idle", TZ, 72}, /* Intl. Date Line, East */ {"idle", TZ, 72}, /* Intl. Date Line, East */
{"idlw", TZ, NEG(72)}, /* Intl. Date Line, West */ {"idlw", TZ, NEG(72)}, /* Intl. Date Line,, est */
{LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */ {LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */
{INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid time */
* time */ {"ist", TZ, 12}, /* Israel */
{"ist", TZ, 12}, /* Israel */ {"it", TZ, 22}, /* Iran Time */
{"it", TZ, 22}, /* Iran Time */ {"jan", MONTH, 1},
{"jan", MONTH, 1}, {"january", MONTH, 1},
{"january", MONTH, 1}, {"jst", TZ, 54}, /* Japan Std Time,USSR Zone 8 */
{"jst", TZ, 54}, /* Japan Std Time,USSR Zone 8 */ {"jt", TZ, 45}, /* Java Time */
{"jt", TZ, 45}, /* Java Time */ {"jul", MONTH, 7},
{"jul", MONTH, 7}, {"july", MONTH, 7},
{"july", MONTH, 7}, {"jun", MONTH, 6},
{"jun", MONTH, 6}, {"june", MONTH, 6},
{"june", MONTH, 6}, {"kst", TZ, 54}, /* Korea Standard Time */
{"kst", TZ, 54}, /* Korea Standard Time */ {"ligt", TZ, 60}, /* From Melbourne, Australia */
{"ligt", TZ, 60}, /* From Melbourne, Australia */ {"mar", MONTH, 3},
{"mar", MONTH, 3}, {"march", MONTH, 3},
{"march", MONTH, 3}, {"may", MONTH, 5},
{"may", MONTH, 5}, {"mdt", DTZ, NEG(36)}, /* Mountain Daylight Time */
{"mdt", DTZ, NEG(36)}, /* Mountain Daylight Time */ {"mest", DTZ, 12}, /* Middle Europe Summer Time */
{"mest", DTZ, 12}, /* Middle Europe Summer Time */ {"met", TZ, 6}, /* Middle Europe Time */
{"met", TZ, 6}, /* Middle Europe Time */ {"metdst", DTZ, 12}, /* Middle Europe Daylight Time */
{"metdst", DTZ, 12}, /* Middle Europe Daylight Time */ {"mewt", TZ, 6}, /* Middle Europe Winter Time */
{"mewt", TZ, 6}, /* Middle Europe Winter Time */ {"mez", TZ, 6}, /* Middle Europe Zone */
{"mez", TZ, 6}, /* Middle Europe Zone */ {"mon", DOW, 1},
{"mon", DOW, 1}, {"monday", DOW, 1},
{"monday", DOW, 1}, {"mst", TZ, NEG(42)}, /* Mountain Standard Time */
{"mst", TZ, NEG(42)}, /* Mountain Standard Time */ {"mt", TZ, 51}, /* Moluccas Time */
{"mt", TZ, 51}, /* Moluccas Time */ {"ndt", DTZ, NEG(15)}, /* Nfld. Daylight Time */
{"ndt", DTZ, NEG(15)}, /* Nfld. Daylight Time */ {"nft", TZ, NEG(21)}, /* Newfoundland Standard Time */
{"nft", TZ, NEG(21)}, /* Newfoundland Standard Time */ {"nor", TZ, 6}, /* Norway Standard Time */
{"nor", TZ, 6}, /* Norway Standard Time */ {"nov", MONTH, 11},
{"nov", MONTH, 11}, {"november", MONTH, 11},
{"november", MONTH, 11}, {NOW, RESERV, DTK_NOW}, /* current transaction time */
{NOW, RESERV, DTK_NOW}, /* current transaction time */ {"nst", TZ, NEG(21)}, /* Nfld. Standard Time */
{"nst", TZ, NEG(21)}, /* Nfld. Standard Time */ {"nt", TZ, NEG(66)}, /* Nome Time */
{"nt", TZ, NEG(66)}, /* Nome Time */ {"nzdt", DTZ, 78}, /* New Zealand Daylight Time */
{"nzdt", DTZ, 78}, /* New Zealand Daylight Time */ {"nzst", TZ, 72}, /* New Zealand Standard Time */
{"nzst", TZ, 72}, /* New Zealand Standard Time */ {"nzt", TZ, 72}, /* New Zealand Time */
{"nzt", TZ, 72}, /* New Zealand Time */ {"oct", MONTH, 10},
{"oct", MONTH, 10}, {"october", MONTH, 10},
{"october", MONTH, 10}, {"on", IGNORE, 0}, /* "on" (throwaway) */
{"on", IGNORE, 0}, /* "on" (throwaway) */ {"pdt", DTZ, NEG(42)}, /* Pacific Daylight Time */
{"pdt", DTZ, NEG(42)}, /* Pacific Daylight Time */ {"pm", AMPM, PM},
{"pm", AMPM, PM}, {"pst", TZ, NEG(48)}, /* Pacific Standard Time */
{"pst", TZ, NEG(48)}, /* Pacific Standard Time */ {"sadt", DTZ, 63}, /* S. Australian Dayl. Time */
{"sadt", DTZ, 63}, /* S. Australian Dayl. Time */ {"sast", TZ, 57}, /* South Australian Std Time */
{"sast", TZ, 57}, /* South Australian Std Time */ {"sat", DOW, 6},
{"sat", DOW, 6}, {"saturday", DOW, 6},
{"saturday", DOW, 6}, {"sep", MONTH, 9},
{"sep", MONTH, 9}, {"sept", MONTH, 9},
{"sept", MONTH, 9}, {"september", MONTH, 9},
{"september", MONTH, 9}, {"set", TZ, NEG(6)}, /* Seychelles Time ?? */
{"set", TZ, NEG(6)}, /* Seychelles Time ?? */ {"sst", DTZ, 12}, /* Swedish Summer Time */
{"sst", DTZ, 12}, /* Swedish Summer Time */ {"sun", DOW, 0},
{"sun", DOW, 0}, {"sunday", DOW, 0},
{"sunday", DOW, 0}, {"swt", TZ, 6}, /* Swedish Winter Time */
{"swt", TZ, 6}, /* Swedish Winter Time */ {"thu", DOW, 4},
{"thu", DOW, 4}, {"thur", DOW, 4},
{"thur", DOW, 4}, {"thurs", DOW, 4},
{"thurs", DOW, 4}, {"thursday", DOW, 4},
{"thursday", DOW, 4}, {TODAY, RESERV, DTK_TODAY}, /* midnight */
{TODAY, RESERV, DTK_TODAY}, /* midnight */ {TOMORROW, RESERV, DTK_TOMORROW}, /* tomorrow midnight */
{TOMORROW, RESERV, DTK_TOMORROW}, /* tomorrow midnight */ {"tue", DOW, 2},
{"tue", DOW, 2}, {"tues", DOW, 2},
{"tues", DOW, 2}, {"tuesday", DOW, 2},
{"tuesday", DOW, 2}, {"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid time */
{"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid {"ut", TZ, 0},
* time */ {"utc", TZ, 0},
{"ut", TZ, 0}, {"wadt", DTZ, 48}, /* West Australian DST */
{"utc", TZ, 0}, {"wast", TZ, 42}, /* West Australian Std Time */
{"wadt", DTZ, 48}, /* West Australian DST */ {"wat", TZ, NEG(6)}, /* West Africa Time */
{"wast", TZ, 42}, /* West Australian Std Time */ {"wdt", DTZ, 54}, /* West Australian DST */
{"wat", TZ, NEG(6)}, /* West Africa Time */ {"wed", DOW, 3},
{"wdt", DTZ, 54}, /* West Australian DST */ {"wednesday", DOW, 3},
{"wed", DOW, 3}, {"weds", DOW, 3},
{"wednesday", DOW, 3}, {"wet", TZ, 0}, /* Western Europe */
{"weds", DOW, 3}, {"wetdst", DTZ, 6}, /* Western Europe */
{"wet", TZ, 0}, /* Western Europe */ {"wst", TZ, 48}, /* West Australian Std Time */
{"wetdst", DTZ, 6}, /* Western Europe */ {"ydt", DTZ, NEG(48)}, /* Yukon Daylight Time */
{"wst", TZ, 48}, /* West Australian Std Time */ {YESTERDAY, RESERV, DTK_YESTERDAY}, /* yesterday midnight */
{"ydt", DTZ, NEG(48)}, /* Yukon Daylight Time */ {"yst", TZ, NEG(54)}, /* Yukon Standard Time */
{YESTERDAY, RESERV, DTK_YESTERDAY}, /* yesterday midnight */ {"zp4", TZ, NEG(24)}, /* GMT +4 hours. */
{"yst", TZ, NEG(54)}, /* Yukon Standard Time */ {"zp5", TZ, NEG(30)}, /* GMT +5 hours. */
{"zp4", TZ, NEG(24)}, /* GMT +4 hours. */ {"zp6", TZ, NEG(36)}, /* GMT +6 hours. */
{"zp5", TZ, NEG(30)}, /* GMT +5 hours. */ {"z", RESERV, DTK_ZULU}, /* 00:00:00 */
{"zp6", TZ, NEG(36)}, /* GMT +6 hours. */ {ZULU, RESERV, DTK_ZULU}, /* 00:00:00 */
{"z", RESERV, DTK_ZULU}, /* 00:00:00 */
{ZULU, RESERV, DTK_ZULU}, /* 00:00:00 */
}; };
static unsigned int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0]; static unsigned int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0];
static datetkn deltatktbl[] = { static datetkn deltatktbl[] = {
/* text token lexval */ /* text token lexval */
{"@", IGNORE, 0}, /* postgres relative time prefix */ {"@", IGNORE, 0}, /* postgres relative time prefix */
{DAGO, AGO, 0}, /* "ago" indicates negative time offset */ {DAGO, AGO, 0}, /* "ago" indicates negative time offset */
{"c", UNITS, DTK_CENTURY}, /* "century" relative time units */ {"c", UNITS, DTK_CENTURY}, /* "century" relative time units */
{"cent", UNITS, DTK_CENTURY}, /* "century" relative time units */ {"cent", UNITS, DTK_CENTURY}, /* "century" relative time units */
{"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative time units */ {"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative time units */
{DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative time units */ {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative time units */
{"d", UNITS, DTK_DAY}, /* "day" relative time units */ {"d", UNITS, DTK_DAY}, /* "day" relative time units */
{DDAY, UNITS, DTK_DAY}, /* "day" relative time units */ {DDAY, UNITS, DTK_DAY}, /* "day" relative time units */
{"days", UNITS, DTK_DAY}, /* "days" relative time units */ {"days", UNITS, DTK_DAY}, /* "days" relative time units */
{"dec", UNITS, DTK_DECADE}, /* "decade" relative time units */ {"dec", UNITS, DTK_DECADE}, /* "decade" relative time units */
{"decs", UNITS, DTK_DECADE},/* "decades" relative time units */ {"decs", UNITS, DTK_DECADE}, /* "decades" relative time units */
{DDECADE, UNITS, DTK_DECADE}, /* "decade" relative time units */ {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative time units */
{"decades", UNITS, DTK_DECADE}, /* "decades" relative time units */ {"decades", UNITS, DTK_DECADE}, /* "decades" relative time units */
{"h", UNITS, DTK_HOUR}, /* "hour" relative time units */ {"h", UNITS, DTK_HOUR}, /* "hour" relative time units */
{DHOUR, UNITS, DTK_HOUR}, /* "hour" relative time units */ {DHOUR, UNITS, DTK_HOUR}, /* "hour" relative time units */
{"hours", UNITS, DTK_HOUR}, /* "hours" relative time units */ {"hours", UNITS, DTK_HOUR}, /* "hours" relative time units */
{"hr", UNITS, DTK_HOUR}, /* "hour" relative time units */ {"hr", UNITS, DTK_HOUR}, /* "hour" relative time units */
{"hrs", UNITS, DTK_HOUR}, /* "hours" relative time units */ {"hrs", UNITS, DTK_HOUR}, /* "hours" relative time units */
{INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid time */
* time */ {"m", UNITS, DTK_MINUTE}, /* "minute" relative time units */
{"m", UNITS, DTK_MINUTE}, /* "minute" relative time units */ {"microsecon", UNITS, DTK_MILLISEC}, /* "microsecond" relative time units */
{"microsecon", UNITS, DTK_MILLISEC}, /* "microsecond" relative {"mil", UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
* time units */ {"mils", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
{"mil", UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */ {"millenia", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
{"mils", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */ {DMILLENIUM, UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
{"millenia", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */ {"millisecon", UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
{DMILLENIUM, UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */ {"min", UNITS, DTK_MINUTE}, /* "minute" relative time units */
{"millisecon", UNITS, DTK_MILLISEC}, /* "millisecond" relative {"mins", UNITS, DTK_MINUTE}, /* "minutes" relative time units */
* time units */ {"mins", UNITS, DTK_MINUTE}, /* "minutes" relative time units */
{"min", UNITS, DTK_MINUTE}, /* "minute" relative time units */ {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative time units */
{"mins", UNITS, DTK_MINUTE},/* "minutes" relative time units */ {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative time units */
{"mins", UNITS, DTK_MINUTE},/* "minutes" relative time units */ {"mon", UNITS, DTK_MONTH}, /* "months" relative time units */
{DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative time units */ {"mons", UNITS, DTK_MONTH}, /* "months" relative time units */
{"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative time units */ {DMONTH, UNITS, DTK_MONTH}, /* "month" relative time units */
{"mon", UNITS, DTK_MONTH}, /* "months" relative time units */ {"months", UNITS, DTK_MONTH}, /* "months" relative time units */
{"mons", UNITS, DTK_MONTH}, /* "months" relative time units */ {"ms", UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
{DMONTH, UNITS, DTK_MONTH}, /* "month" relative time units */ {"msec", UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
{"months", UNITS, DTK_MONTH}, /* "months" relative time units */ {DMILLISEC, UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
{"ms", UNITS, DTK_MILLISEC},/* "millisecond" relative time units */ {"mseconds", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time units */
{"msec", UNITS, DTK_MILLISEC}, /* "millisecond" relative time {"msecs", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time units */
* units */ {"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative time units */
{DMILLISEC, UNITS, DTK_MILLISEC}, /* "millisecond" relative time {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative time units */
* units */ {"reltime", IGNORE, 0}, /* "reltime" for pre-v6.1 "Undefined Reltime" */
{"mseconds", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time {"s", UNITS, DTK_SECOND}, /* "second" relative time units */
* units */ {"sec", UNITS, DTK_SECOND}, /* "second" relative time units */
{"msecs", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time {DSECOND, UNITS, DTK_SECOND}, /* "second" relative time units */
* units */ {"seconds", UNITS, DTK_SECOND}, /* "seconds" relative time units */
{"qtr", UNITS, DTK_QUARTER},/* "quarter" relative time units */ {"secs", UNITS, DTK_SECOND}, /* "seconds" relative time units */
{DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative time units */ {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */
{"reltime", IGNORE, 0}, /* "reltime" for pre-v6.1 "Undefined {"tz", UNITS, DTK_TZ}, /* "timezone" time offset */
* Reltime" */ {"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid time */
{"s", UNITS, DTK_SECOND}, /* "second" relative time units */ {"us", UNITS, DTK_MICROSEC}, /* "microsecond" relative time units */
{"sec", UNITS, DTK_SECOND}, /* "second" relative time units */ {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative time units */
{DSECOND, UNITS, DTK_SECOND}, /* "second" relative time units */ {DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative time units */
{"seconds", UNITS, DTK_SECOND}, /* "seconds" relative time units */ {"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative time units */
{"secs", UNITS, DTK_SECOND},/* "seconds" relative time units */ {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative time units */
{DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */ {"w", UNITS, DTK_WEEK}, /* "week" relative time units */
{"tz", UNITS, DTK_TZ}, /* "timezone" time offset */ {DWEEK, UNITS, DTK_WEEK}, /* "week" relative time units */
{"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid {"weeks", UNITS, DTK_WEEK}, /* "weeks" relative time units */
* time */ {"y", UNITS, DTK_YEAR}, /* "year" relative time units */
{"us", UNITS, DTK_MICROSEC},/* "microsecond" relative time units */ {DYEAR, UNITS, DTK_YEAR}, /* "year" relative time units */
{"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative time {"years", UNITS, DTK_YEAR}, /* "years" relative time units */
* units */ {"yr", UNITS, DTK_YEAR}, /* "year" relative time units */
{DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative time {"yrs", UNITS, DTK_YEAR}, /* "years" relative time units */
* units */
{"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative time
* units */
{"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative time
* units */
{"w", UNITS, DTK_WEEK}, /* "week" relative time units */
{DWEEK, UNITS, DTK_WEEK}, /* "week" relative time units */
{"weeks", UNITS, DTK_WEEK}, /* "weeks" relative time units */
{"y", UNITS, DTK_YEAR}, /* "year" relative time units */
{DYEAR, UNITS, DTK_YEAR}, /* "year" relative time units */
{"years", UNITS, DTK_YEAR}, /* "years" relative time units */
{"yr", UNITS, DTK_YEAR}, /* "year" relative time units */
{"yrs", UNITS, DTK_YEAR}, /* "years" relative time units */
}; };
static unsigned int szdeltatktbl = sizeof deltatktbl / sizeof deltatktbl[0]; static unsigned int szdeltatktbl = sizeof deltatktbl / sizeof deltatktbl[0];
@ -3719,7 +3703,6 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
#if READ_FORWARD #if READ_FORWARD
int is_neg = FALSE; int is_neg = FALSE;
#endif #endif
int fmask = 0, int fmask = 0,
@ -3734,7 +3717,7 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
*dtype = DTK_DELTA; *dtype = DTK_DELTA;
type = SECOND; type = DTK_SECOND;
tm->tm_year = 0; tm->tm_year = 0;
tm->tm_mon = 0; tm->tm_mon = 0;
tm->tm_mday = 0; tm->tm_mday = 0;