>From 401c42d991d4277cd606933fc9f5d9a13d1ac228 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 18 Oct 2018 11:06:07 -0700
Subject: [PROPOSED] Avoid 25:00 in rearguard format

(Problem reported by Christos Zoulas.)
* NEWS: Mention this.
* ziguard.awk: Change "Rule ... Sat>=8 25:00" to "Rule ... Sun>=9 1:00".
---
 NEWS        | 11 +++++++++++
 ziguard.awk |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/NEWS b/NEWS
index aeeef10..16f0947 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,16 @@
 News for the tz database
 
+Unreleased, experimental changes
+
+  Changes to code
+
+    The translator to rearguard format now rewrites the line
+    "Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
+    "Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
+    This caters to zic before 2007 and to at least one Java-based zi
+    compiler of uncertain vintage.  (Reported by Christos Zoulas.)
+
+
 Release 2018f - 2018-10-18 00:14:18 -0700
 
   Briefly:
diff --git a/ziguard.awk b/ziguard.awk
index 42e2910..e3c7298 100644
--- a/ziguard.awk
+++ b/ziguard.awk
@@ -80,6 +80,13 @@ DATAFORM != "main" {
   if (comment_out) {
     sub(/^/, "#")
   }
+
+  # In rearguard format, change the Japan rule line with "Sat>=8 25:00"
+  # to "Sun>=9 1:00", to cater to zic before 2007 and to older Java.
+  if (!vanguard && $1 == "Rule" && $7 == "Sat>=8" && $8 == "25:00") {
+    sub(/Sat>=8/, "Sun>=9")
+    sub(/25:00/, " 1:00")
+  }
 }
 
 # If a Link line is followed by a Zone line for the same data, comment
-- 
2.17.2

