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

Commitf4898c9

Browse files
committed
Sync timezone code with tzcode 2010c from the Olson group. This fixes some
corner cases that come up in certain timezones (apparently, only those withlots and lots of distinct TZ transition rules, as far as I can gather froma quick scan of their archives). Per suggestion from Jeevan Chalke.Back-patch to 8.4. Possibly we need to push this into earlier releasesas well, but I'm hesitant to update them to the 64-bit tzcode withoutmore thought and testing.
1 parente0f9e2b commitf4898c9

File tree

4 files changed

+43
-27
lines changed

4 files changed

+43
-27
lines changed

‎src/timezone/README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$PostgreSQL: pgsql/src/timezone/README,v 1.7 2008/03/21 13:23:29 momjian Exp $
1+
$PostgreSQL: pgsql/src/timezone/README,v 1.8 2010/03/11 18:43:24 tgl Exp $
22

33
Timezone
44
========
@@ -7,7 +7,7 @@ This is a PostgreSQL adapted version of the timezone library from:
77

88
ftp://elsie.nci.nih.gov/pub/tzcode*.tar.gz
99

10-
The code is currently synced with release2007k. There are many cosmetic
10+
The code is currently synced with release2010c. There are many cosmetic
1111
(and not so cosmetic) differences from the original tzcode library, but
1212
diffs in the upstream version should usually be propagated to our version.
1313

‎src/timezone/localtime.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 1996-06-05 by Arthur David Olson.
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.21 2009/06/1114:49:15 momjian Exp $
6+
* $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.22 2010/03/1118:43:24 tgl Exp $
77
*/
88

99
/*
@@ -164,6 +164,7 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend)
164164
4*TZ_MAX_TIMES];
165165
}u;
166166

167+
sp->goback=sp->goahead= FALSE;
167168
if (name==NULL&& (name=TZDEFAULT)==NULL)
168169
return-1;
169170
if (name[0]==':')
@@ -357,16 +358,25 @@ tzload(const char *name, char *canonname, struct state * sp, int doextend)
357358
sp->ttis[sp->typecnt++]=ts.ttis[1];
358359
}
359360
}
360-
i=2*YEARSPERREPEAT;
361-
sp->goback=sp->goahead=sp->timecnt>i;
362-
sp->goback=sp->goback&&
363-
typesequiv(sp,sp->types[i],sp->types[0])&&
364-
differ_by_repeat(sp->ats[i],sp->ats[0]);
365-
sp->goahead=sp->goahead&&
366-
typesequiv(sp,sp->types[sp->timecnt-1],
367-
sp->types[sp->timecnt-1-i])&&
368-
differ_by_repeat(sp->ats[sp->timecnt-1],
369-
sp->ats[sp->timecnt-1-i]);
361+
if (sp->timecnt>1)
362+
{
363+
for (i=1;i<sp->timecnt;++i)
364+
if (typesequiv(sp,sp->types[i],sp->types[0])&&
365+
differ_by_repeat(sp->ats[i],sp->ats[0]))
366+
{
367+
sp->goback= TRUE;
368+
break;
369+
}
370+
for (i=sp->timecnt-2;i >=0;--i)
371+
if (typesequiv(sp,sp->types[sp->timecnt-1],
372+
sp->types[i])&&
373+
differ_by_repeat(sp->ats[sp->timecnt-1],
374+
sp->ats[i]))
375+
{
376+
sp->goahead= TRUE;
377+
break;
378+
}
379+
}
370380
return0;
371381
}
372382

‎src/timezone/strftime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.14 2009/06/1114:49:15 momjian Exp $
18+
* $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.15 2010/03/1118:43:24 tgl Exp $
1919
*/
2020

