From 88d6ecd175f6b03fc8a4617529f1e0943174f1a6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 12 Sep 2021 16:35:27 -0700 Subject: [PROPOSED] Improve wording about ambiguous leapsec fix Problem reported by Michael Deckers in: https://mm.icann.org/pipermail/tz/2021-September/030362.html * NEWS, tzfile.5: Improve wording re leap seconds not at the end of a localtime minute. Say this occurs only with "right" zones. --- NEWS | 20 +++++++++++--------- tzfile.5 | 5 ++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 6a77932..1b5535a 100644 --- a/NEWS +++ b/NEWS @@ -109,19 +109,21 @@ Unreleased, experimental changes transition in the table, or when handling far-future timestamps in slim TZif files lacking leap seconds. - Fix localtime misbehavior involving positive leap seconds in a - timezone with a UTC offset that is not on a minute boundary. + Fix localtime misbehavior involving positive leap seconds. + This change affects only behavior for "right" system time, + which contains leap seconds, and only if the UT offset is + not a multiple of 60 seconds when a positive leap second occurs. (No such timezone exists in tzdb, luckily.) Without the fix, the timestamp was ambiguous during a positive leap second. - With the fix, the localtime leap second appears at the end of the - localtime minute containing the UTC second just before the UTC - leap second, which means leapseconds roll slightly in these - oddball timezones. Here is how the fix affects timestamps in a - timezone with UTC offset +01:23:45 and with a positive leap second - 78796801 (1972-06-30 23:59:60 UTC): + With the fix, any seconds occurring after a positive leap second + and within the same localtime minute are counted through 60, not + through 59; their UT offset (tm_gmtoff) is the same as before. + Here is how the fix affects timestamps in a timezone with UT + offset +01:23:45 (5025 seconds) and with a positive leap second at + 1972-06-30 23:59:60 UTC (78796800): time_t without the fix with the fix - 78796800 1972-07-01 01:23:45 1972-07-01 01:23:45 + 78796800 1972-07-01 01:23:45 1972-07-01 01:23:45 (leap second) 78796801 1972-07-01 01:23:45 1972-07-01 01:23:46 ... 78796815 1972-07-01 01:23:59 1972-07-01 01:23:60 diff --git a/tzfile.5 b/tzfile.5 index 4a88b75..cf7d4af 100644 --- a/tzfile.5 +++ b/tzfile.5 @@ -282,7 +282,10 @@ the actual file size, as part of a validity check for the file. .PP When a positive leap second occurs, readers should append a 60th second to the local minute containing the second just before the leap -second. +second. If this occurs when the UTC offset is not a multiple of 60 +seconds, the leap second occurs earlier than the last second of the +local minute and the minute's remaining local seconds are numbered +through 60 instead of the usual 59; the UTC offset is unaffected. .SS Common interoperability issues This section documents common problems in reading or writing TZif files. Most of these are problems in generating TZif files for use by -- 2.30.2