Re: Date/time fixes for HAVE_TM_ZONE platforms - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: Date/time fixes for HAVE_TM_ZONE platforms
Date
Msg-id 369248D3.8EAEC87A@alumni.caltech.edu
Whole thread Raw
In response to Re: Date/time fixes for HAVE_TM_ZONE platforms  (Oleg Broytmann <phd@sun.med.ru>)
Responses Re: [HACKERS] Re: Date/time fixes for HAVE_TM_ZONE platforms  (Oleg Broytmann <phd@sun.med.ru>)
List pgsql-hackers
> > Here are some patches which fix the date/time problems
> Postgres 6.4.2:
> Now the last step - timezone. I remember there was broken 6.4.1 that 
> had correct timezone here...
>    My timezone is, of course MSK/MSD. Global tzname really is EET, but
> tm->tz_name is MSK.

Yeah, so is mine. You will note that any year other than 1991 behaves as
you expect, and 1991 results are consistant with the Linux timezone
database (see below):

postgres=> select datetime('1991-10-01'::date);
datetime
----------------------------
Mon Sep 30 23:00:00 1991 EET
(1 row)

postgres=> select datetime('1992-10-01'::date);
datetime
----------------------------
Thu Oct 01 00:00:00 1992 MSK
(1 row)

postgres=> select datetime('1990-10-01'::date);
datetime
----------------------------
Mon Oct 01 00:00:00 1990 MSK
(1 row)

Apparently 1991 had something different for timezone handling for Moscow
time. It isn't as dumb as it sounds; in the US in 1973-4 we ran on
daylight savings time through the winter season as an energy
conservation measure:

postgres=> select '1973-02-01'::datetime;
?column?
----------------------------
Thu Feb 01 00:00:00 1973 PST
(1 row)

postgres=> select '1974-02-01'::datetime;
?column?
----------------------------
Fri Feb 01 00:00:00 1974 PDT
(1 row)

Anyway, you can see the feature in the "zic" timezone database:

golem$ zdump -v -c 2000 Europe/Moscow
<snip>
Europe/Moscow  Sat Sep 29 23:00:00 1990 GMT = Sun Sep 30 02:00:00 1990
MSK isdst=0
Europe/Moscow  Sat Mar 30 22:59:59 1991 GMT = Sun Mar 31 01:59:59 1991
MSK isdst=0
Europe/Moscow  Sat Mar 30 23:00:00 1991 GMT = Sun Mar 31 02:00:00 1991
EET DST isdst=1
Europe/Moscow  Sat Sep 28 23:59:59 1991 GMT = Sun Sep 29 02:59:59 1991
EET DST isdst=1
Europe/Moscow  Sun Sep 29 00:00:00 1991 GMT = Sun Sep 29 02:00:00 1991
EET isdst=0
Europe/Moscow  Sat Jan 18 23:59:59 1992 GMT = Sun Jan 19 01:59:59 1992
EET isdst=0
Europe/Moscow  Sun Jan 19 00:00:00 1992 GMT = Sun Jan 19 03:00:00 1992
MSK isdst=0
Europe/Moscow  Sat Mar 28 22:59:59 1992 GMT = Sun Mar 29 01:59:59 1992
MSK isdst=0
Europe/Moscow  Sat Mar 28 23:00:00 1992 GMT = Sun Mar 29 03:00:00 1992
MSD isdst=1
<snip>
                   - Tom


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] ./configure: conftest.sh not found
Next
From: Oleg Broytmann
Date:
Subject: Re: [HACKERS] Re: Date/time fixes for HAVE_TM_ZONE platforms