Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf4c4f1c

Browse files
committed
>> Do you agree that using a hashtable for it in general is a good idea
>> assuming this sideeffect is removed, though?>>I have no problem with the hashtable, only with preloading it with>everything. What I'd like to see is that the table inherited at fork()>contains just the data for the default timezone. (At least in the>normal case where that setting hasn't been changed since postmaster>start.)Here's a patch doing this. Changes score_timezone not to use pg_tzset(),and thus not loading all the zones in the cache. The actual timezonebeing picked will be set using set_global_timezone() which in turn callspg_tzset() and loads it in the cache.Magnus Hagander
1 parentb4132fd commitf4c4f1c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎src/timezone/pgtz.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.32 2005/05/29 04:23:07 tgl Exp $
9+
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.33 2005/06/15 00:09:26 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -162,14 +162,19 @@ score_timezone(const char *tzname, struct tztry * tt)
162162
structtm*systm;
163163
structpg_tm*pgtm;
164164
charcbuf[TZ_STRLEN_MAX+1];
165-
pg_tz*tz;
165+
pg_tztz;
166166

167-
tz=pg_tzset(tzname);
168-
if (!tz)
169-
return-1;/* can't handle the TZ name at all */
167+
168+
/* Load timezone directly. Don't use pg_tzset, because we don't want
169+
* all timezones loaded in the cache at startup. */
170+
if (tzload(tzname,&tz.state)!=0) {
171+
if (tzname[0]==':'||tzparse(tzname,&tz.state, FALSE)!=0) {
172+
return-1;/* can't handle the TZ name at all */
173+
}
174+
}
170175

171176
/* Reject if leap seconds involved */
172-
if (!tz_acceptable(tz))
177+
if (!tz_acceptable(&tz))
173178
{
174179
elog(DEBUG4,"Reject TZ \"%s\": uses leap seconds",tzname);
175180
return-1;
@@ -179,7 +184,7 @@ score_timezone(const char *tzname, struct tztry * tt)
179184
for (i=0;i<tt->n_test_times;i++)
180185
{
181186
pgtt= (pg_time_t) (tt->test_times[i]);
182-
pgtm=pg_localtime(&pgtt,tz);
187+
pgtm=pg_localtime(&pgtt,&tz);
183188
if (!pgtm)
184189
return-1;/* probably shouldn't happen */
185190
systm=localtime(&(tt->test_times[i]));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp