On 2026-10-15 14:07, Paul Eggert via tz wrote:
I've written the director of the IERS's Earth Orientation Center about this, as he maintains leap-seconds.list.
On further thought, now that leap seconds have been discontinued we should change zic to not put leap second table expiry info into the TZif output file, as per Internet RFC 9636 §3.2. I wrote the IERS EOC director about this too. We can also shrink TZ_MAX_LEAPS a bit, now that the number of leap seconds is capped. We should update the leap-second commentary too. Proposed patch attached and installed into the TZDB development repository.
From 3b9335c8935e560f76a2ebcfe31bf2869c4eefa1 Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Thu, 15 Oct 2026 16:26:05 -0700 Subject: [PROPOSED] No new leap seconds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update zic to no longer output leap second table expiry info, as per Internet RFC 9636 §3.2 “leap-second records”. Also, shrink localtime.c’s local data a bit, and update commentary about no more leap seconds. (Thanks to Garrett Wollman for the heads-up re no new leap seconds.) * Makefile, NEWS, date.1, theory.html, time2posix.3, tz-link.html: * zic.8: Mention the changes. * leapseconds.awk: Update generated comments. Don’t output a comment for a missing expiration, as that should not be typical. * tzfile.h (MAX_LEAPS): Lower from 50 to 27+1. * zic.c (inexpires, leapexpires, struct timerange.leapexpiry): Remove. All uses removed. (getleapdateandtime): Remove EXPIRE_LINE arg. All uses removed. --- Makefile | 18 ++++++++----- NEWS | 17 ++++++++++++ date.1 | 4 ++- leapseconds.awk | 39 +++++++++------------------ theory.html | 38 +++++++++++++-------------- time2posix.3 | 9 ++++--- tz-link.html | 64 ++++++++++++++++++-------------------------- tzfile.h | 6 ++--- zic.8 | 32 +++++----------------- zic.c | 70 ++++++++----------------------------------------- 10 files changed, 114 insertions(+), 183 deletions(-) diff --git a/Makefile b/Makefile index 96a7462e..e51ffe0f 100644 --- a/Makefile +++ b/Makefile @@ -129,6 +129,9 @@ TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ # What kind of TZif data files to generate. (TZif is the binary time # zone data format that zic generates; see Internet RFC 9636.) +# Although TZif files with leap second info are rarely used and the last +# leap second was in 2016, they are still supported for compatibility +# with historical timestamps generated via TZif files with leap seconds. # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only @@ -151,14 +154,17 @@ TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ REDO= posix_only # Whether to put an "Expires" line in the leapseconds file. -# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. -# The EXPIRES_LINE value matters only if REDO's value contains "right". +# Use EXPIRES_LINE=1 to put the "Expires" line in, 0 to omit it. +# This variable is obsolescent and should be removed in a future release. +# It defaults to 0 because the circa 2020 effort to support it +# became obsolete after the 2026 decision to discontinue leap seconds. +# The EXPIRES_LINE value does not affect the contents of TZif files; +# it affects only the leapseconds file itself, so it matters only if +# the leapseconds file is used directly by third-party software. # If you change EXPIRES_LINE, remove the leapseconds file before running "make". # zic's support for the Expires line was introduced in tzdb 2020a, -# and was modified in tzdb 2021b to generate version 4 TZif files. -# EXPIRES_LINE defaults to 0 for now so that the leapseconds file -# can be given to pre-2020a zic implementations and so that TZif files -# built by newer zic implementations can be read by pre-2021b libraries. +# was modified in tzdb 2021b to generate version 4 TZif files, +# and was removed after tzdb 2026e was released. EXPIRES_LINE= 0 # To install data in text form that has all the information of the TZif data, diff --git a/NEWS b/NEWS index 4db0c75d..61087886 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,23 @@ News for the tz database Unreleased, experimental changes + Briefly: + No more leap seconds, and leap second tables no longer expire. + + Changes to code + + zic now ignores Expires lines, as leap second tables in TZif files + no longer expire now that there are no more leap seconds; + see Internet RFC 9636 §3.2. (Thanks to Garrett Wollman for the + heads-up re no more leap seconds.) + + localtime.c no longer supports 49 leap seconds, as 27 now suffice. + zic now warns if you go over the new limit. + + Changes to documentation and commentary + + Documentation and commentary now reflect leap seconds’ demise. + Changes to commentary Discussion on timekeeping in northwestern Ontario has been updated diff --git a/date.1 b/date.1 index 8f2c212b..a9d50d93 100644 --- a/date.1 +++ b/date.1 @@ -18,6 +18,8 @@ date \- show and set date and time \fR[\fIyyyy\fR]\fImmddhhmm\fR[\fIyy\fR][\fB.\fIss\fR] ] .SH DESCRIPTION +.ie '\(en'' .ds en \- +.el .ds en \(en .ie '\(lq'' .ds lq \&"\" .el .ds lq \(lq\" .ie '\(rq'' .ds rq \&"\" @@ -77,6 +79,6 @@ hexadecimal (leading 0x), preceded by an optional sign. .br /usr/share/zoneinfo timezone directory .br -/usr/share/zoneinfo/Etc/UTC for UTC leap seconds, if supported +/usr/share/zoneinfo/Etc/UTC for leap seconds (1972\*(en2016), if supported .SH SEE ALSO .BR strftime (3). diff --git a/leapseconds.awk b/leapseconds.awk index b9986164..6abb5895 100644 --- a/leapseconds.awk +++ b/leapseconds.awk @@ -5,18 +5,11 @@ # This program uses awk arithmetic. POSIX requires awk to support # exact integer arithmetic only through 10**10, which means for NTP # timestamps this program works only to the year 2216, which is the -# year 1900 plus 10**10 seconds. However, in practice -# POSIX-conforming awk implementations invariably use IEEE-754 double -# and so support exact integers through 2**53. By the year 2216, -# POSIX will almost surely require at least 2**53 for awk, so for NTP -# timestamps this program should be good until the year 285,428,681 -# (the year 1900 plus 2**53 seconds). By then leap seconds will be -# long obsolete, as the Earth will likely slow down so much that -# there will be more than 25 hours per day and so some other scheme -# will be needed. +# year 1900 plus 10**10 seconds. However, this is not a practical problem +# as the last leap second was in 2016 and there will be no more. BEGIN { - print "# Allowance for leap seconds added to each time zone file." + print "# Leap seconds (1972-2016) optionally added to TZif files." print "" print "# This file is in the public domain." print "" @@ -24,7 +17,7 @@ BEGIN { print "# NIST/IERS format leap-seconds.list file, which can be copied from" print "# <https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list>" print "# or via a less-secure protocol and with different comments and" - print "# less volatile last-modified and expiration timestamps, from" + print "# less volatile timestamp metadata, from" print "# <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>." print "# For more about leap-seconds.list, please see" print "# The NTP Timescale and Leap Seconds" @@ -36,10 +29,8 @@ BEGIN { print "# (ITU-R) Recommendation TF.460-6 (02/2002)" print "# <https://www.itu.int/rec/R-REC-TF.460-6-200202-I/>." print "# The International Earth Rotation and Reference Systems Service (IERS)" - print "# periodically uses leap seconds to keep UTC to within 0.9 s of UT1" - print "# (a proxy for Earth's angle in space as measured by astronomers)" - print "# and publishes leap second data in a copyrighted file" - print "# <https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat>." + print "# periodically used leap seconds to keep UTC to within 0.9 s of UT1" + print "# (a proxy for Earth's angle in space as measured by astronomers)." print "# See: Levine J. Coordinated Universal Time and the leap second." print "# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995" print "# <https://ieeexplore.ieee.org/document/7909995>." @@ -51,8 +42,8 @@ BEGIN { print "# of UTC." print "" print "# All leap-seconds are Stationary (S) at the given UTC time." - print "# The correction (+ or -) is made at the given time, so in the unlikely" - print "# event of a negative leap second, a line would look like this:" + print "# The correction (+ or -) is made at the given time, so if a negative" + print "# leap second had ever occurred, a line would have looked like this:" print "# Leap YEAR MON DAY 23:59:59 - S" print "# Typical lines look like this:" print "# Leap YEAR MON DAY 23:59:60 + S" @@ -108,16 +99,15 @@ END { sstamp_to_ymdhMs(expires, ss_NTP) print "# UTC timestamp when this leap second list expires." - print "# Any additional leap seconds will come after this." + print "# The idea was that any additional leap seconds would come after this." + print "# This timestamp is obsolete as there will be no more leap seconds." if (! EXPIRES_LINE) { - print "# This Expires line is commented out for now," + print "# This Expires line is commented out, to avoid confusion, and" print "# so that pre-2020a zic implementations do not reject this file." } printf "%sExpires %.4d\t%s\t%.2d\t%.2d:%.2d:%.2d\n", \ EXPIRES_LINE ? "" : "#", \ ss_year, monthabbr[ss_month], ss_mday, ss_hour, ss_min, ss_sec - } else { - print "# (No Expires line, since the expires time is unknown.)" } # The difference between the NTP and POSIX epochs is 70 years @@ -130,9 +120,6 @@ END { print "# \"#updated\" gives the last time the leap seconds data changed" print "# or, if this file was derived from the IERS leap-seconds.list," print "# the last time that file changed in any way." - print "# \"#expires\" gives the first time this file might be wrong;" - print "# if this file was derived from the IERS leap-seconds.list," - print "# this is typically a bit less than one year after \"updated\"." if (updated) { sstamp_to_ymdhMs(updated, ss_NTP) printf "#updated %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ @@ -142,12 +129,12 @@ END { print "#(updated time unknown)" } if (expires) { + print "# \"#expires\" gives the first time this file might be wrong." + print "# This timestamp is obsolete as there will be no more leap seconds." sstamp_to_ymdhMs(expires, ss_NTP) printf "#expires %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ expires - epoch_minus_NTP, \ ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec - } else { - print "#(expires time unknown)" } printf "\n%s", last_lines } diff --git a/theory.html b/theory.html index 84c6b8df..3d322b31 100644 --- a/theory.html +++ b/theory.html @@ -838,12 +838,12 @@ href="https://dissentmagazine.org/online_articles/booked-a-global-history-of-tim The relationship between POSIX time (that is, <abbr>UTC</abbr> but ignoring <a href="https://en.wikipedia.org/wiki/Leap_second">leap seconds</a>) and <abbr>UTC</abbr> is not agreed upon. - This affects time stamps during the leap second era (1972–2035). + This affects time stamps during the leap second era (1972–2016). Although the POSIX - clock officially stops during an inserted leap second, at least one - proposed standard has it jumping back a second instead; and in - practice POSIX clocks more typically either progress glacially during - a leap second, or are slightly slowed while near a leap second. + clock officially stopped during an inserted leap second, + at least one proposed standard had it jumping back a second instead; + and in practice POSIX clocks more typically either progressed glacially + during a leap second, or were slightly slowed while near a leap second. </li> <li> The <code><abbr>tz</abbr></code> database does not represent how @@ -1347,35 +1347,33 @@ between now and the future time. <p> Leap seconds were introduced in 1972 to accommodate the difference between atomic time and the less regular rotation of the earth. -Unfortunately they have caused so many problems with civil -timekeeping that there are -<a href="https://www.bipm.org/en/cgpm-2022/resolution-4">plans -to discontinue them by 2035</a>. -Even if these plans come to fruition, a record of leap seconds will still be -needed to resolve timestamps from 1972 through 2035, -and there may also be a need to record whatever mechanism replaces them. +Unfortunately they caused so many problems with civil +timekeeping that the last leap second was in 2016. +A record of leap seconds is still +needed to resolve timestamps from 1972 through 2016, +and there may also be a need to record whatever mechanism replaces them +in the likely-distant future. </p> <p> The <code><abbr>tz</abbr></code> code and data can account for leap seconds, thanks to code contributed by Bradley White. -However, the leap second support of this package is rarely used directly +However, the leap second support of this package's code was rarely used +even before leap seconds were discontinued, because POSIX requires leap seconds to be excluded and many software packages would mishandle leap seconds if they were present. -Instead, leap seconds are more commonly handled by occasionally adjusting +Instead, leap seconds were more commonly handled by occasionally adjusting the operating system kernel clock as described in -<a href="tz-link.html#precision">Precision timekeeping</a>, +<a href="tz-link.html#leaps">Leap seconds</a>, and this package by default installs a <samp>leapseconds</samp> file commonly used by <a href="https://www.ntp.org"><abbr title="Network Time Protocol">NTP</abbr></a> -software that adjusts the kernel clock. -However, kernel-clock twiddling approximates UTC only roughly, -and systems needing more precise UTC can use this package’s leap -second support directly. +software that adjusted the kernel clock. </p> <p> -The directly supported mechanism assumes that <code>time_t</code> +In the rare case where this package's code is configured to support +leap seconds, it assumes that <code>time_t</code> counts of seconds since the POSIX epoch normally include leap seconds, as opposed to POSIX <code>time_t</code> counts which exclude leap seconds. This modified timescale is converted to <abbr>UTC</abbr> diff --git a/time2posix.3 b/time2posix.3 index f76915b1..5c56a407 100644 --- a/time2posix.3 +++ b/time2posix.3 @@ -27,15 +27,15 @@ IEEE Standard 1003.1 (POSIX) says that .B time_t -values cannot count leap +values do not count leap seconds and, therefore, -that the system time must be adjusted as each leap occurs. +that the system time was adjusted as each leap occurred. .PP If the time package is configured with leap-second support enabled, however, -no such adjustment is needed and +no such adjustment was needed and .B time_t values continue to increase over leap events (as a true @@ -120,7 +120,8 @@ DATE TIME T X Y .in .fi .PP -A leap second deletion would look like the following, and +No leap second deletion ever occurred. +However, if one had occurred it would have looked like the following, and posix2time(B+1) would return either A or A+1. .PP .in +2 diff --git a/tz-link.html b/tz-link.html index 8f836909..80e1aaf7 100644 --- a/tz-link.html +++ b/tz-link.html @@ -1074,6 +1074,18 @@ href="https://www.giss.nasa.gov/tools/mars24/help/notes.html">Mars24 Sunclock – Time on Mars</a> describes Airy Mean Time (<abbr>AMT</abbr>) and the diverse local time scales used by each landed mission on Mars.</li> +</ul> + +<h3 id="leaps">Leap seconds</h3> +<p>Leap seconds were introduced to adjust UTC on occasion +so that it agreed more closely with UT1, astronomical time. +There were 27 leap seconds, +ranging from 1972-06-30 23:59:60 through 2016-12-31 23:59:60 UTC. +The leap second approach was discontinued in 2026 due to difficulties +in implementing their use, and the current plan is to address the +disagreement between UTC and UT1 in a different way, +probably decades or centuries from now.</p> +<ul> <li><a href="http://leapsecond.com">LeapSecond.com</a> is dedicated not only to leap seconds but to precise time and frequency in general. It covers the state of the art in amateur timekeeping, and @@ -1086,11 +1098,11 @@ Radiocommunication Sector (ITU-R) Recommendation TF.460-6 (02/2002).</li> href="https://www.iers.org/IERS/EN/Publications/Bulletins/bulletins.html"><abbr title="International Earth Rotation and Reference Systems Service">IERS</abbr> Bulletins</a> contains official publications of the International -Earth Rotation and Reference Systems Service, which decides when leap -seconds occur. +Earth Rotation and Reference Systems Service, which decided when leap +seconds occurred. The <code><abbr>tz</abbr></code> code and data support leap seconds via an optional <code>"right"</code> configuration where a computer’s internal -<code>time_t</code> integer clock counts every <abbr>TAI</abbr> second, +<code>time_t</code> integer clock counted every <abbr>TAI</abbr> second, as opposed to the default <code>"posix"</code> configuration where the internal clock ignores leap seconds. The two configurations agree for timestamps starting with 1972-01-01 00:00:00 @@ -1106,7 +1118,7 @@ neither <abbr>UTC</abbr> nor <abbr>TAI</abbr> is well-defined for sufficiently old timestamps.</li> <li><a href="https://kb.meinbergglobal.com/kb/time_sync/ntp/configuration/ntp_leap_second_file">The <abbr>NTP</abbr> Leap Second File</a> covers the text file -<code>leap-seconds.list</code>, which lists the currently known leap seconds. +<code>leap-seconds.list</code>, which lists the historical leap seconds. The <abbr>IERS</abbr> maintains this file, and a copy is distributed by <code><abbr>tzdb</abbr></code> for use by <abbr>NTP</abbr> implementations like <a href="https://www.ntp.org">classic @@ -1119,16 +1131,16 @@ example, <code>right/UTC</code> can be used by <a href="https://chrony-project.org"><code>chrony</code></a>, another <abbr>NTP</abbr> implementation.</li> <li><a href="https://developers.google.com/time/smear">Leap Smear</a> -discusses how to gradually adjust <abbr>POSIX</abbr> clocks near a -leap second so that they disagree with <abbr>UTC</abbr> by at most a +discusses how systems gradually adjusted <abbr>POSIX</abbr> clocks near a +leap second so that they disagreed with <abbr>UTC</abbr> by at most a half second, even though every <abbr>POSIX</abbr> minute has exactly sixty seconds. This approach works with the default <code><abbr>tz</abbr></code> <code>"posix"</code> configuration, is <a href="https://gitlab.com/NTPsec/ntpsec/-/blob/master/docs/leapsmear.adoc">supported</a> by the <abbr>NTP</abbr> implementations mentioned above, <a href="https://github.com/google/unsmear">supports</a> conversion between -<abbr>UTC</abbr> and smeared <abbr>POSIX</abbr> timestamps, and is used by major -cloud service providers. However, according to +<abbr>UTC</abbr> and smeared <abbr>POSIX</abbr> timestamps, +and was used by major cloud service providers. However, according to <a href="https://www.rfc-editor.org/info/rfc8633#section-3.7.1">§3.7.1 of Network Time Protocol Best Current Practices</a> (Internet <abbr>RFC</abbr> 8633), leap smearing is not suitable for @@ -1140,38 +1152,12 @@ href="https://gge.ext.unb.ca/Resources/gpsworld.november99.pdf">McCarthy and Klepczynski’s 1999 proposal to discontinue leap seconds</a>, discussed further in <a href="https://www.cl.cam.ac.uk/~mgk25/time/metrologia-leapsecond.pdf">The -leap second: its history and possible future</a>. +leap second: its history and possible future</a> and in <a href="https://www.ucolick.org/~sla/leapsecs/"><abbr>UTC</abbr> -might be redefined -without Leap Seconds</a> gives pointers on this -contentious issue. -The General Conference on Weights and Measures (CGPM) -<a href="https://www.bipm.org/en/cgpm-2022/resolution-4">decided in 2022</a> -to discontinue the use of leap seconds by 2035, and requested that no -discontinuous adjustments be made to UTC for at least a century. -The World Radiocommunication Conference <a -href="https://www.itu.int/dms_pub/itu-r/opb/act/R-ACT-WRC.15-2023-PDF-E.pdf">resolved -in 2023</a> to cooperate with this process. A draft <a -href="https://www.bipm.org/documents/d/guest/cgpm-2026-draft-resolutions">Resolution -C to make continuous UTC effective on 2027-05-20</a>, -and thereby discontinue leap seconds, -has been scheduled for the 28th CGPM starting 2026-10-13 in Paris. -One proposal to implement this -would replace leap seconds with seven 13-second leap smears occurring once per -decade until 2100, with leap smears after that gradually increasing in size. -See: -<ul> -<li>Levine J. <a href="https://tf.nist.gov/general/pdf/3242.pdf">A -proposal to change the leap-second adjustments to -coordinated universal time</a>. <em>Metrologia.</em> 2024;61(5):055002. doi:<a -href="https://doi.org/10.1088/1681-7575/ad6266">10.1088/1681-7575/ad6266</a> -with followups in doi:<a -href="https://doi.org/10.1088/1681-7575/ade314">10.1088/1681-7575/ade314</a> -and doi:<a -href="https://doi.org/10.1088/1681-7575/ade315">10.1088/1681-7575/ade315</a>.</li> -</ul> -However, there is still no consensus on whether this is the best way -to replace leap seconds. +might be redefined without Leap Seconds</a>. +In 2026 the General Conference on Weights and Measures (CGPM) +<a href="https://www.bipm.org/en/cgpm-2026/resolution-5">resolved</a> +to discontinue the use of leap seconds. </li> </ul> diff --git a/tzfile.h b/tzfile.h index 1941bc3b..8a53330e 100644 --- a/tzfile.h +++ b/tzfile.h @@ -107,9 +107,9 @@ struct tzhead { #ifndef TZ_MAX_LEAPS /* The following limit applies to localtime.c; zic has no such limit. - The limit must be at least 27 for leap seconds from 1972 through mid-2023. - There's a plan to discontinue leap seconds by 2035. */ -# define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ + It must be at least 27 for all 27 historical leap seconds (1972-2016), + plus 1 for leap second table expiry as per TZif version 4. */ +# define TZ_MAX_LEAPS (27 + 1) /* Maximum number of leap second corrections */ #endif /* !defined TZ_MAX_LEAPS */ #endif /* !defined TZFILE_H */ diff --git a/zic.8 b/zic.8 index fcdbb673..15937e1e 100644 --- a/zic.8 +++ b/zic.8 @@ -291,10 +291,9 @@ The output contains a truncated leap second table, which can cause some older TZif readers to misbehave. This can occur if the .B "\-L" -option is used, and either an Expires line is present or -the +and .B "\-r" -option is also used. +options are both used. .PP The output file contains more than 1200 transitions, which may be mishandled by some clients. @@ -796,8 +795,7 @@ lines may appear in any order in the input. However, the behavior is unspecified if multiple zone or link lines define the same name. .PP -The file that describes leap seconds can have leap lines and an -expiration line. +The file that describes leap seconds can have leap lines. Leap lines have the following form: .nf .ti +2 @@ -852,26 +850,10 @@ However, rolling leap seconds are not supported if the .B \-r option is used. .PP -The expiration line, if present, has the form: -.nf -.ti +2 -.ta \w'Expires\0\0'u +\w'YEAR\0\0'u +\w'MONTH\0\0'u +\w'DAY\0\0'u -.sp -Expires YEAR MONTH DAY HH:MM:SS -.sp -For example: -.ti +2 -.sp -Expires 2020 Dec 28 00:00:00 -.sp -.fi -The -.BR YEAR , -.BR MONTH , -.BR DAY , -and -.B HH:MM:SS -fields give the expiration timestamp in UTC for the leap second table. +Any expiration line is ignored, as the last leap second was in 2016 +and there is no longer any reason for leap second tables to expire. +The ignored expiration line, if present, begins with the word +.q "Expires" . .br .ne 22 .SH "EXTENDED EXAMPLE" diff --git a/zic.c b/zic.c index 6e18893a..cd0dcac2 100644 --- a/zic.c +++ b/zic.c @@ -263,7 +263,6 @@ static void check_for_signal(void); static void dolink(const char *, const char *, bool); static int getfields(char *, char **, int); static zic_t getsave(char *, bool *); -static void inexpires(char **, int); static void infile(int, char const *); static void inleap(char ** fields, int nfields); static void inlink(char ** fields, int nfields); @@ -408,7 +407,7 @@ enum { LP_ROLL, LEAP_FIELDS, - /* Expires lines are like Leap lines, except without CORR and ROLL fields. */ + /* Expires lines were like Leap lines, but without CORR and ROLL fields. */ EXPIRES_FIELDS = LP_TIME + 1 }; @@ -1155,9 +1154,6 @@ static zic_t hi_time = MAXVAL(zic_t, TIME_T_BITS_IN_FILE); or lo_time, whichever is greater. */ static zic_t redundant_time = MINVAL(zic_t, TIME_T_BITS_IN_FILE); -/* The time specified by an Expires line, or negative if no such line. */ -static zic_t leapexpires = -1; - /* Set the time range of the output to TIMERANGE. Return true if successful. */ static bool @@ -2061,7 +2057,7 @@ infile(int fnum, char const *name) wantcont = false; break; case LC_EXPIRES: - inexpires(fields, nfields); + warning(N_("Expires line ignored")); wantcont = false; break; default: unreachable(); @@ -2321,7 +2317,7 @@ inzsub(char **fields, int nfields, bool iscont) } static zic_t -getleapdatetime(char **fields, bool expire_line) +getleapdatetime(char **fields) { register const struct lookup * lp; zic_t year; @@ -2336,13 +2332,11 @@ getleapdatetime(char **fields, bool expire_line) error(N_("invalid leaping year")); return -1; } - if (!expire_line) { - if (!leapseen || leapmaxyear < year) + if (!leapseen || leapmaxyear < year) leapmaxyear = year; - if (!leapseen || leapminyear > year) + if (!leapseen || leapminyear > year) leapminyear = year; - leapseen = true; - } + leapseen = true; if ((lp = byword(fields[LP_MONTH], mon_names)) == NULL) { error(N_("invalid month name")); return -1; @@ -2368,7 +2362,7 @@ inleap(char **fields, int nfields) if (nfields != LEAP_FIELDS) error(N_("wrong number of fields on Leap line")); else { - zic_t t = getleapdatetime(fields, false); + zic_t t = getleapdatetime(fields); if (0 <= t) { struct lookup const *lp = byword(fields[LP_ROLL], leap_types); if (!lp) @@ -2388,17 +2382,6 @@ inleap(char **fields, int nfields) } } -static void -inexpires(char **fields, int nfields) -{ - if (nfields != EXPIRES_FIELDS) - error(N_("wrong number of fields on Expires line")); - else if (0 <= leapexpires) - error(N_("multiple Expires lines")); - else - leapexpires = getleapdatetime(fields, true); -} - static void inlink(char **fields, int nfields) { @@ -2617,7 +2600,6 @@ struct timerange { int defaulttype; ptrdiff_t base, count; ptrdiff_t leapbase, leapcount; - bool leapexpiry; }; static struct timerange @@ -2656,9 +2638,6 @@ limitrange(struct timerange r, zic_t lo, zic_t hi, r.leapcount--; } - /* Determine whether to append an expiration to the leap second table. */ - r.leapexpiry = 0 <= leapexpires && leapexpires - 1 <= hi; - return r; } @@ -2774,20 +2753,12 @@ writezone(const char *const name, const char *const string, char version, ats, types); range32 = limitrange(range64, ZIC32_MIN, ZIC32_MAX, ats, types); - /* TZif version 4 is needed if a no-op transition is appended to - indicate the expiration of the leap second table, or if the first + /* TZif version 4 is needed if the first leap second transition is not to a +1 or -1 correction. */ for (pass = 1; pass <= 2; pass++) { struct timerange const *r = pass == 1 ? &range32 : &range64; if (pass == 1 && !want_bloat()) continue; - if (r->leapexpiry) { - if (noise) - warning(N_("%s: pre-2021b clients may mishandle" - " leap second expiry"), - name); - version = '4'; - } if (0 < r->leapcount && leap[r->leapbase].corr != 1 && leap[r->leapbase].corr != -1) { if (noise) @@ -2807,7 +2778,7 @@ writezone(const char *const name, const char *const string, char version, register ptrdiff_t thisleapi, thisleapcnt, thisleaplim; struct tzhead tzh; int pretranstype = -1, thisdefaulttype; - bool locut, hicut, thisleapexpiry; + bool locut, hicut; zic_t lo, thismin, thismax; int old0; char omittype[TZ_MAX_TYPES]; @@ -2825,7 +2796,6 @@ writezone(const char *const name, const char *const string, char version, toomanytimes = thistimecnt >> 31 >> 1 != 0; thisleapi = range32.leapbase; thisleapcnt = range32.leapcount; - thisleapexpiry = range32.leapexpiry; thismin = ZIC32_MIN; thismax = ZIC32_MAX; } else { @@ -2835,7 +2805,6 @@ writezone(const char *const name, const char *const string, char version, toomanytimes = thistimecnt >> 31 >> 31 >> 2 != 0; thisleapi = range64.leapbase; thisleapcnt = range64.leapcount; - thisleapexpiry = range64.leapexpiry; thismin = min_time; thismax = max_time; } @@ -2971,7 +2940,7 @@ writezone(const char *const name, const char *const string, char version, &chars[desigidx[i]]); if (pass == 1 && !want_bloat()) { - hicut = thisleapexpiry = false; + hicut = false; pretranstype = -1; thistimecnt = thisleapcnt = 0; thistypecnt = thischarcnt = 1; @@ -2982,7 +2951,7 @@ writezone(const char *const name, const char *const string, char version, tzh.tzh_version[0] = version; convert(utcnt, tzh.tzh_ttisutcnt); convert(stdcnt, tzh.tzh_ttisstdcnt); - convert(thisleapcnt + thisleapexpiry, tzh.tzh_leapcnt); + convert(thisleapcnt, tzh.tzh_leapcnt); convert((0 <= pretranstype) + thistimecnt + hicut, tzh.tzh_timecnt); convert(thistypecnt, tzh.tzh_typecnt); @@ -3066,15 +3035,6 @@ writezone(const char *const name, const char *const string, char version, puttzcodepass(todo, fp, pass); puttzcode(leap[i].corr, fp); } - if (thisleapexpiry) { - /* Append a no-op leap correction indicating when the leap - second table expires. Although this does not conform to - Internet RFC 9636, most clients seem to accept this and - the plan is to amend the RFC to allow this in version 4 - TZif files. */ - puttzcodepass(leapexpires, fp, pass); - puttzcode(thisleaplim ? leap[thisleaplim - 1].corr : 0, fp); - } if (stdcnt != 0) for (i = old0; i < typecnt; i++) if (!omittype[i]) @@ -3883,14 +3843,6 @@ adjleap(void) leap[i].trans = tadd(prevtrans, last); last = leap[i].corr += last; } - - if (0 <= leapexpires) { - leapexpires = oadd(leapexpires, last); - if (! (leapcnt == 0 || (leap[leapcnt - 1].trans < leapexpires))) { - error(N_("last Leap time does not precede Expires time")); - exit(EXIT_FAILURE); - } - } } /* Is A a space character in the C locale? */ -- 2.53.0
