[tz] [PROPOSED 2/3] Omit a few artifacts from zic output

Paul Eggert eggert at cs.ucla.edu
Fri Jun 14 00:01:38 UTC 2019


* NEWS: Mention this.
* zic.c (writezone): When optimizing, discard a transition if it
is marked as mergable and if it changes neither the UT offset, nor
the isdst flag, nor the time zone abbreviation.  This removes a
few useless transitions and types from the output when they are
merely artifacts of how the input was written.  For example,
without this fix Europe/London generates a useless transition
at the start of 1996, because the line "0:00 GB-Eire %s 1996"
has an UNTIL field that specifies 1996-01-01 00:00:00 *local time*,
unlike the previous transition specified at 1995-10-22 01:00:00 *UTC*,
which means addtype will incorrectly consider the 1996 transition
as being significant (as the two time types differ in their
ttisgmt value even though they do not differ in UT offset, isdst
flag, or time zone abbreviation).
---
 NEWS  | 3 +++
 zic.c | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index eb837ea..56bbc7f 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,9 @@ Unreleased, experimental changes
     longer needed for current tzdata, and caused problems with newlib
     when used with older tzdata (reported by David Gauchard).
 
+    zic no longer generates some artifact transitions.  For example,
+    Europe/London no longer has a no-op transition in January 1996.
+
   Changes to build procedure
 
     tzdata.zi now assumes zic 2017c or later.  This shrinks tzdata.zi
diff --git a/zic.c b/zic.c
index 3e27a48..d43cc0d 100644
--- a/zic.c
+++ b/zic.c
@@ -1873,7 +1873,12 @@ writezone(const char *const name, const char *const string, char version,
 			}
 			if (toi == 0
 			    || attypes[fromi].dontmerge
-			    || attypes[toi - 1].type != attypes[fromi].type)
+			    || (gmtoffs[attypes[toi - 1].type]
+				!= gmtoffs[attypes[fromi].type])
+			    || (isdsts[attypes[toi - 1].type]
+				!= isdsts[attypes[fromi].type])
+			    || (abbrinds[attypes[toi - 1].type]
+				!= abbrinds[attypes[fromi].type]))
 					attypes[toi++] = attypes[fromi];
 		}
 		timecnt = toi;
-- 
2.21.0




More information about the tz mailing list