diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-10-18 16:43:14 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-10-18 16:43:14 +0000 |
commit | 877f08da14719a1bead6154785ab45714d347998 (patch) | |
tree | fe730f9ddff1b81fb8d28d97924d1f81565d8370 /src/timezone/localtime.c | |
parent | 723f716be04c3e59bb7fdaa6ff044bda6ea4f94b (diff) | |
download | postgresql-877f08da14719a1bead6154785ab45714d347998.tar.gz |
Fix up timetz input so that a date is required only when the specified
timezone actually has a daylight-savings rule. This avoids breaking
cases that used to work because they went through the DecodePosixTimezone
code path. Per contrib regression failures (mea culpa for not running
those yesterday...). Also document the already-applied change to allow
GMT offsets up to 14 hours.
Diffstat (limited to 'src/timezone/localtime.c')
-rw-r--r-- | src/timezone/localtime.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c index f5c6c0db8d..fca5ebac64 100644 --- a/src/timezone/localtime.c +++ b/src/timezone/localtime.c @@ -3,7 +3,7 @@ * 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.15 2006/10/16 19:58:26 tgl Exp $ + * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.16 2006/10/18 16:43:14 tgl Exp $ */ /* @@ -1067,6 +1067,31 @@ pg_next_dst_boundary(const pg_time_t *timep, } /* + * If the given timezone uses only one GMT offset, store that offset + * into *gmtoff and return TRUE, else return FALSE. + */ +bool +pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff) +{ + /* + * The zone could have more than one ttinfo, if it's historically used + * more than one abbreviation. We return TRUE as long as they all have + * the same gmtoff. + */ + const struct state *sp; + int i; + + sp = &tz->state; + for (i = 1; i < sp->typecnt; i++) + { + if (sp->ttis[i].tt_gmtoff != sp->ttis[0].tt_gmtoff) + return false; + } + *gmtoff = sp->ttis[0].tt_gmtoff; + return true; +} + +/* * Return the name of the current timezone */ const char * |