Обсуждение: fractional timezones

Поиск
Список
Период
Сортировка

fractional timezones

От
"Clark C . Evans"
Дата:
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
  *sigh*

Best,

Clark

--
Clark C. Evans                   Axista, Inc.
http://www.axista.com            800.926.5525
XCOLLA Collaborative Project Management Software



Re: fractional timezones

От
Thomas Lockhart
Дата:
> 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