Re: fractional timezones - Mailing list pgsql-general

From Thomas Lockhart
Subject Re: fractional timezones
Date
Msg-id 3D29B506.C467B464@fourpalms.org
Whole thread Raw
In response to fractional timezones  ("Clark C . Evans" <cce@clarkevans.com>)
List pgsql-general
> Hello.  I don't seem to be able to set a fractional
> timezone for Katmandu, Nepal.  In version 7.2.1, the
> following commands either fail or round to the
> nearest hour (GMT+6:00).   I'm curious if I'm missing
> anything...
>   SET TIME ZONE "GMT+5.75"
>   SET TIME ZONE "GMT+5:45"
>   SET TIME ZONE "Asia/Katmandu"
>   SET TIMEZONE 5.45
>   SET TIMEZONE 5.75
>   SET TIMEZONE 345

You seem to be missing something in your time zone database:

thomas=# SET TIME ZONE "Asia/Katmandu";
thomas=# select timestamp with time zone 'now';
           timestamptz
----------------------------------
 2002-07-08 21:12:04.751675+05:45

thomas=# set datestyle='postgres';
thomas=# select timestamp with time zone 'now';
             timestamptz
-------------------------------------
 Mon Jul 08 21:30:17.138849 2002 NPT

But you've got other problems. Postgres has always had the time zone
info divided down to fit into a smaller slot in a lookup table. And it
divides by 10 to do it :(

So time zone intervals on 15 minute boundaries don't work. And NPT is
not in PostgreSQL's time zone lookup table, so it would have trouble
reading inputs with those set.

otoh, if all you need to do is work with local times, you won't need to
specify NPT explicitly, until you need to reload a database of course.

There is at least one other time zone on a 15m boundary, and afaik none
on a 10m boundary so one possibility is to recode our lookup table with
a new convention. But that hasn't happened yet.

You could modify src/backend/utils/adt/datetime.c to handle NPT as a
special case.

hth

                   - Thomas



pgsql-general by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: I am being interviewed by OReilly
Next
From: Tom Lane
Date:
Subject: Re: WAL recycling, ext3, Linux 2.4.18