Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit929e50e

Browse files
author
Thomas G. Lockhart
committed
Recognize special case of POSIX time zone: "GMT+8" and "GMT-8".
Still needs to be done for the general case: "tz+/-#" where tz is a 3 char string.This will probably involve moving code around to other places.
1 parent7c07006 commit929e50e

File tree

1 file changed

+42
-2
lines changed
  • src/backend/utils/adt

1 file changed

+42
-2
lines changed

‎src/backend/utils/adt/dt.c

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1981,15 +1981,19 @@ static datetkn datetktbl[] = {
19811981
{"cdt",DTZ,NEG(30)},/* Central Daylight Time */
19821982
{"cet",TZ,6},/* Central European Time */
19831983
{"cetdst",DTZ,12},/* Central European Dayl.Time */
1984+
#ifUSE_AUSTRALIAN_RULES
1985+
{"cst",TZ,63},/* Australia Eastern Std Time */
1986+
#else
19841987
{"cst",TZ,NEG(36)},/* Central Standard Time */
1988+
#endif
19851989
{DCURRENT,RESERV,DTK_CURRENT},/* "current" is always now */
19861990
{"dec",MONTH,12},
19871991
{"december",MONTH,12},
19881992
{"dnt",TZ,6},/* Dansk Normal Tid */
19891993
{"dow",RESERV,DTK_DOW},/* day of week */
19901994
{"doy",RESERV,DTK_DOY},/* day of year */
19911995
{"dst",DTZMOD,6},
1992-
{"east",TZ,NEG(60)},/* East Australian Std Time */
1996+
{"east",TZ,60},/* East Australian Std Time */
19931997
{"edt",DTZ,NEG(24)},/* Eastern Daylight Time */
19941998
{"eet",TZ,12},/* East. Europe, USSR Zone 1 */
19951999
{"eetdst",DTZ,18},/* Eastern Europe */
@@ -2552,6 +2556,23 @@ ParseDateTime(char *timestr, char *lowstr,
25522556
/* full date string with leading text month? */
25532557
if ((*cp=='-')|| (*cp=='/')|| (*cp=='.'))
25542558
{
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+
25552576
ftype[nf]=DTK_DATE;
25562577
while (isdigit(*cp)|| (*cp=='-')|| (*cp=='/')|| (*cp=='.'))
25572578
*lp++=tolower(*cp++);
@@ -2826,6 +2847,25 @@ DecodeDateTime(char **field, int *ftype, int nf,
28262847
if (tzp==NULL)
28272848
return-1;
28282849
*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+
28292869
break;
28302870

28312871
caseIGNORE:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp