Import tzcode 2023d:

localtime.c no longer mishandles TZif files that contain a single
    transition into a DST regime.  Previously, it incorrectly assumed
    DST was in effect before the transition too.  (Thanks to Alois
    Treindl for debugging help.)

    localtime.c's timeoff no longer collides with OpenBSD 7.4.

    The C code now uses _Generic only if __STDC_VERSION__ says the
    compiler is C11 or later.

    tzselect now optionally reads zonenow.tab, to simplify when
    configuring only for timestamps dated from now on.

    tzselect no longer creates temporary files.

    tzselect no longer mishandles the following:

      Spaces and most other special characters in BUGEMAIL, PACKAGE,
      TZDIR, and VERSION.

      TZ strings when using mawk 1.4.3, which mishandles regular
      expressions of the form /X{2,}/.

      ISO 6709 coordinates when using an awk that lacks the GNU
      extension of newlines in -v option-arguments.

      Non UTF-8 locales when using an iconv command that lacks the GNU
      //TRANSLIT extension.

    zic no longer mishandles data for Palestine after the year 2075.
    Previously, it incorrectly omitted post-2075 transitions that are
    predicted for just before and just after Ramadan.  (Thanks to Ken
    Murchison for debugging help.)

    zic now works again on Linux 2.6.16 and 2.6.17 (2006).
This commit is contained in:
christos 2023-12-23 20:48:38 +00:00
parent 815db899f0
commit 559c967b97
7 changed files with 343 additions and 161 deletions

View File

