diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2012-05-04 19:29:27 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2012-05-04 19:29:27 +0000 |
commit | a19eeb99758498e918043d50b57ba75b2d938e50 (patch) | |
tree | 0b179455707ed727766787b7ef0d276d5d7dd315 /libc/timezone | |
parent | ded28410835671021876e845572816d3083efe34 (diff) | |
download | eglibc2-a19eeb99758498e918043d50b57ba75b2d938e50.tar.gz |
Merge changes between r18165 and r18362 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@18363 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/timezone')
-rw-r--r-- | libc/timezone/README | 4 | ||||
-rw-r--r-- | libc/timezone/zdump.c | 10 | ||||
-rw-r--r-- | libc/timezone/zic.c | 73 |
3 files changed, 75 insertions, 12 deletions
diff --git a/libc/timezone/README b/libc/timezone/README index f9aebca7a..05bfe91a2 100644 --- a/libc/timezone/README +++ b/libc/timezone/README @@ -13,5 +13,5 @@ come from the tzdata package by Arthur David Olson et.al. Please check the ChangeLog files in the top level directory for the version of the tzcode and tzdata packages. -These packages may be found at ftp://elsie.nci.nih.gov/pub/. Commentary -should be addressed to tz@elsie.nci.nih.gov. +These packages may be found at ftp://munnari.oz.au/pub/. Commentary +should be addressed to tz@iana.org. diff --git a/libc/timezone/zdump.c b/libc/timezone/zdump.c index 0e9e545ab..da16a24cd 100644 --- a/libc/timezone/zdump.c +++ b/libc/timezone/zdump.c @@ -3,7 +3,7 @@ ** 2009-05-17 by Arthur David Olson. */ -static char elsieid[] = "@(#)zdump.c 8.9"; +static char elsieid[] = "@(#)zdump.c 8.10"; /* ** This code has been made independent of the rest of the time @@ -237,7 +237,9 @@ const char * const zone; } static void -usage(const char *progname, FILE *stream, int status) +usage(stream, status) +FILE * const stream; +const int status; { (void) fprintf(stream, _("%s: usage is %s [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n\ @@ -285,7 +287,7 @@ char * argv[]; (void) printf("zdump %s%s\n", PKGVERSION, elsieid); exit(EXIT_SUCCESS); } else if (strcmp(argv[i], "--help") == 0) { - usage(progname, stdout, EXIT_SUCCESS); + usage(stdout, EXIT_SUCCESS); } vflag = 0; cutarg = NULL; @@ -295,7 +297,7 @@ char * argv[]; else cutarg = optarg; if ((c != EOF && c != -1) || (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) { - usage(progname, stderr, EXIT_FAILURE); + usage(stderr, EXIT_FAILURE); } if (vflag) { if (cutarg != NULL) { diff --git a/libc/timezone/zic.c b/libc/timezone/zic.c index 34dd04858..c420bb0e0 100644 --- a/libc/timezone/zic.c +++ b/libc/timezone/zic.c @@ -3,7 +3,7 @@ ** 2006-07-17 by Arthur David Olson. */ -static char elsieid[] = "@(#)zic.c 8.19"; +static char elsieid[] = "@(#)zic.c 8.25"; #ifdef CROSS_ZIC #define REPORT_BUGS_TO "" @@ -1628,6 +1628,53 @@ const char * const string; if (thistimei == 0) writetype[0] = TRUE; } +#ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH + /* + ** For some pre-2011 systems: if the last-to-be-written + ** standard (or daylight) type has an offset different from the + ** most recently used offset, + ** append an (unused) copy of the most recently used type + ** (to help get global "altzone" and "timezone" variables + ** set correctly). + */ + { + register int mrudst, mrustd, hidst, histd, type; + + hidst = histd = mrudst = mrustd = -1; + for (i = thistimei; i < thistimelim; ++i) + if (isdsts[types[i]]) + mrudst = types[i]; + else mrustd = types[i]; + for (i = 0; i < typecnt; ++i) + if (writetype[i]) { + if (isdsts[i]) + hidst = i; + else histd = i; + } + if (hidst >= 0 && mrudst >= 0 && hidst != mrudst && + gmtoffs[hidst] != gmtoffs[mrudst]) { + isdsts[mrudst] = -1; + type = addtype(gmtoffs[mrudst], + &chars[abbrinds[mrudst]], + TRUE, + ttisstds[mrudst], + ttisgmts[mrudst]); + isdsts[mrudst] = TRUE; + writetype[type] = TRUE; + } + if (histd >= 0 && mrustd >= 0 && histd != mrustd && + gmtoffs[histd] != gmtoffs[mrustd]) { + isdsts[mrustd] = -1; + type = addtype(gmtoffs[mrustd], + &chars[abbrinds[mrustd]], + FALSE, + ttisstds[mrustd], + ttisgmts[mrustd]); + isdsts[mrustd] = FALSE; + writetype[type] = TRUE; + } + } +#endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */ thistypecnt = 0; for (i = 0; i < typecnt; ++i) typemap[i] = writetype[i] ? thistypecnt++ : -1; @@ -1842,16 +1889,16 @@ const long gmtoff; register int week; if (rp->r_dycode == DC_DOWGEQ) { - week = 1 + rp->r_dayofmonth / DAYSPERWEEK; - if ((week - 1) * DAYSPERWEEK + 1 != rp->r_dayofmonth) + if ((rp->r_dayofmonth % DAYSPERWEEK) != 1) return -1; + week = 1 + rp->r_dayofmonth / DAYSPERWEEK; } else if (rp->r_dycode == DC_DOWLEQ) { if (rp->r_dayofmonth == len_months[1][rp->r_month]) week = 5; else { - week = 1 + rp->r_dayofmonth / DAYSPERWEEK; - if (week * DAYSPERWEEK - 1 != rp->r_dayofmonth) + if ((rp->r_dayofmonth % DAYSPERWEEK) != 0) return -1; + week = rp->r_dayofmonth / DAYSPERWEEK; } } else return -1; /* "cannot happen" */ (void) sprintf(result, "M%d.%d.%d", @@ -1928,7 +1975,7 @@ const int zonecount; if (stdrp != NULL && stdrp->r_hiyear == 2037) return; } - if (stdrp == NULL && zp->z_nrules != 0) + if (stdrp == NULL && (zp->z_nrules != 0 || zp->z_stdoff != 0)) return; abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar; doabbr(result, zp->z_format, abbrvar, FALSE, TRUE); @@ -1979,6 +2026,7 @@ const int zonecount; register char * envvar; register int max_abbr_len; register int max_envvar_len; + register int prodstic; /* all rules are min to max */ max_abbr_len = 2 + max_format_len + max_abbrvar_len; max_envvar_len = 2 * max_abbr_len + 5 * 9; @@ -1993,6 +2041,7 @@ const int zonecount; timecnt = 0; typecnt = 0; charcnt = 0; + prodstic = zonecount == 1; /* ** Thanks to Earl Chew ** for noting the need to unconditionally initialize startttisstd. @@ -2014,6 +2063,8 @@ const int zonecount; updateminmax(rp->r_loyear); if (rp->r_hiwasnum) updateminmax(rp->r_hiyear); + if (rp->r_lowasnum || rp->r_hiwasnum) + prodstic = FALSE; } } /* @@ -2036,6 +2087,16 @@ wp = ecpyalloc(_("no POSIX environment variable for zone")); if (max_year <= INT_MAX - YEARSPERREPEAT) max_year += YEARSPERREPEAT; else max_year = INT_MAX; + /* + ** Regardless of any of the above, + ** for a "proDSTic" zone which specifies that its rules + ** always have and always will be in effect, + ** we only need one cycle to define the zone. + */ + if (prodstic) { + min_year = 1900; + max_year = min_year + YEARSPERREPEAT; + } } /* ** For the benefit of older systems, |