[tz] Fractional seconds in zic input

Paul Eggert eggert at cs.ucla.edu
Sat Feb 10 03:16:36 UTC 2018


On 02/05/2018 07:04 PM, Steve Allen wrote:
> I am going to argue that sub-second resolutions based on the
> once-assumed longitudes of sites are down in the "technical details"
> level that tzdb does not want to record except in comments.

Thanks for looking into the problem and for coming up with such a clear and 
convincing argument. Although I'm not sure that subsecond precision would be 
wrong everywhere, it does seem clear that it would be useful only in a very few 
cases in tzdata, and the exact set of cases would be hard to determine reliably. 
That's a good argument to not bother to add it, so let's revert that. However, I 
would still like zic to accept (and simply discard) subsecond data on input, as 
this is a straightforward extension to the data format, is not likely to collide 
with any future extension, and may be of some use someday (say, if North Korea 
decides to use a non-integer UTC offset as some sort of protest against the 
tyranny of Western timekeeping :-).

Proposed patch attached.
-------------- next part --------------
From 08bc5f2389b6a2088da4e079d5d52717eeeaa0ab Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert at cs.ucla.edu>
Date: Fri, 9 Feb 2018 19:07:22 -0800
Subject: [PATCH] Remove subseconds from vanguard data
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* NEWS: Do not mention subseconds in data.
* theory.html: Improve description of problems with subseconds.
* zic.8: Don’t imply zic will someday transmit subsecond info.
* ziguard.awk: Remove translation of subseconds.
---
 NEWS        | 33 ++++++++++++++++-----------------
 theory.html | 11 +++++++----
 zic.8       |  2 +-
 ziguard.awk | 48 ++++++------------------------------------------
 4 files changed, 30 insertions(+), 64 deletions(-)

diff --git a/NEWS b/NEWS
index b13c356..6ca2724 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ Unreleased, experimental changes
 
   Briefly:
   Add support for vanguard and rearguard data consumers.
-  Add fractional seconds to source data format and to vanguard data.
+  Add subsecond precision to source data format, though not to data.
 
   Changes to past time stamps
 
@@ -30,16 +30,14 @@ Unreleased, experimental changes
 
     * In the current version, the main and rearguard formats are
       identical and match that of 2018c, so this change does not
-      affect default behavior.  The vanguard format contains two
-      features not in the main format: fractional seconds and negative
-      DST offsets.  Fractional seconds were added in this release,
-      where they affect only zic input (output is unaffected).
-      Negative DST offsets improve support for Ireland, which uses
-      Irish Standard Time (IST, UTC+01) in summer and GMT (UTC) in
-      winter.  tzcode has supported negative DST offsets for decades,
-      and this feature should move to the main format soon.  However,
-      it will not move to the rearguard format for quite some time
-      because some downstream parsers do not support it.
+      affect default behavior.  The vanguard format currently contains
+      one feature not in the main format: negative DST offsets.  This
+      improves support for Ireland, which uses Irish Standard Time
+      (IST, UTC+01) in summer and GMT (UTC) in winter.  tzcode has
+      supported negative DST offsets for decades, and this feature
+      should move to the main format soon.  However, it will not move
+      to the rearguard format for quite some time because some
+      downstream parsers do not support it.
 
     * The build procedure constructs three files vanguard.zi, main.zi,
       and rearguard.zi, one for each format.  The files represent the
@@ -54,12 +52,13 @@ Unreleased, experimental changes
 
   Changes to code
 
-    zic now accepts fractional seconds in expressions like 00:19:32.13
-    (the UT offset of the Netherlands from 1835 to 1937).  Although
-    zic currently rounds these fractions to the nearest integer
-    (breaking ties to the even integer), the fractions may be useful
-    to applications requiring more precision in historical timestamps.
-    This extension is currently used only in vanguard.zi.
+    zic now accepts subsecond precision in expressions like
+    00:19:32.13, which is approximately the legal time of the
+    Netherlands from 1835 to 1937.  However, because it is
+    questionable whether the few recorded uses of non-integer offsets
+    had subsecond precision in practice, there are no plans for tzdata
+    to use this feature.  (Thanks to Steve Allen for pointing out
+    the limitations of historical data in this area.)
 
     The code is a bit more portable to MS-Windows.  (Thanks to Manuela
     Friedrich).
diff --git a/theory.html b/theory.html
index ff82fd7..871aaa2 100644
--- a/theory.html
+++ b/theory.html
@@ -606,12 +606,15 @@ href="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanes
   </li>
   <li>
     Sometimes historical timekeeping was specified more precisely
-    than what the <code><abbr>tz</abbr></code> database can handle.
+    than what the <code><abbr>tz</abbr></code> code can handle.
     For example, from 1909 to 1937 <a
     href="https://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm"