@ -1,7 +1,25 @@
# Make and install tzdb code and data.
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# Request POSIX conformance; this must be the first non-comment line.
.POSIX:
# On older platforms you may need to scrounge for a POSIX-conforming 'make'.
# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or
# /usr/xpg4/bin/make, not /usr/ccs/bin/make.
# To affect how this Makefile works, you can run a shell script like this:
#
# #!/bin/sh
# make CC='gcc -std=gnu11' "$@"
#
# This example script is appropriate for a pre-2017 GNU/Linux system
# where a non-default setting is needed to support this package's use of C99.
#
# Alternatively, you can simply edit this Makefile to tailor the following
# macro definitions.
###############################################################################
# Start of macros that one plausibly might want to tailor.
# Package name for the code distribution.
PACKAGE= tzcode
@ -191,8 +209,9 @@ UTF8_LOCALE= en_US.utf8
# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
LDLIBS=
# Add the following to the end of the "CFLAGS=" line as needed to override
# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1".
# Add the following to an uncommented "CFLAGS=" line as needed
# to override defaults specified in the source code or by the system.
# "-DFOO" is equivalent to "-DFOO=1".
# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
# formats that generate only the last two digits of year numbers
# -DEPOCH_LOCAL if the 'time' function returns local time not UT
@ -234,11 +253,16 @@ LDLIBS=
# -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
# -Dlocale_t=XXX if your system uses XXX instead of locale_t
# -DPORT_TO_C89 if tzcode should also run on C89 platforms+
# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
# Typically it is better to use a later standard. For example,
# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
# Even with -DPORT_TO_C89, the code needs at least one C99
# feature (integers at least 64 bits wide) and maybe more.
# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
# with external linkage, e.g., applications cannot define 'localtime'.
# -Dssize_t=long on hosts like MS-Windows that lack ssize_t
# -DSUPPORT_C89 if the tzcode library should support C89 callers+
# However, this might trigger latent bugs in C99-or-later callers.
# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
# security implications and is not recommended for general use
# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
@ -270,11 +294,15 @@ LDLIBS=
# -DZIC_MAX_ABBR_LEN_WO_WARN=3
# (or some other number) to set the maximum time zone abbreviation length
# that zic will accept without a warning (the default is 6)
# -g to generate symbolic debugging info
# -Idir to include from directory 'dir'
# -O0 to disable optimization; other -O options to enable more optimization
# -Uname to remove any definition of the macro 'name'
# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking
#
# * Options marked "*" can be omitted if your compiler is C23 compatible.
# * Options marked "+" are obsolescent and are planned to be removed
# once the code assumes C99 or later.
# once the code assumes C99 or later, say in the year 2029.
#
# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
GCC_INSTRUMENT = \
@ -353,9 +381,11 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# functions to be added to the time conversion library.
# "offtime" is like "gmtime" except that it accepts a second (long) argument
# that gives an offset to add to the time_t when converting it.
# "timelocal" is equivalent to "mktime".
# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone.
# "timelocal" is nearly equivalent to "mktime".
# "timeoff" is like "timegm" except that it accepts a second (long) argument
# that gives an offset to use when converting to a time_t.
# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone.
# "posix2time" and "time2posix" are described in an included manual page.
# X3J11's work does not describe any of these functions.
# These functions may well disappear in future releases of the time
@ -378,7 +408,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
#
# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put
# out by the National Institute of Standards and Technology
# which claims to test C and Posix conformance. If you want to pass PCTS, add
# which claims to test C and POSIX conformance. If you want to pass PCTS, add
# -DPCTS
# to the end of the "CFLAGS=" line.
#
@ -388,13 +418,21 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# 53 as a week number (rather than 52 or 53) for January days before
# January's first Monday when a "%V" format is used and January 1
# falls on a Friday, Saturday, or Sunday.
#
# POSIX says CFLAGS defaults to "-O 1".
# Uncomment the following line and edit its contents as needed.
CFLAGS=
#CFLAGS= -O 1
# Linker flags. Default to $(LFLAGS) for backwards compatibility
# to release 2012h and earlier.
LDFLAGS= $(LFLAGS)
# The name of a POSIX-like library archiver, its flags, C compiler,
# linker flags, and 'make' utility. Ordinarily the defaults suffice.
# The commented-out values are the defaults specified by POSIX 202x/D3.
#AR = ar
#ARFLAGS = -rv
#CC = c17
#LDFLAGS =
#MAKE = make
# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
# submake command lines. The default is no leap seconds.
@ -418,18 +456,18 @@ ZFLAGS=
ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
# The name of a Posix-compliant 'awk' on your system.
# The name of a POSIX-compliant 'awk' on your system.
# 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.
AWK= awk
# The full path name of a Posix-compliant shell, preferably one that supports
# The full path name of a POSIX-compliant shell, preferably one that supports
# the Korn shell's 'select' statement as an extension.
# These days, Bash is the most popular.
# It should be OK to set this to /bin/sh, on platforms where /bin/sh
# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash
# is typically nicer if it works.
KSHELL= /bin/bash
@ -503,18 +541,17 @@ GZIPFLAGS= -9n
DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \
|| echo ' -F^TZ=')
###############################################################################
#MAKE= make
cc= cc
CC= $(cc) -DTZDIR='"$(TZDIR)"'
AR= ar
# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
RANLIB= :
# POSIX prohibits defining or using SHELL. However, csh users on systems
# that use the user shell for Makefile commands may need to define SHELL.
#SHELL= /bin/sh
# End of macros that one plausibly might want to tailor.
###############################################################################
TZCOBJS= zic.o
TZDOBJS= zdump.o localtime.o asctime.o strftime.o
DATEOBJS= date.o localtime.o strftime.o asctime.o
@ -543,7 +580,7 @@ YDATA= $(PRIMARY_YDATA) etcetera
NDATA= factory
TDATA_TO_CHECK= $(YDATA) $(NDATA) backward
TDATA= $(YDATA) $(NDATA) $(BACKWARD)
ZONETABLES= zone1970.tab zone.tab
ZONETABLES= zone.tab zone1970.tab zonenow.tab
TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
LEAP_DEPS= leapseconds.awk leap-seconds.list
TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \
@ -551,7 +588,7 @@ TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \
DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST)
DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \
leapseconds $(ZONETABLES)
AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \
AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \
ziguard.awk zishrink.awk
MISC= $(AWK_SCRIPTS)
TZS_YEAR= 2050
@ -572,7 +609,7 @@ VERSION_DEPS= \
calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \
africa antarctica asctime.c asia australasia \
backward backzone \
checklinks.awk checktab.awk \
checklinks.awk checknow.awk checktab.awk \
date.1 date.c difftime.c \
etcetera europe factory iso3166.tab \
leap-seconds.list leapseconds.awk localtime.c \
@ -582,12 +619,7 @@ VERSION_DEPS= \
tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
workman.sh zdump.8 zdump.c zic.8 zic.c \
ziguard.awk zishrink.awk \
zone.tab zone1970.tab
# And for the benefit of csh users on systems that assume the user
# shell should be used to handle commands in Makefiles. . .
SHELL= /bin/sh
zone.tab zone1970.tab zonenow.tab
all: tzselect zic zdump libtz.a $(TABDATA) \
vanguard.zi main.zi rearguard.zi
@ -657,6 +689,16 @@ tzdata.zi: $(DATAFORM).zi version zishrink.awk
$(DATAFORM).zi >$@.out
mv $@.out $@
tzdir.h:
printf '%s\n' >$@.out \
'#ifndef TZDEFAULT' \
'# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \
'#endif' \
'#ifndef TZDIR' \
'# define TZDIR "$(TZDIR)" /* TZif directory */' \
'#endif'
mv $@.out $@
version.h: version
VERSION=`cat version` && printf '%s\n' \
'static char const PKGVERSION[]="($(PACKAGE)) ";' \
@ -763,7 +805,7 @@ force_tzs: $(TZS_NEW)
libtz.a: $(LIBOBJS)
rm -f $@
$(AR) -rc $@ $(LIBOBJS)
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
date: $(DATEOBJS)
@ -771,26 +813,32 @@ date: $(DATEOBJS)
tzselect: tzselect.ksh version
VERSION=`cat version` && sed \
-e 's|#!/bin/bash|#!$(KSHELL)|g' \
-e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \
-e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
-e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
-e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
-e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
-e "s'#!/bin/bash'#!"'$(KSHELL)'\' \
-e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \
-e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \
-e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \
-e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \
-e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \
<$@.ksh >$@.out
chmod +x $@.out
mv $@.out $@
check: check_back check_mild
check_mild: check_character_set check_white_space check_links \
check_name_lengths check_slashed_abbrs check_sorted \
check_name_lengths check_now \
check_slashed_abbrs check_sorted \
check_tables check_web check_ziguard check_zishrink check_tzs
# True if UTF8_LOCALE does not work;
# otherwise, false but with LC_ALL set to $(UTF8_LOCALE).
UTF8_LOCALE_MISSING = \
{ test ! '$(UTF8_LOCALE)' \
|| ! printf 'A\304\200B\n' \
| LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \
|| { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; }
check_character_set: $(ENCHILADA)
test ! '$(UTF8_LOCALE)' || \
! printf 'A\304\200B\n' | \
LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \
LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \
$(UTF8_LOCALE_MISSING) || { \
sharp='#' && \
! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
$(MISC) $(SOURCES) $(WEB_PAGES) \
@ -805,11 +853,11 @@ check_character_set: $(ENCHILADA)
touch $@
check_white_space: $(ENCHILADA)
$(UTF8_LOCALE_MISSING) || { \
patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
! grep -En "$$pat" \
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
! grep -n '[$s]$$' \
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
! grep -En "$$pat|[$s]\$$" \
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \
}
touch $@
PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
@ -851,7 +899,29 @@ check_links: checklinks.awk tzdata.zi
-f checklinks.awk tzdata.zi
touch $@
check_tables: checktab.awk $(YDATA) backward $(ZONETABLES)
# Check timestamps from now through 28 years from now, to make sure
# that zonenow.tab contains all sequences of planned timestamps,
# without any duplicate sequences. In theory this might require
# 2800 years but that would take a long time to check.
CHECK_NOW_TIMESTAMP = `./date +%s`
CHECK_NOW_FUTURE_YEARS = 28
CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60
check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab
rm -fr $@.dir
mkdir $@.dir
./zic -d $@.dir tzdata.zi
now=$(CHECK_NOW_TIMESTAMP) && \
future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \
./zdump -i -t $$now,$$future \
$$(find $$PWD/$@.dir/????*/ -type f) \
>$@.dir/zdump.tab
$(AWK) \
-v zdump_table=$@.dir/zdump.tab \
-f checknow.awk zonenow.tab
rm -fr $@.dir
touch $@
check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab
for tab in $(ZONETABLES); do \
test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
$(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
@ -911,10 +981,10 @@ check_zishrink_posix check_zishrink_right: \
touch $@
clean_misc:
rm -fr check_*.dir
rm -fr check_*.dir typecheck_*.dir
rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
check_* core typecheck_* \
date tzselect version.h zdump zic libtz.a
date tzdir.h tzselect version.h zdump zic libtz.a
clean: clean_misc
rm -fr *.dir tzdb-*/
rm -f *.zi $(TZS_NEW)
@ -952,12 +1022,18 @@ $(MANTXTS): workman.sh
# plus N if GNU ls and touch are available.
SET_TIMESTAMP_N = sh -c '\
n=$$0 dest=$$1; shift; \
touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \
<"$$dest" && \
if test $$n != 0 && \
lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \
lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \
set x $$lsout && \
touch -cmd @`expr $$7 + $$n` "$$dest"; \
else :; fi'
timestamp=`expr $$7 + $$n` && \
echo "+ touch -md @$$timestamp $$dest" && \
touch -md @$$timestamp "$$dest"; \
else \
newest=`ls -t "$$@" | sed 1q` && \
echo "+ touch -mr $$newest $$dest" && \
touch -mr "$$newest" "$$dest"; \
fi'
# 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.
@ -982,8 +1058,12 @@ set-timestamps.out: $(EIGHT_YARDS)
rm -f test.out && \
for file in $$files; do \
if git diff --quiet $$file; then \
time=`git log -1 --format='tformat:%ct' $$file` && \
touch -cmd @$$time $$file; \
time=`TZ=UTC0 git log -1 \
--format='tformat:%cd' \
--date='format:%Y-%m-%dT%H:%M:%SZ' \
$$file` && \
echo "+ touch -md $$time $$file" && \
touch -md $$time $$file; \
else \
echo >&2 "$$file: warning: does not match repository"; \
fi || exit; \
@ -1008,7 +1088,8 @@ check_public: $(VERSION_DEPS)
rm -fr public.dir
mkdir public.dir
ln $(VERSION_DEPS) public.dir
cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
cd public.dir \
&& $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL
for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
public.dir/vanguard.zi public.dir/main.zi \
public.dir/rearguard.zi; \
@ -1139,7 +1220,7 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
sed '1s/$$/-rearguard/' <version >$@.dir/version
: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
$(CREATE_EMPTY) $@.dir/pacificnew
touch -cmr version $@.dir/version
touch -mr version $@.dir/version
LC_ALL=C && export LC_ALL && \
(cd $@.dir && \
tar $(TARFLAGS) -cf - \
@ -1163,7 +1244,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
`test $(DATAFORM) = vanguard || echo pacificnew`
(grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
>$@.dir/etcetera
touch -cmr tzdata.zi $@.dir/etcetera
touch -mr tzdata.zi $@.dir/etcetera
sed -n \
-e '/^# *version *\(.*\)/h' \
-e '/^# *ddeps */H' \
@ -1174,7 +1255,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
-e 's/ /-/g' \
-e 'p' \
<tzdata.zi >$@.dir/version
touch -cmr version $@.dir/version
touch -mr version $@.dir/version
links= && \
for file in $(TZDATA_DIST); do \
test -f $@.dir/$$file || links="$$links $$file"; \
@ -1226,10 +1307,10 @@ zonenames: tzdata.zi
asctime.o: private.h tzfile.h
date.o: private.h
difftime.o: private.h
localtime.o: private.h tzfile.h
localtime.o: private.h tzfile.h tzdir.h
strftime.o: private.h tzfile.h
zdump.o: version.h
zic.o: private.h tzfile.h version.h
zic.o: private.h tzfile.h tzdir.h version.h
.PHONY: ALL INSTALL all
.PHONY: check check_mild check_time_t_alternatives

View File

@ -1,5 +1,109 @@
News for the tz database
Release 2023d - 2023-12-21 20:02:24 -0800
Briefly:
Ittoqqortoormiit, Greenland changes time zones on 2024-03-31.
Vostok, Antarctica changed time zones on 2023-12-18.
Casey, Antarctica changed time zones five times since 2020.
Code and data fixes for Palestine timestamps starting in 2072.
A new data file zonenow.tab for timestamps starting now.
Changes to future timestamps
Ittoqqortoormiit, Greenland (America/Scoresbysund) joins most of
the rest of Greenland's timekeeping practice on 2024-03-31, by
changing its time zone from -01/+00 to -02/-01 at the same moment
as the spring-forward transition. Its clocks will therefore not
spring forward as previously scheduled. The time zone change
reverts to its common practice before 1981.
Fix predictions for DST transitions in Palestine in 2072-2075,
correcting a typo introduced in 2023a.
Changes to past and future timestamps
Vostok, Antarctica changed to +05 on 2023-12-18. It had been at
+07 (not +06) for years. (Thanks to Zakhary V. Akulov.)
Change data for Casey, Antarctica to agree with timeanddate.com,
by adding five time zone changes since 2020. Casey is now at +08
instead of +11.
Changes to past tm_isdst flags
Much of Greenland, represented by America/Nuuk, changed its
standard time from -03 to -02 on 2023-03-25, not on 2023-10-28.
This does not affect UTC offsets, only the tm_isdst flag.
(Thanks to Thomas M. Steenholdt.)
New data file
A new data file zonenow.tab helps configure applications that use
timestamps dated from now on. This simplifies configuration,
since users choose from a smaller Zone set. The file's format is
experimental and subject to change.
Changes to code
localtime.c no longer mishandles TZif files that contain a single
transition into a DST regime. Previously, it incorrectly assumed
DST was in effect before the transition too. (Thanks to Alois
Treindl for debugging help.)
localtime.c's timeoff no longer collides with OpenBSD 7.4.
The C code now uses _Generic only if __STDC_VERSION__ says the
compiler is C11 or later.
tzselect now optionally reads zonenow.tab, to simplify when
configuring only for timestamps dated from now on.
tzselect no longer creates temporary files.
tzselect no longer mishandles the following:
Spaces and most other special characters in BUGEMAIL, PACKAGE,
TZDIR, and VERSION.
TZ strings when using mawk 1.4.3, which mishandles regular
expressions of the form /X{2,}/.
ISO 6709 coordinates when using an awk that lacks the GNU
extension of newlines in -v option-arguments.
Non UTF-8 locales when using an iconv command that lacks the GNU
//TRANSLIT extension.
zic no longer mishandles data for Palestine after the year 2075.
Previously, it incorrectly omitted post-2075 transitions that are
predicted for just before and just after Ramadan. (Thanks to Ken
Murchison for debugging help.)
zic now works again on Linux 2.6.16 and 2.6.17 (2006).
(Problem reported by Rune Torgersen.)
Changes to build procedure
The Makefile is now more compatible with POSIX:
* It no longer defines AR, CC, CFLAGS, LDFLAGS, and SHELL.
* It no longer uses its own 'cc' in place of CC.
* It now uses ARFLAGS, with default specified by POSIX.
* It does not use LFLAGS incompatibly with POSIX.
* It uses the special .POSIX target.
* It quotes special characters more carefully.
* It no longer mishandles builds in an ISO 8859 locale.
Due to the CC changes, TZDIR is now #defined in a file tzfile.h
built by 'make', not in a $(CC) -D option. Also, TZDEFAULT is
now treated like TZDIR as they have similar roles.
Changes to commentary
Limitations and hazards of the optional support for obsolescent
C89 platforms are documented better, along with a tentative
schedule for removing this support.
Release 2023c - 2023-03-28 12:42:14 -0700
Changes to past and future timestamps
@ -76,11 +180,14 @@ Release 2023a - 2023-03-22 12:39:33 -0700
platform dependent and abbreviations were silently truncated to
16 bytes even when the limit was greater than 16.
The code by default is now designed for C99 or later. To build in
a C89 environment, compile with -DPORT_TO_C89. To support C89
callers of the tzcode library, compile with -DSUPPORT_C89. The
two new macros are transitional aids planned to be removed in a
future version, when C99 or later will be required.
The code by default is now designed for C99 or later. To build on
a mostly-C89 platform, compile with -DPORT_TO_C89; this should
work on C89 platforms that also support C99 'long long' and
perhaps a few other extensions to C89. To support C89 callers of
tzcode's library, compile with -DSUPPORT_C89; however, this could
trigger latent bugs in C99-or-later callers. The two new macros
are transitional aids planned to be removed in a future version
(say, in 2029), when C99 or later will be required.
The code now builds again on pre-C99 platforms, if you compile
with -DPORT_TO_C89. This fixes a bug introduced in 2022f.
@ -728,6 +835,8 @@ Release 2021b - 2021-09-24 16:23:00 -0700
them, set the EXPIRES_LINE Makefile variable. If a TZif file uses
this new feature it is marked with a new TZif version number 4,
a format intended to be documented in a successor to RFC 8536.
The old-format "#expires" comments are now treated solely as
comments and have no effect on the TZif files.
zic -L LEAPFILE -r @LO no longer generates an invalid TZif file
that omits leap second information for the range LO..B when LO
@ -4307,7 +4416,7 @@ Release 2012j - 2012-11-12 18:34:49 -0800
now uses tz@iana.org rather than the old elsie address.
zic -v now complains about abbreviations that are less than 3
or more than 6 characters, as per Posix. Formerly, it checked
or more than 6 characters, as per POSIX. Formerly, it checked
for abbreviations that were more than 3.
'make public' no longer puts its temporary directory under /tmp,
@ -4472,8 +4581,8 @@ Release data2011m - 2011-10-24 21:42:16 +0700
In particular, the typos in comments in the data (2011-11-17 should have
been 2011-10-17 as Alan Barrett noted, and spelling of Tiraspol that
Tim Parenti noted) have been fixed, and the change for Ukraine has been
made in all 4 Ukrainian zones, rather than just Kiev (again, thanks to
Tim Parenti, and also Denys Gavrysh)
made in all 4 Ukrainian zones, rather than just Europe/Kiev
(again, thanks to Tim Parenti, and also Denys Gavrysh).
In addition, I added Europe/Tiraspol to zone.tab.

View File

@ -11,14 +11,17 @@ changes made by political bodies to time zone boundaries, UTC offsets,
and daylight-saving rules.
See <https://www.iana.org/time-zones/repository/tz-link.html> or the
file tz-link.html for how to acquire the code and data. Once acquired,
read the comments in the file 'Makefile' and make any changes needed
to make things right for your system, especially if you are using some
platform other than GNU/Linux. Then run the following commands,
substituting your desired installation directory for "$HOME/tzdir":
file tz-link.html for how to acquire the code and data.
make TOPDIR=$HOME/tzdir install
$HOME/tzdir/usr/bin/zdump -v America/Los_Angeles
Once acquired, read the leading comments in the file "Makefile"
and make any changes needed to make things right for your system,
especially when using a platform other than current GNU/Linux.
Then run the following commands, substituting your desired
installation directory for "$HOME/tzdir":
make TOPDIR="$HOME/tzdir" install
"$HOME/tzdir/usr/bin/zdump" -v America/Los_Angeles
See the file tz-how-to.html for examples of how to read the data files.

View File

@ -1,4 +1,4 @@
/* $NetBSD: localtime.c,v 1.138 2023/09/16 18:40:26 christos Exp $ */
/* $NetBSD: localtime.c,v 1.139 2023/12/23 20:48:38 christos Exp $ */
/* Convert timestamp from time_t to struct tm. */
@ -12,7 +12,7 @@
#if 0
static char elsieid[] = "@(#)localtime.c 8.17";
#else
__RCSID("$NetBSD: localtime.c,v 1.138 2023/09/16 18:40:26 christos Exp $");
__RCSID("$NetBSD: localtime.c,v 1.139 2023/12/23 20:48:38 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -122,6 +122,11 @@ enum { CHARS_EXTRA = max(sizeof UNSPEC, 2) - 1 };
#endif
#define state __state
/* A representation of the contents of a TZif file. Ideally this
would have no size limits; the following sizes should suffice for
practical use. This struct should not be too large, as instances
are put on the stack and stacks are relatively small on some platforms.
See tzfile.h for more about the sizes. */
struct state {
int leapcnt;
int timecnt;
@ -164,8 +169,7 @@ static int_fast32_t leapcorr(struct state const *, time_t);
static bool normalize_overflow32(int_fast32_t *, int *, int);
static struct tm *timesub(time_t const *, int_fast32_t, struct state const *,
struct tm *);
static bool typesequiv(struct state const *, int, int);
static bool tzparse(char const *, struct state *, struct state *);
static bool tzparse(char const *, struct state *, struct state const *);
static timezone_t gmtptr;
@ -429,7 +433,8 @@ union input_buffer {
/* The first part of the buffer, interpreted as a header. */
struct tzhead tzhead;
/* The entire buffer. */
/* The entire buffer. Ideally this would have no size limits;
the following should suffice for practical use. */
char buf[2 * sizeof(struct tzhead) + 2 * sizeof(struct state)
+ 4 * TZ_MAX_TIMES];
};
@ -448,7 +453,12 @@ union local_storage {
struct state st;
} u;
/* The file name to be opened. */
/* The name of the file to be opened. Ideally this would have no
size limits, to support arbitrarily long Zone names.
Limiting Zone names to 1024 bytes should suffice for practical use.
However, there is no need for this to be smaller than struct
file_analysis as that struct is allocated anyway, as the other
union member. */
char fullname[max(sizeof(struct file_analysis), sizeof tzdirslash + 1024)];
};
@ -734,14 +744,18 @@ tzloadbody(char const *name, struct state *sp, bool doextend,
== sp->types[sp->timecnt - 2]))
sp->timecnt--;
for (i = 0;
i < ts->timecnt && sp->timecnt < TZ_MAX_TIMES;
i++) {
sp->goahead = ts->goahead;
for (i = 0; i < ts->timecnt; i++) {
__time_t t = ts->ats[i];
if (increment_overflow_time(&t, leapcorr(sp, t))
|| (0 < sp->timecnt
&& t <= sp->ats[sp->timecnt - 1]))
continue;
if (TZ_MAX_TIMES <= sp->timecnt) {
sp->goahead = false;
break;
}
sp->ats[sp->timecnt] = t;
sp->types[sp->timecnt] = (sp->typecnt
+ ts->types[i]);
@ -754,29 +768,6 @@ tzloadbody(char const *name, struct state *sp, bool doextend,
}
if (sp->typecnt == 0)
return EINVAL;
if (sp->timecnt > 1) {
if (sp->ats[0] <= (time_t)(TIME_T_MAX - SECSPERREPEAT)) {
time_t repeatat = (time_t)(sp->ats[0] + SECSPERREPEAT);
int repeattype = sp->types[0];
for (i = 1; i < sp->timecnt; ++i)
if (sp->ats[i] == repeatat
&& typesequiv(sp, sp->types[i], repeattype)) {
sp->goback = true;
break;
}
}
if ((time_t)(TIME_T_MIN + SECSPERREPEAT) <= sp->ats[sp->timecnt - 1]) {
time_t repeatat =
(time_t)(sp->ats[sp->timecnt - 1] - SECSPERREPEAT);
int repeattype = sp->types[sp->timecnt - 1];
for (i = sp->timecnt - 2; i >= 0; --i)
if (sp->ats[i] == repeatat
&& typesequiv(sp, sp->types[i], repeattype)) {
sp->goahead = true;
break;
}
}
}
/* Infer sp->defaulttype from the data. Although this default
type is always zero for data from recent tzdb releases,
@ -848,31 +839,6 @@ tzload(char const *name, struct state *sp, bool doextend)
}
}
static bool
typesequiv(const struct state *sp, int a, int b)
{
register bool result;
if (sp == NULL ||
a < 0 || a >= sp->typecnt ||
b < 0 || b >= sp->typecnt)
result = false;
else {
/* Compare the relevant members of *AP and *BP.
Ignore tt_ttisstd and tt_ttisut, as they are
irrelevant now and counting them could cause
sp->goahead to mistakenly remain false. */
register const struct ttinfo * ap = &sp->ttis[a];
register const struct ttinfo * bp = &sp->ttis[b];
result = (ap->tt_utoff == bp->tt_utoff
&& ap->tt_isdst == bp->tt_isdst
&& (strcmp(&sp->chars[ap->tt_desigidx],
&sp->chars[bp->tt_desigidx])
== 0));
}
return result;
}
static const int mon_lengths[2][MONSPERYEAR] = {
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
@ -975,8 +941,8 @@ getsecs(register const char *strp, int_fast32_t *const secsp)
int_fast32_t secsperhour = SECSPERHOUR;
/*
** 'HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
** "M10.4.6/26", which does not conform to Posix,
** 'HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-POSIX rules like
** "M10.4.6/26", which does not conform to POSIX,
** but which specifies the equivalent of
** "02:00 on the first Sunday on or after 23 Oct".
*/
@ -1178,7 +1144,7 @@ transtime(const int year, register const struct rule *const rulep,
*/
static bool
tzparse(const char *name, struct state *sp, struct state *basep)
tzparse(const char *name, struct state *sp, struct state const *basep)
{
const char * stdname;
const char * dstname;
@ -1222,6 +1188,7 @@ tzparse(const char *name, struct state *sp, struct state *basep)
}
if (0 < sp->leapcnt)
leaplo = sp->lsis[sp->leapcnt - 1].ls_trans;
sp->goback = sp->goahead = false;
if (*name != '\0') {
if (*name == '<') {
dstname = ++name;
@ -1270,7 +1237,6 @@ tzparse(const char *name, struct state *sp, struct state *basep)
init_ttinfo(&sp->ttis[0], -stdoffset, false, 0);
init_ttinfo(&sp->ttis[1], -dstoffset, true,
(int)(stdlen + 1));
sp->defaulttype = 0;
timecnt = 0;
janfirst = 0;
yearbeg = EPOCH_YEAR;
@ -1431,7 +1397,6 @@ tzparse(const char *name, struct state *sp, struct state *basep)
init_ttinfo(&sp->ttis[1], -dstoffset, true,
(int)(stdlen + 1));
sp->typecnt = 2;
sp->defaulttype = 0;
}
} else {
dstlen = 0;
@ -1439,8 +1404,8 @@ tzparse(const char *name, struct state *sp, struct state *basep)
sp->timecnt = 0;
init_ttinfo(&sp->ttis[0], -stdoffset, false, 0);
init_ttinfo(&sp->ttis[1], 0, false, 0);
sp->defaulttype = 0;
}
sp->defaulttype = 0;
sp->charcnt = (int)charcnt;
cp = sp->chars;
memcpy(cp, stdname, stdlen);
@ -1781,6 +1746,9 @@ gmtime(const time_t *timep)
#if STD_INSPIRED
/* This function is obsolescent and may disappear in future releases.
Callers can instead use localtime_rz with a fixed-offset zone. */
struct tm *
offtime(const time_t *timep, long offset)
{
@ -2479,6 +2447,8 @@ mktime(struct tm *tmp)
}
#if STD_INSPIRED
/* This function is obsolescent and may disapper in future releases.
Callers can instead use mktime. */
time_t
timelocal_z(const timezone_t sp, struct tm *const tmp)
{
@ -2495,8 +2465,13 @@ timelocal(struct tm *tmp)
return mktime(tmp);
}
#else
# ifndef timeoff
# define timeoff my_timeoff /* Don't collide with OpenBSD 7.4 <time.h>. */
# endif
static
#endif
/* This function is obsolescent and may disapper in future releases.
Callers can instead use mktime_z with a fixed-offset zone. */
time_t
timeoff(struct tm *tmp, long offset)
{

View File

@ -1,6 +1,6 @@
/* Private header for tzdb code. */
/* $NetBSD: private.h,v 1.66 2023/09/16 18:40:26 christos Exp $ */
/* $NetBSD: private.h,v 1.67 2023/12/23 20:48:38 christos Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
@ -30,11 +30,15 @@
*/
/* PORT_TO_C89 means the code should work even if the underlying
compiler and library support only C89. SUPPORT_C89 means the
compiler and library support only C89 plus C99's 'long long'
and perhaps a few other extensions to C89. SUPPORT_C89 means the
tzcode library should support C89 callers in addition to the usual
support for C99-and-later callers. These macros are obsolescent,
support for C99-and-later callers; however, C89 support can trigger
latent bugs in C99-and-later callers. These macros are obsolescent,
and the plan is to remove them along with any code needed only when
they are nonzero. */
they are nonzero. A good time to do that might be in the year 2029
because RHEL 7 (whose GCC defaults to C89) extended life cycle
support (ELS) is scheduled to end on 2028-06-30. */
#ifndef PORT_TO_C89
# define PORT_TO_C89 0
#endif
@ -82,9 +86,7 @@
#endif
#if !defined HAVE__GENERIC && defined __has_extension
# if __has_extension(c_generic_selections)
# define HAVE__GENERIC 1
# else
# if !__has_extension(c_generic_selections)
# define HAVE__GENERIC 0
# endif
#endif

View File

@ -22,9 +22,10 @@ into problems that programmers have with timekeeping.</li>
Explaining The Mysteries Of Time Zones</a>" (2017; 2:15)
briefly says why France has more time zones than Russia.
<li>
"<a href="https://www.youtube.com/watch?v=yRz-Dl60Lfc">Why Denmark is
.17 Seconds Behind The World</a>" (2019; 6:29) explains why Denmark and
the United Kingdom don't exactly follow their own law about civil time.
"<a href="https://www.youtube.com/watch?v=yRz-Dl60Lfc">Why Denmark used to be
.04 seconds behind the world</a>" (2019; 6:29) explains why the United Kingdom
&mdash; and, once, Denmark &mdash; haven't always exactly followed their own
laws about civil time.
<li>
"About Time" (1962; 59 minutes) is part of the
Bell Science extravaganza, with Frank Baxter, Richard Deacon, and Les Tremayne.

View File

@ -973,6 +973,9 @@ zone shifts, and many scientific studies have been conducted. This
section summarizes reviews and position statements based on
scientific literature in the area.</p>
<ul>
<li>In 2022 the American Medical Association issued a
<a href="https://www.ama-assn.org/press-center/press-releases/ama-calls-permanent-standard-time">statement
supporting permanent standard time</a> on health grounds.</li>
<li>Carey RN, Sarma KM.
<a href="https://bmjopen.bmj.com/content/7/6/e014319.long">Impact of
daylight saving time on road traffic collision risk: a systematic
@ -989,19 +992,27 @@ doi:<a href="https://doi.org/10.5547/01956574.39.2.thav">10.5547/01956574.39.2.t
This analyzes research literature and concludes, "Electricity savings
are larger for countries farther away from the equator, while
subtropical regions consume more electricity because of <abbr>DST</abbr>."</li>
<li>Rishi MA, Ahmed O, Barrantes Perez JH <em>et al</em>.
<a href="https://jcsm.aasm.org/doi/10.5664/jcsm.8780">Daylight saving time:
<li>Malow BA. It is time to abolish the clock change and adopt permanent
standard time in the United States: a Sleep Research Society position statement.
<em>Sleep.</em> 2022;45(12):zsac236.
doi:<a href="https://doi.org/10.1093/sleep/zsac236">10.1093/sleep/zsac236</a>.
After reviewing the scientific literature, the Sleep Research Society
advocates permanent standard time due to its health benefits.
<li>Rishi MA, Cheng JY, Strang AR <em>et al</em>.
<a href="https://jcsm.aasm.org/doi/10.5664/jcsm.10898">Permanent standard time
is the optimal choice for health and safety:
an American Academy of Sleep Medicine position statement</a>.
<em>J Clin Sleep Med.</em>
2020;<a href="https://doi.org/10.5664/jcsm.8780">10.5664/jcsm.8780</a>.
This argues for permanent standard time due to health risks of both
<abbr>DST</abbr> transitions and permanent <abbr>DST</abbr>.</li>
<em>J Clin Sleep Med.</em> 2023-10-31.
doi:<a href="https://doi.org/10.5664/jcsm.10898">10.5664/jcsm.10898</a>.
The AASM argues for permanent standard time due to health and safety risks
and economic costs of both <abbr>DST</abbr> transitions and
permanent <abbr>DST</abbr>.</li>
<li>Roenneberg T, Wirz-Justice A, Skene DJ <em>et al</em>.
<a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7205184/">Why
should we abolish Daylight Saving Time?</a>
<em>J Biol Rhythms</em>. 2019;34(3):227&ndash;230.
<em>J Biol Rhythms.</em> 2019;34(3):227&ndash;230.
doi:<a href="https://doi.org/10.1177/0748730419854197">10.1177/0748730419854197</a>.
This position paper of the Society for Research on Biological Rhythms
The Society for Research on Biological Rhythms
opposes DST changes and permanent DST, and advocates that governments adopt
"permanent Standard Time for the health and safety of their citizens".</li>
</ul>