Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0171e72

Browse files
committed
Update timezone code to track the upstream changes since 2003. In particular
this adds support for 64-bit tzdata files, which is needed to support DST calculations beyond 2038. Add a regression test case to give some minimal confidence that that really works. Heikki Linnakangas
1 parent 2f67722 commit 0171e72

File tree

12 files changed

+1342
-435
lines changed

12 files changed

+1342
-435
lines changed

src/test/regress/expected/timestamptz.out

+25
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,31 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/Does_not_exist');
114114
ERROR: time zone "america/does_not_exist" not recognized
115115
SELECT '19970710 173201' AT TIME ZONE 'America/Does_not_exist';
116116
ERROR: time zone "America/Does_not_exist" not recognized
117+
-- Daylight saving time for timestamps beyond 32-bit time_t range.
118+
SELECT '20500710 173201 Europe/Helsinki'::timestamptz; -- DST
119+
timestamptz
120+
------------------------------
121+
Sun Jul 10 07:32:01 2050 PDT
122+
(1 row)
123+
124+
SELECT '20500110 173201 Europe/Helsinki'::timestamptz; -- non-DST
125+
timestamptz
126+
------------------------------
127+
Mon Jan 10 07:32:01 2050 PST
128+
(1 row)
129+
130+
SELECT '205000-07-10 17:32:01 Europe/Helsinki'::timestamptz; -- DST
131+
timestamptz
132+
--------------------------------
133+
Thu Jul 10 07:32:01 205000 PDT
134+
(1 row)
135+
136+
SELECT '205000-01-10 17:32:01 Europe/Helsinki'::timestamptz; -- non-DST
137+
timestamptz
138+
--------------------------------
139+
Fri Jan 10 07:32:01 205000 PST
140+
(1 row)
141+
117142
-- Check date conversion and date arithmetic
118143
INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT');
119144
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 10 17:32:01 1997');

src/test/regress/sql/timestamptz.sql

+7
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ SELECT '19970710 173201' AT TIME ZONE 'America/New_York';
8686
INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/Does_not_exist');
8787
SELECT '19970710 173201' AT TIME ZONE 'America/Does_not_exist';
8888

89+
-- Daylight saving time for timestamps beyond 32-bit time_t range.
90+
SELECT '20500710 173201 Europe/Helsinki'::timestamptz; -- DST
91+
SELECT '20500110 173201 Europe/Helsinki'::timestamptz; -- non-DST
92+
93+
SELECT '205000-07-10 17:32:01 Europe/Helsinki'::timestamptz; -- DST
94+
SELECT '205000-01-10 17:32:01 Europe/Helsinki'::timestamptz; -- non-DST
95+
8996
-- Check date conversion and date arithmetic
9097
INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT');
9198

src/timezone/README

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
This is a PostgreSQL adapted version of the timezone library
2-
from:
1+
This is a PostgreSQL adapted version of the timezone library from:
32

43
ftp://elsie.nci.nih.gov/pub/tzcode*.tar.gz
54

6-
The data files under data/ are an exact copy of the latest data set
7-
from
5+
The code is currently synced with release 2007k. There are many cosmetic
6+
(and not so cosmetic) differences from the original tzcode library, but
7+
diffs in the upstream version should usually be propagated to our version.
8+
9+
The data files under data/ are an exact copy of the latest data set from:
810

911
ftp://elsie.nci.nih.gov/pub/tzdata*.tar.gz
1012

src/timezone/ialloc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
* This file is in the public domain, so clarified as of
3-
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
3+
* 2006-07-17 by Arthur David Olson.
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/timezone/ialloc.c,v 1.9 2007/10/26 13:30:10 tgl Exp $
6+
* $PostgreSQL: pgsql/src/timezone/ialloc.c,v 1.10 2008/02/16 21:16:04 tgl Exp $
77
*/
88

99
#include "postgres_fe.h"

0 commit comments

Comments
 (0)