-    hreflang="nl">Netherlands clocks</a> were legally <abbr>UT</abbr>
-    +00:19:32.13, but the <code><abbr>tz</abbr></code>
-    database cannot represent the fractional second.
+    hreflang="nl">Netherlands clocks</a> were legally Amsterdam Mean
+    Time (estimated to be <abbr>UT</abbr>
+    +00:19:32.13), but the <code><abbr>tz</abbr></code>
+    code cannot represent the fractional second.
+    In practice these old specifications were rarely if ever
+    implemented to subsecond precision.
   </li>
   <li>
     Even when all the timestamp transitions recorded by the
diff --git a/zic.8 b/zic.8
index 28e4bd6..634bc84 100644
--- a/zic.8
+++ b/zic.8
@@ -267,7 +267,7 @@ where hour 0 is midnight at the start of the day,
 and hour 24 is midnight at the end of the day.
 Although
 .I zic
-currently rounds fractional seconds to the nearest integer
+rounds times to the nearest integer second
 (breaking ties to the even integer), the fractions may be useful
 to other applications requiring greater precision.
 The source format does not specify any maximum precision.
diff --git a/ziguard.awk b/ziguard.awk
index 70376b7..7377501 100644
--- a/ziguard.awk
+++ b/ziguard.awk
@@ -4,13 +4,13 @@
 
 # This is not a general-purpose converter; it is designed for current tzdata.
 #
-# When converting to vanguard form, the output can use fractional seconds
-# and negative DST offsets.
+# When converting to vanguard form, the output can use negative DST
+# offsets.
 #
-# When converting to rearguard form, the output omits fractional
-# seconds and uses only positive DST offsets.  The idea is for the
-# output data to simulate the behavior of the input data as best it
-# can within the constraints of the rearguard format.
+# When converting to rearguard form, the output uses only positive DST
+# offsets.  The idea is for the output data to simulate the behavior
+# of the input data as best it can within the constraints of the
+# rearguard format.
 
 BEGIN {
   dst_type["vanguard.zi"] = 1
@@ -20,26 +20,6 @@ BEGIN {
   # The command line should set OUTFILE to the name of the output file.
   if (!dst_type[outfile]) exit 1
   vanguard = outfile == "vanguard.zi"
-
-  # List non-integer standard times more accurately if known.
-  # This list does not attempt to record every UT offset that is
-  # not an integral multiple of 1 s; it merely records those that
-  # do not appear to be just LMT.
-  frac["-5:36:13"] = "-5:36:13.3" # America/Costa_Rica before 1921
-  frac["-5:07:10"] = "-5:07:10.41" # America/Jamaica before 1912
-  frac["-4:16:48"] = "-4:16:48.25" # America/Cordoba etc. 1894-1920
-  frac["-0:36:45"] = "-0:36:44.68" # Europe/Lisbon before 1912
-  frac["-0:25:21"] = "-0:25:21.1" # Europe/Dublin 1880-1916
-  frac["0:19:32"] = "0:19:32.13" # Europe/Amsterdam before 1937
-  frac["1:39:49"] = "1:39:49.2" # Europe/Helsinki before 1921
-  frac["2:05:09"] = "2:05:08.9" # Africa/Cairo before 1900
-  frac["4:37:11"] = "4:37:10.8" # Asia/Tashkent before 1924
-  frac["7:06:30"] = "7:06:30.1333" #... Asia/Ho_Chi_Minh 1906-1911
-  frac["7:07:12"] = "7:07:12.5" # Asia/Jakarta before 1923
-  frac["7:36:42"] = "7:36:41.7" # Asia/Hong_Kong before 1904
-  frac["8:05:43"] = "8:05:43.2" # Asia/Shanghai before 1901
-
-  fract["23:47:12"] = "23:47:12.5" # Asia/Jakarta 1923-12-31 transition
 }
 
 /^Zone/ { zone = $2 }
@@ -62,22 +42,6 @@ outfile != "main.zi" {
       sub(/^/, "#")
     }
   }
-
-  # Add or remove fractional seconds as needed in UT offsets.
-  f = $1 == "Zone" ? 3 : 1
-  for (rounded in frac) {
-    original = frac[rounded]
-    if ($f == rounded || $f == original) {
-      $f = vanguard ? original : rounded
-    }
-  }
-  # Likewise for transition times.
-  for (rounded in fract) {
-    original = fract[rounded]
-    if ($(f + 6) == rounded || $(f + 6) == original) {
-      $(f + 6) = vanguard ? original : rounded
-    }
-  }
 }
 
 # If a Link line is followed by a Zone line for the same data, comment
-- 
2.7.4



More information about the tz mailing list