mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-24 05:57:19 +02:00
Fix bogus timetz_zone() results for DYNTZ abbreviations.
timetz_zone() delivered completely wrong answers if the zone was
specified by a dynamic TZ abbreviation, because it failed to account
for the difference between the POSIX conventions for field values in
struct pg_tm and the conventions used in PG-specific datetime code.
As a stopgap fix, just adjust the tm_year and tm_mon fields to match
PG conventions. This is fixed in a different way in HEAD (388e71af8
)
but I don't want to back-patch the change of reference point.
Discussion: https://postgr.es/m/CAJ7c6TOMG8zSNEZtCn5SPe+cCk3Lfxb71ZaQwT2F4T7PJ_t=KA@mail.gmail.com
This commit is contained in:
parent
8782a84529
commit
90b4647f63
@ -2848,6 +2848,8 @@ timetz_zone(PG_FUNCTION_ARGS)
|
||||
struct pg_tm *tm;
|
||||
|
||||
tm = pg_localtime(&now, tzp);
|
||||
tm->tm_year += 1900; /* adjust to PG conventions */
|
||||
tm->tm_mon += 1;
|
||||
tz = DetermineTimeZoneAbbrevOffset(tm, tzname, tzp);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user