|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.82 2000/01/26 05:57:13 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.83 2000/02/15 03:17:09 thomas Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -1981,15 +1981,19 @@ static datetkn datetktbl[] = { |
1981 | 1981 | {"cdt",DTZ,NEG(30)},/* Central Daylight Time */ |
1982 | 1982 | {"cet",TZ,6},/* Central European Time */ |
1983 | 1983 | {"cetdst",DTZ,12},/* Central European Dayl.Time */ |
| 1984 | +#ifUSE_AUSTRALIAN_RULES |
| 1985 | +{"cst",TZ,63},/* Australia Eastern Std Time */ |
| 1986 | +#else |
1984 | 1987 | {"cst",TZ,NEG(36)},/* Central Standard Time */ |
| 1988 | +#endif |
1985 | 1989 | {DCURRENT,RESERV,DTK_CURRENT},/* "current" is always now */ |
1986 | 1990 | {"dec",MONTH,12}, |
1987 | 1991 | {"december",MONTH,12}, |
1988 | 1992 | {"dnt",TZ,6},/* Dansk Normal Tid */ |
1989 | 1993 | {"dow",RESERV,DTK_DOW},/* day of week */ |
1990 | 1994 | {"doy",RESERV,DTK_DOY},/* day of year */ |
1991 | 1995 | {"dst",DTZMOD,6}, |
1992 | | -{"east",TZ,NEG(60)},/* East Australian Std Time */ |
| 1996 | +{"east",TZ,60},/* East Australian Std Time */ |
1993 | 1997 | {"edt",DTZ,NEG(24)},/* Eastern Daylight Time */ |
1994 | 1998 | {"eet",TZ,12},/* East. Europe, USSR Zone 1 */ |
1995 | 1999 | {"eetdst",DTZ,18},/* Eastern Europe */ |
@@ -2552,6 +2556,23 @@ ParseDateTime(char *timestr, char *lowstr, |
2552 | 2556 | /* full date string with leading text month? */ |
2553 | 2557 | if ((*cp=='-')|| (*cp=='/')|| (*cp=='.')) |
2554 | 2558 | { |
| 2559 | +/* |
| 2560 | + * special case of Posix timezone "GMT-0800" |
| 2561 | + * Note that other sign (e.g. "GMT+0800" |
| 2562 | + * is recognized as two separate fields and handled later. |
| 2563 | + * XXX There is no room for a delimiter between |
| 2564 | + * the "GMT" and the "-0800", so we are going to just swallow the "GMT". |
| 2565 | + * But this leads to other troubles with the definition of signs, |
| 2566 | + * so we have to flip |
| 2567 | + * - thomas 2000-02-06 |
| 2568 | + */ |
| 2569 | +if ((*cp=='-')&&isdigit(*(cp+1)) |
| 2570 | +&& (strncmp(field[nf],"gmt",3)==0)) |
| 2571 | +{ |
| 2572 | +*cp='+'; |
| 2573 | +continue; |
| 2574 | +} |
| 2575 | + |
2555 | 2576 | ftype[nf]=DTK_DATE; |
2556 | 2577 | while (isdigit(*cp)|| (*cp=='-')|| (*cp=='/')|| (*cp=='.')) |
2557 | 2578 | *lp++=tolower(*cp++); |
@@ -2826,6 +2847,25 @@ DecodeDateTime(char **field, int *ftype, int nf, |
2826 | 2847 | if (tzp==NULL) |
2827 | 2848 | return-1; |
2828 | 2849 | *tzp=val*60; |
| 2850 | + |
| 2851 | +/* Swallow an immediately succeeding timezone if this is GMT |
| 2852 | + * This handles the odd case in FreeBSD of "GMT+0800" |
| 2853 | + * but note that we need to flip the sign on this too. |
| 2854 | + * Claims to be some sort of POSIX standard format :( |
| 2855 | + * - thomas 2000-01-20 |
| 2856 | + */ |
| 2857 | +if ((i< (nf-1))&& (ftype[i+1]==DTK_TZ) |
| 2858 | +&& (strcmp(field[i],"gmt")==0)) |
| 2859 | +{ |
| 2860 | +i++; |
| 2861 | +if (DecodeTimezone(field[i],tzp)!=0) |
| 2862 | +return-1; |
| 2863 | + |
| 2864 | +/* flip the sign per POSIX standard */ |
| 2865 | +*tzp=-(*tzp); |
| 2866 | +} |
| 2867 | + |
| 2868 | + |
2829 | 2869 | break; |
2830 | 2870 |
|
2831 | 2871 | caseIGNORE: |
|