1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

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.
This commit is contained in:
Tom Lane
2006-10-18 16:43:14 +00:00
parent 723f716be0
commit 877f08da14
5 changed files with 77 additions and 26 deletions

View File

@ -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 $
*/
/*
@ -1066,6 +1066,31 @@ pg_next_dst_boundary(const pg_time_t *timep,
return 1;
}
/*
* 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
*/