Date: Sat, 25 Jul 2026 17:09:31 +0000 From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 8c2e1dee383c - stable/15 - tzcode: Update to 2026c Message-ID: <6a64edcb.20388.6a806873@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=8c2e1dee383cd23d205b5eb3f591057b209e6ed1 commit 8c2e1dee383cd23d205b5eb3f591057b209e6ed1 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2026-07-09 08:22:09 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2026-07-25 17:09:23 +0000 tzcode: Update to 2026c MFC after: 1 week (cherry picked from commit 28f617de7d9b9c708eacb3c2c13e5287e1b7354d) --- contrib/tzcode/Makefile | 45 ++---- contrib/tzcode/NEWS | 77 ++++++++- contrib/tzcode/localtime.c | 78 ++++++---- contrib/tzcode/newctime.3 | 20 +-- contrib/tzcode/newstrftime.3 | 4 +- contrib/tzcode/newtzset.3 | 16 +- contrib/tzcode/private.h | 24 ++- contrib/tzcode/theory.html | 18 +-- contrib/tzcode/tz-art.html | 32 ++-- contrib/tzcode/tz-how-to.html | 6 +- contrib/tzcode/tz-link.html | 50 +++--- contrib/tzcode/version | 2 +- contrib/tzcode/zdump.c | 66 ++------ contrib/tzcode/zic.8 | 4 +- contrib/tzcode/zic.c | 351 ++++++++++++++++++++++-------------------- 15 files changed, 414 insertions(+), 379 deletions(-) diff --git a/contrib/tzcode/Makefile b/contrib/tzcode/Makefile index 1e0a5903534d..f5a22f1896a4 100644 --- a/contrib/tzcode/Makefile +++ b/contrib/tzcode/Makefile @@ -114,7 +114,7 @@ ZDUMPDIR = $(BINDIR) # The "zic" command goes in: ZICDIR = $(TOPDIR)/$(USRDIR)/sbin -# Manual pages go in subdirectories of. . . +# Manual pages go in subdirectories of: MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man # Library functions are put in an archive in LIBDIR. @@ -145,7 +145,7 @@ TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ # nonnegative TZ_CHANGE_INTERVAL also assumes this, so to be compatible with # these, use "posix_only" or "posix_right". Use POSIX time on systems with # leap smearing; this can work better than unsmeared "right" time with -# applications that are not leap second aware, and is closer to unsmeared +# applications that are not aware of leap seconds, and is closer to unsmeared # "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). REDO= posix_only @@ -295,10 +295,10 @@ LDLIBS= # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; # not needed by the main-program tz code, which is single-threaded. # Append other compiler flags as needed, e.g., -pthread on GNU/Linux. -# The following options can also be used: +# With -DTHREAD_SAFE the following options can also be used: # -DTHREAD_PREFER_SINGLE to prefer speed in single-threaded apps, # at some cost in CPU time and energy in multi-threaded apps. -# The following options can also be used: +# With -DTHREAD_PREFER_SINGLE the following options can also be used: # -DHAVE___ISTHREADED=1 if there is an extern int __isthreaded # variable, 0 otherwise (default is guessed) # -DHAVE_SYS_SINGLE_THREADED_H=0 if <sys/single_threaded.h> works, @@ -377,12 +377,13 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \ -Wdeclaration-after-statement -Wdouble-promotion \ -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \ -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ - -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ + -Wfree-labels -Wimplicit-fallthrough=5 -Winit-self \ + -Wkeyword-macro -Wlogical-op \ -Wmissing-declarations -Wmissing-prototypes \ -Wmissing-variable-declarations -Wnested-externs \ -Wnull-dereference \ -Wold-style-definition -Woverlength-strings -Wpointer-arith \ - -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ + -Wshadow -Wshift-overflow=2 \ -Wstrict-prototypes -Wstringop-overflow=4 \ -Wsuggest-attribute=cold \ -Wsuggest-attribute=const -Wsuggest-attribute=format \ @@ -533,7 +534,7 @@ ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' # mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. # Also, it is better (though not essential) if 'awk' supports UTF-8, # and unfortunately mawk and busybox awk do not support UTF-8. -# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. +# Try AWK=gawk or AWK=nawk if your awk has the problems mentioned above. AWK= awk # The full path name of a POSIX-compliant shell, preferably one that supports @@ -913,7 +914,7 @@ tzselect: tzselect.ksh version check: check_mild back.ck now.ck check_mild: check_web check_zishrink \ character-set.ck white-space.ck links.ck mainguard.ck \ - name-lengths.ck slashed-abbrs.ck sorted.ck \ + name-lengths.ck news.ck slashed-abbrs.ck sorted.ck \ tables.ck ziguard.ck tzs.ck # True if UTF8_LOCALE does not work; @@ -1083,6 +1084,12 @@ zishrink-posix.ck zishrink-right.ck: \ rm -fr $@d t-$@d shrunk-$@d touch $@ +# Check that NEWS has data release versions and dates in reverse order. +news.ck: NEWS + grep '^Release [0-9][0-9][0-9][0-9]' NEWS | LC_ALL=C sort -cru + sed -n '/ -0000$$/!s/^Release [^ ]*//p' NEWS|LC_ALL=C sort -cru + touch $@ + clean_misc: rm -fr *.ckd *.dir rm -f *.ck *.core *.o *.out *.t core core.* \ @@ -1139,7 +1146,8 @@ SET_TIMESTAMP_N = sh -c '\ # If DEST depends on A B C ... in this Makefile, callers should use # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any # downstream 'make' that considers equal timestamps to be out of date. -# POSIX allows this 'make' behavior, and HP-UX 'make' does it. +# POSIX allows this 'make' behavior, although only HP-UX 'make' +# (which is no longer supported) did things that way. # If all that matters is that the timestamp be reproducible # and plausible, use $(SET_TIMESTAMP). SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0 @@ -1399,24 +1407,6 @@ $(ALL_ASC): $(SET_TIMESTAMP) $(@:.t=) $(?:.t=) touch $@ -TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T -typecheck: long-long.ck unsigned.ck -long-long.ck unsigned.ck: $(VERSION_DEPS) - rm -fr $@d - mkdir $@d - ln $(VERSION_DEPS) $@d - cd $@d && \ - case $@ in \ - long-long.*) i="long long";; \ - unsigned.* ) i="unsigned" ;; \ - esac && \ - $(MAKE) \ - CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ - TOPDIR="$$PWD" \ - install - $@d/zdump -i -c 1970,1971 Europe/Rome - touch $@ - zonenames: tzdata.zi @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi @@ -1442,6 +1432,5 @@ zic.o: private.h tzdir.h tzfile.h version.h .PHONY: traditional_signatures traditional_signatures_version .PHONY: traditional_tarballs traditional_tarballs_version .PHONY: tailored_tarballs tailored_tarballs_version -.PHONY: typecheck .PHONY: zonenames zones .PHONY: $(ZDS) diff --git a/contrib/tzcode/NEWS b/contrib/tzcode/NEWS index ea52e67e804a..dd962b54d529 100644 --- a/contrib/tzcode/NEWS +++ b/contrib/tzcode/NEWS @@ -1,5 +1,68 @@ News for the tz database +Release 2026c - 2026-07-08 10:23:58 -0700 + + Briefly: + Alberta moved to permanent -06 on 2026-06-18. + Morocco moves to permanent +00 on 2026-09-20. + More integer overflow bugs have been fixed in zic. + + Changes to future timestamps + + Alberta’s 2026-03-08 spring forward was its last foreseeable clock + change, as it moved to permanent -06 thereafter. (Thanks to Roozbeh + Pournader and others.) Model this with its traditional abbreviation + CST. Although the change to permanent -06 legally took place on + 2026-06-18, temporarily model the change to occur on 2026-11-01 at + 02:00 instead, for the same reason we introduced a similarly + temporary hack for British Columbia in 2026b. + + Although another TZDB release will likely be needed soon because + Northwest Territories will likely follow Alberta, the legal + formalities have not yet taken place. + + Morocco plans to move back to permanent UTC, without daylight + saving time transitions, on 2026-09-20 at 02:00. This also + affects Western Sahara. + + Changes to code + + zic no longer overflows integers when processing outlandish input + like ‘Zone Ouch 0 - LMT 9223372036854775807’, ‘Zone Ouch 0 + 2562047788015215 LMT’, ‘Zone Ouch -2562047788015215:30:08 - LMT’, + and ‘Zone Ouch -2562047788015215:30:08 - %%z’. This avoids + undefined behavior in C. (Problems reported by Naveed Khan.) + + On platforms that have EFTYPE, tzalloc now fails with errno set to + EFTYPE, not EINVAL, if it detects that the TZif file has an + invalid format or is not a regular file. Formerly it did this + only on NetBSD, and only when the file was not a regular file. + + Unprivileged programs no longer require TZif files to be regular + files or reject relative names containing ".." components. This + reverts to the more-permissive 2025b behavior, as the stricter + behavior did not catch on in FreeBSD. + + zic now reports any failure to remove a temporary file when + cleaning up after a previous failure. (Problem reported by Tom + Lane.) + + Changes to commentary + + Northwest Territories is expected to move to permanent -06 prior to + 2026-11-01 02:00, when clocks would otherwise fall back. (Thanks to + Tim Parenti and James Bellaire.) Model this with its traditional + abbreviation CST. Unfortunately the change is not yet official, so + it is currently present only as comments that can be uncommented as + needed. + + Changes to build procedure + + The undocumented ‘typecheck’ Makefile check rule has been removed. + It stopped working in 2025a and evidently nobody noticed. + The rule was superseded by ‘check_time_t_alternatives’ in 2013d. + + Release 2026b - 2026-04-22 23:06:43 -0700 Briefly: @@ -13,7 +76,7 @@ Release 2026b - 2026-04-22 23:06:43 -0700 (Thanks to Arthur David Olson.) Although the change to permanent -07 legally took place on 2026-03-09, temporarily model the change to occur on 2026-11-01 at 02:00 instead. This works around a - limitation in CLDR v48.2 (2026-03-17). This temporary hack is + limitation in CLDR 48.1 (2026-01-08). This temporary hack is planned to be removed after CLDR is fixed. Changes to code @@ -99,7 +162,7 @@ Release 2026a - 2026-03-01 22:59:49 -0800 than attempting to override this fallback with the contents of the posixrules file. This removes library support that was declared obsolete in release 2019b, and fixes some undefined behavior. - (Undefined behavior reported by GitHub user Naveed8951.) + (Undefined behavior reported by Naveed Khan.) The posix2time, posix2time_z, time2posix, and time2posix_z functions now set errno=EOVERFLOW and return ((time_t) -1) if the @@ -111,7 +174,7 @@ Release 2026a - 2026-03-01 22:59:49 -0800 Some other undefined behavior, triggered by TZif files containing outlandish but conforming UT offsets or leap second corrections, - has also been fixed. (Some of these bugs reported by Naveed8951.) + has also been fixed. (Some of these bugs reported by Naveed Khan.) localtime.c no longer rejects TZif files that exactly fit in its internal structures, fixing off-by-one typos introduced in 2014g. @@ -221,7 +284,7 @@ Release 2025c - 2025-12-10 14:42:37 -0800 rarely changing and many threads call tzcode simultaneously. It costs more CPU time and energy. - The new CFLAGS option -TTHREAD_TM_MULTI causes localtime to return + The new CFLAGS option -DTHREAD_TM_MULTI causes localtime to return a pointer to thread-specific memory, as FreeBSD does, instead of to the same memory in all threads. This supports nonportable programs that incorrectly use localtime instead of localtime_r. @@ -551,7 +614,7 @@ Release 2024a - 2024-02-01 09:28:56 -0800 The leap-seconds.list file is now copied from the IERS instead of from its downstream counterpart at NIST, as the IERS version is now in the public domain too and tends to be more up-to-date. - (Thanks to Martin Burnicki for liaisoning with the IERS.) + (Thanks to Martin Burnicki for liaising with the IERS.) Changes to documentation @@ -1709,7 +1772,7 @@ Release 2020a - 2020-04-23 16:03:47 -0700 zic -L now supports an Expires line in the leapseconds file, and truncates the TZif output accordingly. This propagates leap second expiration information into the TZif file, and avoids the - abovementioned localtime.c bug as well as similar bugs present in + localtime.c bug mentioned above, as well as similar bugs present in many client implementations. If no Expires line is present, zic -L instead truncates the TZif output based on the #expires comment present in leapseconds files distributed by tzdb 2018f and later; @@ -6666,7 +6729,7 @@ few (e.g., code2012c-data2012d) have tarballs with mixed version numbers. Recent releases also come in an experimental format consisting of a single tarball tzdb-R.tar.lz with extra data. -Release timestamps are taken from the release's commit (for newer, +A release’s timestamp is taken from the release’s commit (for newer, Git-based releases), from the newest file in the tarball (for older releases, where this info is available) or from the email announcing the release (if all else fails; these are marked with a time zone diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index 459d818f0d7b..cd1bc8bd7523 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -227,7 +227,7 @@ struct timespec { time_t tv_sec; long tv_nsec; }; /* How many seconds to wait before checking the default TZif file again. Negative means no checking. Default to 61 if DETECT_TZ_CHANGES - (as circa 2025 FreeBSD builds its localtime.c with -DDETECT_TZ_CHANGES), + (as FreeBSD optionally builds its localtime.c with -DDETECT_TZ_CHANGES), and to -1 otherwise. */ #ifndef TZ_CHANGE_INTERVAL # ifdef DETECT_TZ_CHANGES @@ -288,10 +288,12 @@ typedef intmax_t timex_t; # endif #endif -/* Placeholders for platforms lacking openat. */ +/* Placeholders for platforms lacking AT_FCWD, openat, and fstatat. */ #ifndef AT_FDCWD # define AT_FDCWD (-1) /* any negative value will do */ static int openat(int dd, char const *path, int oflag) { unreachable (); } +static int fstatat(int dd, char const *path, struct stat *st, int flags) +{ unreachable(); } #endif /* Port to platforms that lack some O_* flags. Unless otherwise @@ -425,8 +427,7 @@ static char const *utc = etc_utc + sizeof "Etc/" - 1; approach of opening "/usr/share/zoneinfo/America/Los_Angeles". Although the OPENAT_TZDIR approach is less efficient, suffers from spurious EMFILE and ENFILE failures, and is no more secure in practice, - it is how bleeding edge FreeBSD did things from August 2025 - through at least September 2025. */ + bleeding edge FreeBSD started doing it this way in August 2025. */ #ifndef OPENAT_TZDIR # define OPENAT_TZDIR 0 #endif @@ -917,6 +918,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, int dd = AT_FDCWD; int oflags = (O_RDONLY | O_BINARY | O_CLOEXEC | O_CLOFORK | O_IGNORE_CTTY | O_NOCTTY | O_REGULAR); + bool might_escape = false; int err; struct stat st; st.st_ctime = 0; @@ -946,16 +948,8 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, continue; else if (issetugid()) return ENOTCAPABLE; - else if (!O_REGULAR) { - /* Check for devices, as their mere opening could have - unwanted side effects. Though racy, there is no - portable way to fix the races. This check is needed - only for files not otherwise known to be non-devices. */ - if (stat(name, &st) < 0) - return errno; - if (!S_ISREG(st.st_mode)) - return EINVAL; - } + else + might_escape = true; } if (relname[0] != '/') { @@ -967,8 +961,12 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, for (component = relname; component[0]; component++) if (component[0] == '.' && component[1] == '.' && component[2] == '/' - && (component == relname || component[-1] == '/')) - return ENOTCAPABLE; + && (component == relname || component[-1] == '/')) { + if (issetugid()) + return ENOTCAPABLE; + might_escape = true; + break; + } } if (OPENAT_TZDIR && !SUPPRESS_TZDIR) { @@ -981,10 +979,10 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, | O_BINARY | O_CLOEXEC | O_CLOFORK | O_DIRECTORY)); if (dd < 0) return errno; -#ifdef __FreeBSD__ - if (issetugid()) -#endif /* __FreeBSD__ */ - oflags |= O_RESOLVE_BENEATH; + if (O_RESOLVE_BENEATH && issetugid()) { + oflags |= O_RESOLVE_BENEATH; + might_escape = false; + } } } @@ -1020,6 +1018,18 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, #endif } + /* For a platform that lacks O_REGULAR and a file that might + be outside TZDIR, check that it is a regular file, + as merely opening a device could have unwanted side effects. + Though racy, there is no portable way to fix the race. */ + if (!O_REGULAR && might_escape) { + /* (oflags & O_RESOLVE_BENEATH) must be zero here. */ + if ((OPENAT_TZDIR ? fstatat(dd, relname, &st, 0) : stat(name, &st)) + < 0) + return errno; + if (!S_ISREG(st.st_mode)) + return EFTYPE; + } fid = OPENAT_TZDIR ? openat(dd, relname, oflags) : open(name, oflags); err = errno; if (0 <= dd) @@ -1042,7 +1052,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, } up = &lsp->u.u; nread = read(fid, up->buf, sizeof up->buf); - err = tzheadsize <= nread ? 0 : nread < 0 ? errno : EINVAL; + err = tzheadsize <= nread ? 0 : nread < 0 ? errno : EFTYPE; } close(fid); if (err) @@ -1070,7 +1080,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, && 0 <= charcnt && charcnt <= TZ_MAX_CHARS && 0 <= ttisstdcnt && ttisstdcnt <= TZ_MAX_TYPES && 0 <= ttisutcnt && ttisutcnt <= TZ_MAX_TYPES)) - return EINVAL; + return EFTYPE; datablock_size = (timecnt * stored /* ats */ + timecnt /* types */ @@ -1080,12 +1090,12 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, + ttisstdcnt /* ttisstds */ + ttisutcnt); /* ttisuts */ if (nread < tzheadsize + datablock_size) - return EINVAL; + return EFTYPE; if (skip_datablock) p += datablock_size; else if (! ((ttisstdcnt == typecnt || ttisstdcnt == 0) && (ttisutcnt == typecnt || ttisutcnt == 0))) - return EINVAL; + return EFTYPE; else { int_fast64_t prevtr = -1; int_fast32_2s prevcorr; @@ -1108,7 +1118,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, ? TIME_T_MIN : at); if (timecnt && attime <= sp->ats[timecnt - 1]) { if (attime < sp->ats[timecnt - 1]) - return EINVAL; + return EFTYPE; sp->types[i - 1] = 0; timecnt--; } @@ -1121,7 +1131,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, for (i = 0; i < sp->timecnt; ++i) { unsigned char typ = *p++; if (sp->typecnt <= typ) - return EINVAL; + return EFTYPE; if (sp->types[i]) sp->types[timecnt++] = typ; } @@ -1135,18 +1145,18 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, cause trouble both in this file and in callers. Also, it violates RFC 9636 section 3.2. */ if (utoff < -TWO_31_MINUS_1) - return EINVAL; + return EFTYPE; ttisp = &sp->ttis[i]; ttisp->tt_utoff = utoff; p += 4; isdst = *p++; if (! (isdst < 2)) - return EINVAL; + return EFTYPE; ttisp->tt_isdst = isdst; desigidx = *p++; if (! (desigidx < sp->charcnt)) - return EINVAL; + return EFTYPE; ttisp->tt_desigidx = desigidx; } for (i = 0; i < sp->charcnt; ++i) @@ -1165,7 +1175,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, /* Leap seconds cannot occur before the Epoch, or out of order. */ if (tr <= prevtr) - return EINVAL; + return EFTYPE; /* To avoid other botches in this code, each leap second's correction must differ from the previous one's by 1 @@ -1177,7 +1187,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1)))) - return EINVAL; + return EFTYPE; prevtr = tr; prevcorr = corr; @@ -1199,7 +1209,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, ttisp->tt_ttisstd = false; else { if (*p != true && *p != false) - return EINVAL; + return EFTYPE; ttisp->tt_ttisstd = *p++; } } @@ -1211,7 +1221,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, ttisp->tt_ttisut = false; else { if (*p != true && *p != false) - return EINVAL; + return EFTYPE; ttisp->tt_ttisut = *p++; } } @@ -1296,7 +1306,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags, } } if (sp->typecnt == 0) - return EINVAL; + return EFTYPE; return 0; } diff --git a/contrib/tzcode/newctime.3 b/contrib/tzcode/newctime.3 index a8779e6a7c25..f22e69f44535 100644 --- a/contrib/tzcode/newctime.3 +++ b/contrib/tzcode/newctime.3 @@ -5,34 +5,34 @@ asctime, ctime, difftime, gmtime, localtime, mktime \- convert date and time .SH SYNOPSIS .nf -.B #include <time.h> +.B "#include <time.h>" .PP -.B struct tm *localtime(time_t const *clock); +.B "struct tm *localtime(time_t const *clock);" .B "struct tm *localtime_r(time_t const *restrict clock," .B " struct tm *restrict result);" .B "struct tm *localtime_rz(timezone_t restrict zone," .B " time_t const *restrict clock," .B " struct tm *restrict result);" .PP -.B struct tm *gmtime(time_t const *clock); +.B "struct tm *gmtime(time_t const *clock);" .B "struct tm *gmtime_r(time_t const *restrict clock," .B " struct tm *restrict result);" .PP -.B time_t mktime(struct tm *tm); +.B "time_t mktime(struct tm *tm);" .B "time_t mktime_z(timezone_t restrict zone," .B " struct tm *restrict tm);" .PP -.B double difftime(time_t time1, time_t time0); +.B "double difftime(time_t time1, time_t time0);" .PP -.B [[deprecated]] char *asctime(struct tm const *tm); -.B [[deprecated]] char *ctime(time_t const *clock); +.B "[[deprecated]] char *asctime(struct tm const *tm);" +.B "[[deprecated]] char *ctime(time_t const *clock);" .PP /* Only in POSIX.1-2017 and earlier. */ -.B char *ctime_r(time_t const *clock, char *buf); +.B "char *ctime_r(time_t const *clock, char *buf);" .B "char *asctime_r(struct tm const *restrict tm," .B " char *restrict result);" .PP -.B cc ... \-ltz +.BR cc " ... " \-ltz .fi .SH DESCRIPTION .ie '\(en'' .ds en \- @@ -240,7 +240,7 @@ are in the .B <time.h> header file. The structure (of type) -.B struct tm +.B "struct tm" includes the following fields: .RS .PP diff --git a/contrib/tzcode/newstrftime.3 b/contrib/tzcode/newstrftime.3 index 182f44f738a3..7d23b14ace72 100644 --- a/contrib/tzcode/newstrftime.3 +++ b/contrib/tzcode/newstrftime.3 @@ -40,12 +40,12 @@ strftime \- format date and time .SH SYNOPSIS .nf -.B #include <time.h> +.B "#include <time.h>" .PP .B "size_t strftime(char *restrict buf, size_t maxsize," .B " char const *restrict format, struct tm const *restrict timeptr);" .PP -.B cc ... \-ltz +.BR cc " ... " \-ltz .fi .SH DESCRIPTION .ie '\(lq'' .ds lq \&"\" diff --git a/contrib/tzcode/newtzset.3 b/contrib/tzcode/newtzset.3 index 77e76c9d6974..366bf3024808 100644 --- a/contrib/tzcode/newtzset.3 +++ b/contrib/tzcode/newtzset.3 @@ -5,23 +5,23 @@ tzset \- initialize time conversion information .SH SYNOPSIS .nf -.B #include <time.h> +.B "#include <time.h>" .PP .BI "timezone_t tzalloc(char const *" TZ ); .PP .BI "void tzfree(timezone_t " tz ); .PP -.B void tzset(void); +.B "void tzset(void);" .PP /* Optional and obsolescent: */ .br -.B extern char *tzname[]; +.B "extern char *tzname[];" .br -.B extern long timezone; +.B "extern long timezone;" .br -.B extern int daylight; +.B "extern int daylight;" .PP -.B cc ... \-ltz +.BR cc " ... " \-ltz .fi .SH DESCRIPTION .ie '\(en'' .ds en \- @@ -161,7 +161,7 @@ seconds) \*(en if present \*(en between zero and 59. If preceded by a .q "\-" , the time zone shall be east of the Prime Meridian; otherwise it shall be west (which may be indicated by an optional preceding -.q "+" . +.q "+" ). .TP .I rule Indicates when to change to and back from daylight saving time. The @@ -420,7 +420,7 @@ callers can instead use the and .I tm_zone members of -.B struct tm, +.BR "struct tm", or use .B strftime with "%z" or "%Z". diff --git a/contrib/tzcode/private.h b/contrib/tzcode/private.h index ee191b4ec33c..7918082dca1b 100644 --- a/contrib/tzcode/private.h +++ b/contrib/tzcode/private.h @@ -243,6 +243,9 @@ strnlen (char const *s, size_t maxlen) # define EINVAL ERANGE #endif +#ifndef EFTYPE +# define EFTYPE EINVAL +#endif #ifndef ELOOP # define ELOOP EINVAL #endif @@ -951,6 +954,11 @@ ATTRIBUTE_POSIX2TIME time_t time2posix_z(timezone_t, time_t); #define TYPE_SIGNED(type) (((type) -1) < 0) #define TWOS_COMPLEMENT(type) (TYPE_SIGNED (type) && (! ~ (type) -1)) +/* Yield the value of the arithmetic expression X after integer promotion. + This is safer than a cast, which in general would accept even + pointers and which might trap or yield a value not equal to X. */ +#define INT_PROMOTE(x) (+(x)) + /* Minimum and maximum of two values. Use lower case to avoid naming clashes with standard include files. */ #define max(a, b) ((a) > (b) ? (a) : (b)) @@ -1071,12 +1079,16 @@ time_t timeoff(struct tm *, long); ** The default is to use gettext if available, and use MSGID otherwise. */ -#if HAVE_GETTEXT -# define _(msgid) gettext(msgid) -#else /* !HAVE_GETTEXT */ -# define _(msgid) (msgid) -#endif /* !HAVE_GETTEXT */ -#define N_(msgid) (msgid) +#ifndef _ +# if HAVE_GETTEXT +# define _(msgid) gettext(msgid) +# else +# define _(msgid) (msgid) +# endif +#endif +#ifndef N_ +# define N_(msgid) (msgid) +#endif #if !defined TZ_DOMAIN && defined HAVE_GETTEXT # define TZ_DOMAIN "tz" diff --git a/contrib/tzcode/theory.html b/contrib/tzcode/theory.html index 12f4f7f4b439..8f76aaf0b3c8 100644 --- a/contrib/tzcode/theory.html +++ b/contrib/tzcode/theory.html @@ -592,10 +592,10 @@ in decreasing order of importance: locations while uninhabited. The leading "<code>-</code>" is a flag that the <abbr>UT</abbr> offset is in some sense undefined; this notation is derived - from <a href="https://www.rfc-editor.org/rfc/rfc3339">Internet + from <a href="https://www.rfc-editor.org/info/rfc3339/">Internet <abbr title="Request For Comments">RFC</abbr> 3339</a>. (The abbreviation Z that - <a href="https://www.rfc-editor.org/rfc/rfc9557">Internet + <a href="https://www.rfc-editor.org/info/rfc9557/">Internet <abbr>RFC</abbr> 9557</a> uses for this concept would violate the POSIX requirement of at least three characters in an abbreviation.) @@ -632,7 +632,7 @@ Errors in the <code><abbr>tz</abbr></code> database arise from many sources: timestamps, and current predictions will be incorrect after future governments change the rules. For example, if today someone schedules a meeting for 13:00 next - October 1, Casablanca time, and tomorrow Morocco changes its + October 1, Dublin time, and tomorrow Ireland changes its daylight saving rules, software can mess up after the rule change if it blithely relies on conversions made before the change. </li> @@ -657,7 +657,7 @@ Errors in the <code><abbr>tz</abbr></code> database arise from many sources: zones at all, often not even a stable landscape of mean times, prior to the middle decades of the twentieth century”. See: Timothy Shenk, <a -href="https://dissentmagazine.org/blog/booked-a-global-history-of-time-vanessa-ogle/">Booked: +href="https://dissentmagazine.org/online_articles/booked-a-global-history-of-time-vanessa-ogle/">Booked: A Global History of Time</a>. <cite>Dissent</cite> 2015-12-17. </li> <li> @@ -938,7 +938,7 @@ with problems that were fixed in later POSIX editions. has a format that is hard to describe and is error-prone in practice. Also, proleptic <code>TZ</code> strings cannot deal with daylight saving time rules not based on the Gregorian calendar (as in - Morocco), or with situations where more than two time zone + Palestine), or with situations where more than two time zone abbreviations or <abbr>UT</abbr> offsets are used in an area. </p> @@ -1128,7 +1128,7 @@ However POSIX.1-2024, like earlier POSIX editions, has some limitations: the name of a file from which time-related information is read. The file’s format is <dfn><abbr>TZif</abbr></dfn>, a timezone information format that contains binary data; see - <a href="https://www.rfc-editor.org/rfc/rfc9636">Internet + <a href="https://www.rfc-editor.org/info/rfc9636/">Internet <abbr>RFC</abbr> 9636</a>. The daylight saving time rules to be used for a particular timezone are encoded in the @@ -1212,8 +1212,8 @@ The vestigial <abbr>API</abbr>s are: </li> <li> The <code>tm_isdst</code> member is almost never needed and most of - its uses should be discouraged in favor of the abovementioned - <abbr>API</abbr>s. + its uses should be discouraged in favor of the + <abbr>API</abbr>s mentioned above. It was intended as an index into the <code>tzname</code> variable, but as mentioned previously that usage is obsolete. Although it can still be used in arguments to @@ -1558,7 +1558,7 @@ Sources for time on other planets: Michael Allison and Robert Schmunk, “<a href="https://www.giss.nasa.gov/tools/mars24/help/notes.html">Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock</a>” - (2020-03-08). + (2023-05-15). </li> <li> Zara Mirmalek, diff --git a/contrib/tzcode/tz-art.html b/contrib/tzcode/tz-art.html index 7870a6187390..77c7983c49fd 100644 --- a/contrib/tzcode/tz-art.html +++ b/contrib/tzcode/tz-art.html @@ -6,10 +6,10 @@ <style> ul {padding-left: 1.3rem;} </style> -<title>Time and the Arts</title> +<title>Time and the arts</title> </head> <body> -<h1>Time and the Arts</h1> +<h1>Time and the arts</h1> <h2>Documentaries</h2> <ul> <li> @@ -201,6 +201,13 @@ time zone associated with a video timestamp. Jonah’s inability to understand <abbr>DST</abbr> ends up impressing a wealthy backer who sets him up for a 2020 presidential run. </li> +<li> +“In the Zone”, <em>The Magic School Bus Rides Again</em>, season 3, +episode 3, Netflix, 2020-12-26. +During a New Year’s Eve journey, a software update glitch causes the +Magic School Bus and its passengers to transform every time they cross +time zone boundaries. The visit to the South Pole is especially tricky. +</li> </ul> <h2>Books, plays, and magazines</h2> <ul> @@ -481,20 +488,16 @@ The related book <em>What If?</em> has an entry “<a href="https://what-if.xkcd.com/26/">Leap Seconds</a>” (2012-12-31). </li> <li> -Pig kills time in <a -href="https://www.gocomics.com/pearlsbeforeswine/2016/11/06"><em>Pearls -Before Swine</em> (2016-11-06)</a>. +Pig kills time in <em>Pearls Before Swine</em> (2016-11-06). </li> <li> -Stonehenge is abandoned in <a -href="https://www.gocomics.com/nonsequitur/2017/03/12"><em>Non Sequitur</em> -(2017-03-12)</a>. +Stonehenge is abandoned in <em>Non Sequitur</em> (2017-03-12). </li> <li> Caulfield proposes changing clocks just once a year in -<a href="https://www.gocomics.com/frazz/2023/12/31"><em>Frazz</em> -(2023-12-31)</a>, while Peter and Jason go multi-lingual and -zonal in -<a href="https://www.gocomics.com/foxtrot/2023/12/31"><em>FoxTrot</em> +<em>Frazz</em> (2023-12-31), +while Peter and Jason go multi-lingual and -zonal in +<a href="https://foxtrot.com/2023/12/31/toasty/"><em>FoxTrot</em> (the same day)</a>. </li> <li> @@ -503,9 +506,7 @@ Peppermint Patty: “What if the world comes to an end tonight, Marcie?” Marcie: “I promise there’ll be a tomorrow, sir ... in fact, it’s already tomorrow in Australia!” <br> -(Charles M. Schulz, -<a href="https://www.gocomics.com/peanuts/1980/06/13"><em>Peanuts</em>, -1980-06-13</a>) +(Charles M. Schulz, <em>Peanuts</em>, 1980-06-13) </li> </ul> <h2>Jokes</h2> @@ -612,8 +613,7 @@ but maybe in your time zone I haven’t finished yet. So stay tuned!” </ul> <h2>See also</h2> <ul> -<li><a href="tz-link.html">Time Zone and Daylight Saving -Time Data</a></li> +<li><a href="tz-link.html">Time zone and daylight saving time data</a></li> </ul> <footer> diff --git a/contrib/tzcode/tz-how-to.html b/contrib/tzcode/tz-how-to.html index 9f4f2284c7b4..82a6176bef25 100644 --- a/contrib/tzcode/tz-how-to.html +++ b/contrib/tzcode/tz-how-to.html @@ -15,9 +15,9 @@ ul {padding-left: 1.3rem;} </style> </head> <body> -<h2>How to Read the <a href="https://en.wikipedia.org/wiki/Tz_database">tz -Database</a> Source Files</h2> -<h3>by Bill Seymour</h3> +<h1>How to Read the <a href="https://en.wikipedia.org/wiki/Tz_database">tz +Database</a> Source Files</h1> +<h2>by Bill Seymour</h2> <p>This guide uses the <code>America/Chicago</code> and <code>Pacific/Honolulu</code> zones as examples of how to infer times of day from the <a href="tz-link.html">tz database</a> diff --git a/contrib/tzcode/tz-link.html b/contrib/tzcode/tz-link.html index 4d2c12b09452..2a7da95e9d27 100644 --- a/contrib/tzcode/tz-link.html +++ b/contrib/tzcode/tz-link.html @@ -197,9 +197,9 @@ more errors.</p> After obtaining the code and data files, see the <code>README</code> file for what to do next. The code lets you compile the <code><abbr>tz</abbr></code> source files into -machine-readable binary files, one for each location. The binary files -are in a special format specified by -<a href="https://www.rfc-editor.org/rfc/rfc9636">The +machine-readable binary files, one for each location. +The binary file format is specified by +<a href="https://www.rfc-editor.org/info/rfc9636/">The Time Zone Information Format (<abbr>TZif</abbr>)</a> (Internet <abbr title="Request For Comments">RFC</abbr> 9636). The code also lets @@ -268,7 +268,7 @@ Studio Code</a>. </p> <p> For further information about updates, please see -<a href="https://www.rfc-editor.org/rfc/rfc6557">Procedures for +<a href="https://www.rfc-editor.org/info/rfc6557/">Procedures for Maintaining the Time Zone Database</a> (Internet <abbr>RFC</abbr> 6557). More detail can be found in <a href="theory.html">Theory and pragmatics of the @@ -336,7 +336,7 @@ the Timing of Time Zone Changes</a>” for examples. an encyclopedic summary.</li> <li><a href="tz-how-to.html">How to Read the tz Database Source Files</a> explains the <code><abbr>tz</abbr></code> -database format.</li> +database source format.</li> <li><a href="https://blog.jonudell.net/2009/10/23/a-literary-appreciation-of-the-olsonzoneinfotz-database/">A literary appreciation of the Olson/Zoneinfo/tz database</a> comments on the @@ -385,24 +385,22 @@ calculates the current time difference between locations.</li> <section> <h2 id="protocols">Network protocols for <code><abbr>tz</abbr></code> data</h2> <ul> -<li><a href="https://www.rfc-editor.org/rfc/rfc7808">Time Zone -Data Distribution Service</a> (TZDIST, Internet <abbr>RFC</abbr> 7808) +<li><a href="https://www.rfc-editor.org/info/rfc7808/">Time Zone +Data Distribution Service</a> (Internet <abbr>RFC</abbr> 7808) is associated with -<a href="https://www.rfc-editor.org/rfc/rfc7809">CalDAV</a> +<a href="https://www.rfc-editor.org/info/rfc7809/">CalDAV</a> (Internet <abbr>RFC</abbr> 7809), a calendar access protocol for -transferring time zone data by reference. -<a href="https://devguide.calconnect.org/Time-Zones/TZDS/">TZDIST -implementations</a> are available.</li> -<li>The <a href="https://www.rfc-editor.org/rfc/rfc5545">iCalendar format</a> -(Internet <abbr>RFC</abbr> 5445) +transferring time zone data by reference.</li> +<li>The <a href="https://www.rfc-editor.org/info/rfc5545/">iCalendar format</a> +(Internet <abbr>RFC</abbr> 5545) covers time zone data; see its VTIMEZONE calendar component. The iCalendar format requires specialized parsers and generators; a -variant <a href="https://www.rfc-editor.org/rfc/rfc6321">xCal</a> +variant <a href="https://www.rfc-editor.org/info/rfc6321/">xCal</a> (Internet <abbr>RFC</abbr> 6321) uses <a href="https://www.w3.org/XML/"><abbr title="Extensible Markup Language">XML</abbr></a> format, and a variant -<a href="https://www.rfc-editor.org/rfc/rfc7265">jCal</a> +<a href="https://www.rfc-editor.org/info/rfc7265/">jCal</a> (Internet <abbr>RFC</abbr> 7265) uses <a href="https://www.json.org/json-en.html"><abbr title="JavaScript Object Notation">JSON</abbr></a> format.</li> @@ -417,7 +415,8 @@ distributions you can generally work around compatibility problems by running the command <code>make rearguard_tarballs</code> and compiling from the resulting tarballs instead.</p> <ul> -<li><a href="https://github.com/libical/vzic">Vzic</a> is a <a +<li><a href="https://github.com/libical">Libical</a> +contains <code>vzic</code>, <a href="https://en.wikipedia.org/wiki/C_(programming_language)">C</a> program that compiles <code><abbr>tz</abbr></code> source into iCalendar-compatible VTIMEZONE files. @@ -596,8 +595,7 @@ license.</li> <li>The <a href="https://www.gnu.org/software/libc/"><abbr>GNU</abbr> C Library</a> -has an independent, thread-safe implementation of -a <abbr>TZif</abbr> file reader. +has a thread-safe <abbr>TZif</abbr> file reader. This library is freely available under the LGPL and is widely used in <abbr>GNU</abbr>/Linux systems.</li> <li><a href="https://www.gnome.org">GNOME</a>’s @@ -725,8 +723,6 @@ sources for much of the older <code><abbr>tz</abbr></code> data</a>, they are unreliable as Shanks appears to have guessed many <abbr>UT</abbr> offsets and transitions. The atlases cite no sources and do not indicate which entries are guesswork.</li> -<li><a href="https://en.wikipedia.org/wiki/HP-UX">HP-UX</a> has a database in -its own <code>tztab</code>(4) format.</li> <li>Microsoft Windows has proprietary data mentioned <a href="#System.TimeZoneInfo">above</a>.</li> <li><a href="https://www.worldtimeserver.com">World Time Server</a> @@ -1046,7 +1042,7 @@ title="Institute of Electrical and Electronics Engineers">IEEE</abbr> 1588) can achieve submicrosecond clock accuracy on a local area network with special-purpose hardware.</li> <li><a -href="https://www.rfc-editor.org/rfc/rfc4833">Timezone +href="https://www.rfc-editor.org/info/rfc4833/">Timezone Options for <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr></a> (Internet <abbr>RFC</abbr> 4833) specifies a <a @@ -1125,11 +1121,11 @@ 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 abovementioned <abbr>NTP</abbr> implementations, <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 -<a href="https://www.rfc-editor.org/rfc/rfc8633#section-3.7.1">§3.7.1 of +<a href="https://www.rfc-editor.org/info/rfc8633#section-3.7.1">§3.7.1 of Network Time Protocol Best Current Practices</a> *** 1234 LINES SKIPPED ***home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a64edcb.20388.6a806873>