2121
#include"postgres.h"
@@ -169,7 +169,7 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
169169
{
170170
intwarn2=IN_SOME;
171171

172-
pt=_fmt(Locale->c_fmt,t,pt,ptlim,warnp);
172+
pt=_fmt(Locale->c_fmt,t,pt,ptlim,&warn2);
173173
if (warn2==IN_ALL)
174174
warn2=IN_THIS;
175175
if (warn2>*warnp)

‎src/timezone/zic.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 2006-07-17 by Arthur David Olson.
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/timezone/zic.c,v 1.24 2009/06/1114:49:15 momjian Exp $
6+
* $PostgreSQL: pgsql/src/timezone/zic.c,v 1.25 2010/03/1118:43:24 tgl Exp $
77
*/
88

99
#include"postgres_fe.h"
@@ -41,7 +41,7 @@ typedef int64 zic_t;
4141
#endif
4242
#endif
4343

44-
staticcharelsieid[]="@(#)zic.c 8.17";
44+
staticcharelsieid[]="@(#)zic.c8.20";
4545

4646
/*
4747
* On some ancient hosts, predicates like `isspace(C)' are defined
@@ -162,7 +162,7 @@ static void rulesub(struct rule * rp,
162162
constchar*dayp,constchar*timep);
163163
staticvoidsetboundaries(void);
164164
staticpg_time_ttadd(constpg_time_tt1,longt2);
165-
staticvoidusage(void);
165+
staticvoidusage(FILE*stream,intstatus);
166166
staticvoidwritezone(constchar*name,constchar*string);
167167
staticintyearistype(intyear,constchar*type);
168168

@@ -454,13 +454,15 @@ warning(const char *string)
454454
}
455455

456456
staticvoid
457-
usage(void)
457+
usage(FILE*stream,intstatus)
458458
{
459-
(void)fprintf(stderr,_("%s: usage is %s \
460-
[ --version ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
461-
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"),
459+
(void)fprintf(stream,_("%s: usage is %s \
460+
[ --version ] [ --help ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
461+
\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n\
462+
\n\
463+
Report bugs to tz@elsie.nci.nih.gov.\n"),
462464
progname,progname);
463-
exit(EXIT_FAILURE);
465+
exit(status);
464466
}
465467

466468
staticconstchar*psxrules;
@@ -492,11 +494,15 @@ main(int argc, char *argv[])
492494
(void)printf("%s\n",elsieid);
493495
exit(EXIT_SUCCESS);
494496
}
497+
elseif (strcmp(argv[i],"--help")==0)
498+
{
499+
usage(stdout,EXIT_SUCCESS);
500+
}
495501
while ((c=getopt(argc,argv,"d:l:p:L:vsy:"))!=EOF&&c!=-1)
496502
switch (c)
497503
{
498504
default:
499-
usage();
505+
usage(stderr,EXIT_FAILURE);
500506
case'd':
501507
if (directory==NULL)
502508
directory=optarg;
@@ -560,7 +566,7 @@ main(int argc, char *argv[])
560566
break;
561567
}
562568
if (optind==argc-1&&strcmp(argv[optind],"=")==0)
563-
usage();/* usage message by request */
569+
usage(stderr,EXIT_FAILURE);/* usage message by request */
564570
if (directory==NULL)
565571
directory="data";
566572
if (yitcommand==NULL)
@@ -2035,7 +2041,7 @@ stringzone(char *result, const struct zone * zpfirst, int zonecount)
20352041
if (stdrp!=NULL&&stdrp->r_hiyear==2037)
20362042
return;
20372043
}
2038-
if (stdrp==NULL&&zp->z_nrules!=0)
2044+
if (stdrp==NULL&&(zp->z_nrules!=0||zp->z_stdoff!=0))
20392045
return;
20402046
abbrvar= (stdrp==NULL) ?"" :stdrp->r_abbrvar;
20412047
doabbr(result,zp->z_format,abbrvar, FALSE, TRUE);
@@ -2115,7 +2121,7 @@ outzone(const struct zone * zpfirst, int zonecount)
21152121
if (leapseen)
21162122
{
21172123
updateminmax(leapminyear);
2118-
updateminmax(leapmaxyear);
2124+
updateminmax(leapmaxyear+ (leapmaxyear<INT_MAX));
21192125
}
21202126
for (i=0;i<zonecount;++i)
21212127
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp