aboutsummaryrefslogtreecommitdiff
path: root/contrib/tzdata/checktab.awk
diff options
context:
space:
mode:
authorPhilip Paeps <philip@FreeBSD.org>2022-03-22 15:54:06 +0000
committerPhilip Paeps <philip@FreeBSD.org>2022-03-22 15:54:06 +0000
commitb7e7657b02f2ce9ce26a8fa12482ef25aaebe814 (patch)
treed68817e78bbe266ccbc7b171fe4823fce5c6d60a /contrib/tzdata/checktab.awk
parentc083dab137274868273d46709d0690e588f51ec5 (diff)
contrib/tzdata: import tzdata 2022a
Merge commit '971fa603f2bdf16273135a00ff16c5585520c53f' Changes: https://github.com/eggert/tz/blob/2022a/NEWS With this merge, we return to our previous long-standing practice of distributing the IANA Time Zone Database unmodified. Releases of tzdb since 2021b have merged some time zones where clocks have agreed since 1970. The overwhelming majority of users will not be affected by this change. A port of the newly created global-tz fork of the IANA Time Zone database (misc/global-tz) is available for users who need more granular pre-1970 time zone history. Approved by: re (gjb) (cherry picked from commit 8ea5af2b77f2b43c250cacb257f42c0a54d644c4) (cherry picked from commit 5dbd160076c09b0a3c7b175b506a57bd8b71f22a)
Diffstat (limited to 'contrib/tzdata/checktab.awk')
-rw-r--r--contrib/tzdata/checktab.awk50
1 files changed, 24 insertions, 26 deletions
diff --git a/contrib/tzdata/checktab.awk b/contrib/tzdata/checktab.awk
index ec145b5adf95..23e0a3a5c567 100644
--- a/contrib/tzdata/checktab.awk
+++ b/contrib/tzdata/checktab.awk
@@ -58,11 +58,12 @@ BEGIN {
zone_table, zone_NR >>"/dev/stderr"
status = 1
}
- split($1, cca, /,/)
- cc = cca[1]
+ ccs = input_ccs[zone_NR] = $1
coordinates = $2
tz = $3
- comments = $4
+ comments = input_comments[zone_NR] = $4
+ split(ccs, cca, /,/)
+ cc = cca[1]
# Don't complain about a special case for Crimea in zone.tab.
# FIXME: zone.tab should be removed, since it is obsolete.
@@ -77,12 +78,9 @@ BEGIN {
cc0 = cc
tz0 = tz
tztab[tz] = 1
- tz2comments[tz] = comments
tz2NR[tz] = zone_NR
for (i in cca) {
cc = cca[i]
- cctz = cc tz
- cctztab[cctz] = 1
if (cc2name[cc]) {
cc_used[cc]++
} else {
@@ -99,27 +97,27 @@ BEGIN {
}
}
- for (cctz in cctztab) {
- cc = substr (cctz, 1, 2)
- tz = substr (cctz, 3)
- if (1 < cc_used[cc]) {
- comments_needed[tz] = cc
- }
- }
- for (cctz in cctztab) {
- cc = substr (cctz, 1, 2)
- tz = substr (cctz, 3)
- if (!comments_needed[tz] && tz2comments[tz]) {
+ for (i = 1; i <= zone_NR; i++) {
+ ccs = input_ccs[i]
+ if (!ccs) continue
+ comments = input_comments[i]
+ split(ccs, cca, /,/)
+ used_max = 0
+ for (j in cca) {
+ cc = cca[j]
+ if (used_max < cc_used[cc]) {
+ used_max = cc_used[cc]
+ }
+ }
+ if (used_max <= 1 && comments) {
printf "%s:%d: unnecessary comment '%s'\n", \
- zone_table, tz2NR[tz], tz2comments[tz] \
- >>"/dev/stderr"
- tz2comments[tz] = 0
+ zone_table, i, comments \
+ >>"/dev/stderr"
status = 1
- } else if (comments_needed[tz] && !tz2comments[tz]) {
+ } else if (1 < cc_used[cc] && !comments) {
printf "%s:%d: missing comment for %s\n", \
- zone_table, tz2NR[tz], comments_needed[tz] \
+ zone_table, i, cc \
>>"/dev/stderr"
- tz2comments[tz] = 1
status = 1
}
}
@@ -149,8 +147,8 @@ $1 ~ /^#/ { next }
ruleUsed[$2] = 1
if ($3 ~ /%/) rulePercentUsed[$2] = 1
}
- if (tz && tz ~ /\//) {
- if (!tztab[tz]) {
+ if (tz && tz ~ /\// && tz !~ /^Etc\//) {
+ if (!tztab[tz] && FILENAME != "backward") {
printf "%s: no data for '%s'\n", zone_table, tz \
>>"/dev/stderr"
status = 1
@@ -173,7 +171,7 @@ END {
}
}
for (tz in tztab) {
- if (!zoneSeen[tz]) {
+ if (!zoneSeen[tz] && tz !~ /^Etc\//) {
printf "%s:%d: no Zone table for '%s'\n", \
zone_table, tz2NR[tz], tz >>"/dev/stderr"
status = 1