From efac9ad4c45356aff7a12100083a0409369fcea3 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 6 Mar 2021 10:51:54 -0800
Subject: [PROPOSED] No zic -L truncation due to leapseconds Expires

Problem reported by Ian Abbott in:
https://mm.icann.org/pipermail/tz/2021-March/029909.html
* NEWS: Explain the situation.
* zic.8: Remove note about truncation.
* zic.c (adjleap): Do not truncate hi_time.
---
 NEWS  | 11 +++++++++++
 zic.8 |  3 ---
 zic.c |  2 --
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index 51fb3a9..0de05f3 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,17 @@ Unreleased, experimental changes
     This avoids races where a TZ setting would temporarily stop
     working while zic was installing a replacement file or link.
 
+    zic -L no longer omits the POSIX TZ string in its output.
+    Starting with 2020a, zic -L truncated its output according to the
+    "Expires" directive or "#expires" comment in the leapseconds file.
+    The resulting TZif files omitted daylight saving transitions after
+    the leap second table expired, which led to far less-accurate
+    predictions of times after the expiry.  Although future timestamps
+    cannot be converted accurately in the presence of leap seconds, it
+    is more accurate to convert near-future timestamps with a few
+    seconds error than with an hour error, so zic -L no longer
+    truncates output in this way.
+
     Fix bug that caused 'localtime' etc. to crash when TZ was
     set to a all-year DST string like "EST5EDT4,0/0,J365/25" that does
     not conform to POSIX but does conform to Internet RFC 8536.
diff --git a/zic.8 b/zic.8
index 60262d7..217cc08 100644
--- a/zic.8
+++ b/zic.8
@@ -720,9 +720,6 @@ The
 and
 .B HH:MM:SS
 fields give the expiration timestamp in UTC for the leap second table;
-.B zic
-outputs this expiration timestamp by truncating the end of the output
-file to the timestamp.
 If there is no expiration line,
 .B zic
 also accepts a comment
diff --git a/zic.c b/zic.c
index 05ecb6e..b3cfd71 100644
--- a/zic.c
+++ b/zic.c
@@ -3166,8 +3166,6 @@ adjleap(void)
 	    error(_("last Leap time does not precede Expires time"));
 	    exit(EXIT_FAILURE);
 	  }
-	  if (leapexpires <= hi_time)
-	    hi_time = leapexpires - 1;
 	}
 }
 
-- 
2.27.0

