From 4b78b8bb3f484c22c135fea5a4a201b1af681a22 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 30 Jul 2022 09:21:46 -0700
Subject: [PATCH 3/3] =?UTF-8?q?Don=E2=80=99t=20generate=20subseconds=20in?=
 =?UTF-8?q?=20vanguard=20form?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* NEWS: Remove the corresponding news item.
Also, mention the small cleanups of clock transitions.
* ziguard.awk: Generate subseconds only if VANGUARD_SUBSECONDS is
set, and add a comment that this feature is experimental and may
be changed or withdrawn.
---
 NEWS        | 14 +++++---------
 ziguard.awk | 11 +++++++++--
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index fdc87544..67a54630 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Unreleased, experimental changes
     Iran no longer observes DST after 2022.
     Rename Europe/Kiev to Europe/Kyiv.
     New zic -R option
-    Vanguard form now uses %z and subsecond precision.
+    Vanguard form now uses %z.
     New tailored_tarballs target, replacing rearguard_tarballs
 
   Changes to future timestamps
@@ -31,6 +31,10 @@ Unreleased, experimental changes
     their clocks back to rejoin the rest of mainland Chile; put this
     change at the end of 1946-08-28.  (Thanks to Michael Deckers.)
 
+    Some old, small clock transitions have been removed, as people at
+    the time did not change their clocks.  This affects Asia/Hong_Kong
+    in 1904, Asia/Ho_Chi_Minh in 1906, and Europe/Dublin in 1880.
+
   Changes to zone name
 
     Rename Europe/Kiev to Europe/Kyiv, as "Kyiv" is more common in
@@ -71,14 +75,6 @@ Unreleased, experimental changes
     to use %z eventually; in the meantime maintainers of zi parsers
     are encouraged to test the parsers on vanguard.zi.
 
-    Source data in vanguard form now uses subsecond precision,
-    introduced in release 2018d.  For example, for America/New_York
-    the UT offset before 1883-11-18 is now -4:56:01.6, and the
-    transition time that day is now 12:03:58.4.  Although TZif files
-    have only 1-second resolution so zic rounds these values to
-    -4:56:02 and 12:03:58 respectively, programs other than zic can
-    use the extra precision in the few cases where it is available.
-
     The Makefile has a new tailored_tarballs target for generating
     special-purpose tarballs.  It generalizes and replaces the
     rearguard_tarballs target and related targets and macros, which
diff --git a/ziguard.awk b/ziguard.awk
index 2f11f827..76d28f56 100644
--- a/ziguard.awk
+++ b/ziguard.awk
@@ -192,11 +192,18 @@ DATAFORM != "main" {
     }
   }
 
-  # Prefer subseconds in vanguard form, whole seconds otherwise.
+  # Normally, prefer whole seconds.  However, prefer subseconds
+  # if generating vanguard form and the otherwise-undocumented
+  # VANGUARD_SUBSECONDS environment variable is set.
+  # This relies on #STDOFF comment lines in the data.
+  # It is for hypothetical clients that support UT offsets that are
+  # not integer multiples of one second (e.g., Europe/Lisbon, 1884 to 1912).
+  # No known clients need this currently, and this experimental
+  # feature may be changed or withdrawn in future releases.
   if ($1 == "#STDOFF") {
     stdoff = $2
     rounded_stdoff = round_to_second(stdoff)
-    if (DATAFORM == "vanguard") {
+    if (DATAFORM == "vanguard" && ENVIRON["VANGUARD_SUBSECONDS"]) {
       stdoff_subst[0] = rounded_stdoff
       stdoff_subst[1] = stdoff
     } else {
-- 
2.34.1

