From 0fc9af0d9f987f25ac72ca5a6c2facedad77e9c6 Mon Sep 17 00:00:00 2001 From: Yoshito Umaoka Date: Wed, 13 Mar 2013 21:02:39 +0000 Subject: [PATCH] ICU-10036 Fixed the ICU zic problem with tzdata2013b America/Asuncion. The fix will move the start year of final rule set after overriding rule(s). X-SVN-Rev: 33417 --- icu4c/source/tools/tzcode/zic.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/icu4c/source/tools/tzcode/zic.c b/icu4c/source/tools/tzcode/zic.c index 5dc9db01bc9..bbc4df1540d 100644 --- a/icu4c/source/tools/tzcode/zic.c +++ b/icu4c/source/tools/tzcode/zic.c @@ -2209,18 +2209,24 @@ wp = ecpyalloc(_("no POSIX environment variable for zone")); for (j=0; jz_nrules; ++j) { rp = &zp->z_rules[j]; if (rp->r_hiyear == INT_MAX) { + if (rp->r_loyear > finalRuleYear) { + finalRuleYear = rp->r_loyear; + } if (finalRule1 == NULL) { finalRule1 = rp; - finalRuleYear = rp->r_loyear; - } else if (finalRule2 == NULL) { + } else if (finalRule2 == NULL) { finalRule2 = rp; - if (rp->r_loyear > finalRuleYear) { - finalRuleYear = rp->r_loyear; - } } else { error("more than two max rules found (ICU)"); exit(EXIT_FAILURE); } + } else if (rp->r_hiyear > finalRuleYear) { + /* There might be an overriding non-max rule + * applied to a specific year after the max rule's + * start year. In this case, we need change the + * start year of the final rules to the following + * year. */ + finalRuleYear = rp->r_hiyear + 1; } } if (finalRule1 != NULL && finalRule2 == NULL) { -- 2.40.0