Re: [HACKERS] timezone problem?

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] timezone problem?
Date: 2000-01-21 05:28:44
Message-ID: 3887EE8C.5A2E0044@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii wrote:
>
> > Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> > > HST is interpreted by Postgres as Hawaii Standard Time, which is on
> > > the other side of the date line from Japan. Planning a vacation
> > > Tatsuo?? :))
>
> I wish I could do so:-) I hate the cold winter in Japan...
>
> > Then there's still something wrong:
> >
> > > test=> select '1998-09-23 12:05:10 HST'::datetime;
> > > ------------------------------
> > > Wed Sep 23 22:05:10 1998 JST
> >
> > 10 hours behind JST (= GMT+9, IIRC) is in the wrong ocean to be
> > Hawaii...
>
> Right. HST is GMT-10, and JST - HST = 19 hours. So '1998-09-23
> 12:05:10 HST' shoud be 'Thu Sep 24 07:05:10 1998 JST', rather than 'Wed
> Sep 23 22:05:10 1998 JST'...
>
> Looking into the zoneinfo files under /usr/share/zoneinfo, I found 'Japan'
> as a valid zone name (I could not find 'JST' too on my RH box).
>
> test=> select '1998-09-23 12:05:10 HST'::datetime;
> ?column?
> ------------------------------
> Thu Sep 24 07:05:10 1998 JST -- correct
> (1 row)
>
> test=> set timezone to 'JST';
> SET VARIABLE
> test=> select '1998-09-23 12:05:10 HST'::datetime;
> ?column?
> ------------------------------
> Wed Sep 23 22:05:10 1998 JST -- wrong. seems interpreted as GMT (UTC)
> (1 row)
>
> test=> set timezone to 'Japan';
> SET VARIABLE
> test=> select '1998-09-23 12:05:10 HST'::datetime;
> ?column?
> ------------------------------
> Thu Sep 24 07:05:10 1998 JST -- correct. but why showed as JST?
> (1 row)

That is typical when you use the long form of the time zone name such
as "Japan". You will also find a "US/Pacific" on your machine:

[root(at)golem zoneinfo]# setenv TZ US/Pacific
[root(at)golem zoneinfo]# date
Thu Jan 20 21:24:24 PST 2000

which is the same as PST8PDT.

In /usr/share/zoneinfo/US, the mysteries of the various states'
conventions are revealed:

[root(at)golem zoneinfo]# ls -1 US
Alaska
Aleutian
Arizona
Central
East-Indiana
Eastern
Hawaii
Indiana-Starke
Michigan
Mountain
Pacific
Samoa

where, as Vince pointed out, Indiana, Michigan, and Arizona seem to be
special cases within the usual three timezones.

> Seems something wrong with my RH 5.2. Note that FreeBSD does have the
> problem.

Sorry, FreeBSD also has the problem, or does not??

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-01-21 05:43:49 vacuum timings
Previous Message Tatsuo Ishii 2000-01-21 05:25:41 Re: [HACKERS] timezone problem?