Re: [HACKERS] timezone problem?

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: [HACKERS] timezone problem?
Дата
Msg-id 388807E7.12B3BEB3@alumni.caltech.edu
обсуждение исходный текст
Ответ на Re: [HACKERS] timezone problem?  (Paul Schulz <pauls@caemrad.com.au>)
Ответы Re: [HACKERS] timezone problem?  (Michael Robinson <robinson@netrinsics.com>)
Список pgsql-hackers
> If a datetime variable is read out, and then inserted back in again
> (verbatim) I get a change in the time value. I suspect that it because
> out lime zona Australia/Adelaide is CST, which I belive is also an
> American timezone.  Trimming the timezone info (CST) off, fixes this
> problem.  Can anyone shed any light?

Yup. Fully 1/4 of our timezone lookup table is consumed by Australian
time zones (y'all have multiple names for *everything*!). There are
some name conflicts, of course :(

> How does one get the +1030 timezone format?

Use ACSST or CADT or SADT (at least that is what is defined in the
Postgres lookup table for *exactly* the same time offset).

Or...

Apply the enclosed patch, then compile the backend with:

  -DUSE_AUSTRALIAN_RULES=1

(Or move to another country. Recompiling the backend is probably
easier... ;)

This is covered in the docs in the appendix on "Date/Time Support",
but CST was not included and it looks to me that EAST had sign
trouble. Both are fixed in the enclosed patch.

btw, the patch also tries to fix the "GMT+hhmm" timezone format
reported recently as being available on FreeBSD; perhaps someone could
test that at the same time.

                      - Thomas

--
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California*** dt.c.orig    Tue Jan 18 17:25:51 2000
--- dt.c    Fri Jan 21 07:12:10 2000
***************
*** 1980,1986 ****
--- 1980,1990 ----
      {"cdt", DTZ, NEG(30)},        /* Central Daylight Time */
      {"cet", TZ, 6},                /* Central European Time */
      {"cetdst", DTZ, 12},        /* Central European Dayl.Time */
+ #if USE_AUSTRALIAN_RULES
+     {"cst", TZ, 63},            /* Australia Eastern Std Time */
+ #else
      {"cst", TZ, NEG(36)},        /* Central Standard Time */
+ #endif
      {DCURRENT, RESERV, DTK_CURRENT},    /* "current" is always now */
      {"dec", MONTH, 12},
      {"december", MONTH, 12},
***************
*** 1988,1994 ****
      {"dow", RESERV, DTK_DOW},    /* day of week */
      {"doy", RESERV, DTK_DOY},    /* day of year */
      {"dst", DTZMOD, 6},
!     {"east", TZ, NEG(60)},        /* East Australian Std Time */
      {"edt", DTZ, NEG(24)},        /* Eastern Daylight Time */
      {"eet", TZ, 12},            /* East. Europe, USSR Zone 1 */
      {"eetdst", DTZ, 18},        /* Eastern Europe */
--- 1992,1998 ----
      {"dow", RESERV, DTK_DOW},    /* day of week */
      {"doy", RESERV, DTK_DOY},    /* day of year */
      {"dst", DTZMOD, 6},
!     {"east", TZ, 60},            /* East Australian Std Time */
      {"edt", DTZ, NEG(24)},        /* Eastern Daylight Time */
      {"eet", TZ, 12},            /* East. Europe, USSR Zone 1 */
      {"eetdst", DTZ, 18},        /* Eastern Europe */
***************
*** 2688,2693 ****
--- 2692,2712 ----
                  if (DecodeTimezone(field[i], tzp) != 0)
                      return -1;
                  tmask = DTK_M(TZ);
+
+                 /*
+                  * Swallow an immediately previous timezone if it is GMT
+                  * This handles the odd case in FreeBSD of "GMT+0800"
+                  * but note that we need to flip the sign on this too.
+                  * Claims to be some sort of Posix standard format :(
+                  * - thomas 2000-01-20
+                  */
+                 if ((tmask & fmask) && (tzp != NULL) && (*tzp == 0)
+                     && ((*field[i] == '+') || (*field[i] == '-'))
+                     && (i >= 1) && (strcasecmp(field[i-1], "GMT") == 0))
+                 {
+                     tmask &= ~DTK_M(TZ);
+                     *tzp = -(*tzp);
+                 }
                  break;

              case DTK_NUMBER:

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Hiroshi Inoue"
Дата:
Сообщение: RE: [HACKERS] vacuum timings
Следующее
От: Michael Robinson
Дата:
Сообщение: Re: [HACKERS] timezone problem?