Re: [HACKERS] timezone problem?

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: [HACKERS] timezone problem?
Дата
Msg-id 3887313F.8D8DF166@alumni.caltech.edu
обсуждение исходный текст
Ответ на timezone problem?  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Ответы Re: [HACKERS] timezone problem?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> Why do I get different date/time after explicitly setting timezone?
> This is RH Linux 5.2.

Because...

> test=> select '1998-09-23 12:05:10 HST'::datetime;
> ------------------------------
>  Thu Sep 24 07:05:10 1998 JST
> test=> show timezone;
> NOTICE:  Time zone is unknown
> SHOW VARIABLE
> test=> set timezone to 'JST';
> SET VARIABLE
> test=> select '1998-09-23 12:05:10 HST'::datetime;
> ------------------------------
>  Wed Sep 23 22:05:10 1998 JST

On my RH-5.2 box, "JST" is not in /usr/share/zoneinfo. A non-existant
TZ evaluates to be GMT, but the system reports the string you gave
it!! I don't recall ever running across this before. But the moral of
the story is: don't do that! ;)

I'm not sure how one would check to verify that the timezone you set
is actually a valid timezone. I'd hate to restrict it to the list of
timezones Postgres knows about when parsing input (since that is a
subset of the possibilities), though that is one solution...
                  - Thomas

[root@golem zoneinfo]# setenv TZ HST
[root@golem zoneinfo]# date
Thu Jan 20 05:55:02 HST 2000
[root@golem zoneinfo]# setenv TZ JST
[root@golem zoneinfo]# date
Thu Jan 20 15:54:37 JST 2000
[root@golem zoneinfo]# setenv TZ GMT
[root@golem zoneinfo]# date
Thu Jan 20 15:54:45 GMT 2000

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


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

Предыдущее
От: Don Baccus
Дата:
Сообщение: Re: [HACKERS] gperf anyone?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] A notice for too long names