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

Commit 0169c35

Browse files
committed
Arrange to install a "posixrules" entry in our timezone database, so that
POSIX-style timezone specs that don't exactly match any database entry will be treated as having correct USA DST rules. Also, document that this can be changed if you want to use some other DST rules with a POSIX zone spec. We could consider changing localtime.c's TZDEFRULESTRING, but since that facility can only deal with one DST transition rule, it seems fairly useless now; might as well just plan to override it using a "posixrules" entry. Backpatch as far as 8.0. There isn't much we can do in 7.x ... either your libc gets it right, or it doesn't.
1 parent 754148d commit 0169c35

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

doc/src/sgml/datatype.sgml

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.190 2007/02/01 00:28:16 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.191 2007/03/14 17:38:05 tgl Exp $ -->
22

33
<chapter id="datatype">
44
<title id="datatype-title">Data Types</title>
@@ -2243,12 +2243,13 @@ January 8 04:05:06 1999 PST
22432243
were not already a recognized zone name, it would be accepted and would
22442244
be functionally equivalent to USA East Coast time. When a
22452245
daylight-savings zone name is present, it is assumed to be used
2246-
according to USA time zone rules, so this feature is of limited use
2247-
outside North America. One should also be wary that this provision can
2248-
lead to silently accepting bogus input, since there is no check on the
2249-
reasonableness of the zone abbreviations. For example, <literal>SET
2250-
TIMEZONE TO FOOBAR0</> will work, leaving the system effectively using
2251-
a rather peculiar abbreviation for GMT.
2246+
according to the same daylight-savings transition rules used in the
2247+
<literal>zic</> time zone database's <filename>posixrules</> entry.
2248+
In a standard <productname>PostgreSQL</productname> installation,
2249+
<filename>posixrules</> is the same as <literal>US/Eastern</>, so
2250+
that POSIX-style time zone specifications follow USA daylight-savings
2251+
rules. If needed, you can adjust this behavior by replacing the
2252+
<filename>posixrules</> file.
22522253
</para>
22532254
</listitem>
22542255
</itemizedlist>
@@ -2259,6 +2260,14 @@ January 8 04:05:06 1999 PST
22592260
rule and so have two possible UTC offsets.
22602261
</para>
22612262

2263+
<para>
2264+
One should be wary that the POSIX-style time zone feature can
2265+
lead to silently accepting bogus input, since there is no check on the
2266+
reasonableness of the zone abbreviations. For example, <literal>SET
2267+
TIMEZONE TO FOOBAR0</> will work, leaving the system effectively using
2268+
a rather peculiar abbreviation for UTC.
2269+
</para>
2270+
22622271
<para>
22632272
In all cases, timezone names are recognized case-insensitively.
22642273
(This is a change from <productname>PostgreSQL</productname> versions

src/timezone/Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for the timezone library
55

66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.25 2007/02/09 15:56:00 petere Exp $
7+
# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.26 2007/03/14 17:38:06 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -23,6 +23,10 @@ TZDATA = africa antarctica asia australasia europe northamerica southamerica \
2323
pacificnew etcetera factory backward systemv solar87 solar88 solar89
2424
TZDATAFILES = $(TZDATA:%=$(srcdir)/data/%)
2525

26+
# which zone should determine the DST rules (not the specific UTC offset!)
27+
# for POSIX-style timezone specs
28+
POSIXRULES = US/Eastern
29+
2630
all: SUBSYS.o submake-libpgport zic
2731

2832
SUBSYS.o: $(OBJS)
@@ -32,7 +36,7 @@ zic: $(ZICOBJS)
3236
$(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
3337

3438
install: all installdirs
35-
./zic -d '$(DESTDIR)$(datadir)/timezone' $(TZDATAFILES)
39+
./zic -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
3640
$(MAKE) -C tznames $@
3741

3842
installdirs:

0 commit comments

Comments
 (0)