summaryrefslogtreecommitdiff
path: root/elsie.nci.nih.gov
diff options
context:
space:
mode:
authorStuart Bishop <stuart@stuartbishop.net>2013-09-20 16:43:14 +0000
committerStuart Bishop <stuart@stuartbishop.net>2013-09-20 16:43:14 +0000
commita6240ce92efddd48d6e87df5fc0dbe2ee59c73ef (patch)
tree6f7d426293ecff81985f152e345446e643ddd598 /elsie.nci.nih.gov
parent30f5d2331d4f265cdb3e18377f56c3ce1334fd98 (diff)
downloadpytz-a6240ce92efddd48d6e87df5fc0dbe2ee59c73ef.tar.gz
Import 2013e from iana.org
Diffstat (limited to 'elsie.nci.nih.gov')
-rw-r--r--elsie.nci.nih.gov/src/Makefile107
-rw-r--r--elsie.nci.nih.gov/src/Theory283
-rw-r--r--elsie.nci.nih.gov/src/africa4
-rw-r--r--elsie.nci.nih.gov/src/antarctica27
-rw-r--r--elsie.nci.nih.gov/src/asia59
-rw-r--r--elsie.nci.nih.gov/src/australasia31
-rw-r--r--elsie.nci.nih.gov/src/backward12
-rw-r--r--elsie.nci.nih.gov/src/checktab.awk29
-rw-r--r--elsie.nci.nih.gov/src/date.113
-rw-r--r--elsie.nci.nih.gov/src/date.1.txt12
-rw-r--r--elsie.nci.nih.gov/src/date.c155
-rw-r--r--elsie.nci.nih.gov/src/difftime.c10
-rw-r--r--elsie.nci.nih.gov/src/etcetera4
-rw-r--r--elsie.nci.nih.gov/src/europe126
-rw-r--r--elsie.nci.nih.gov/src/iso3166.tab6
-rw-r--r--elsie.nci.nih.gov/src/leap-seconds.list231
-rw-r--r--elsie.nci.nih.gov/src/leapseconds.awk68
-rw-r--r--elsie.nci.nih.gov/src/localtime.c124
-rw-r--r--elsie.nci.nih.gov/src/newctime.318
-rw-r--r--elsie.nci.nih.gov/src/newctime.3.txt20
-rw-r--r--elsie.nci.nih.gov/src/newstrftime.35
-rw-r--r--elsie.nci.nih.gov/src/newstrftime.3.txt12
-rw-r--r--elsie.nci.nih.gov/src/newtzset.358
-rw-r--r--elsie.nci.nih.gov/src/newtzset.3.txt58
-rw-r--r--elsie.nci.nih.gov/src/northamerica142
-rw-r--r--elsie.nci.nih.gov/src/private.h30
-rw-r--r--elsie.nci.nih.gov/src/southamerica42
-rw-r--r--elsie.nci.nih.gov/src/strftime.c2
-rw-r--r--elsie.nci.nih.gov/src/tz-link.htm17
-rw-r--r--elsie.nci.nih.gov/src/tzfile.553
-rw-r--r--elsie.nci.nih.gov/src/tzfile.5.txt64
-rw-r--r--elsie.nci.nih.gov/src/tzfile.h13
-rw-r--r--elsie.nci.nih.gov/src/tzselect.872
-rw-r--r--elsie.nci.nih.gov/src/tzselect.8.txt39
-rw-r--r--elsie.nci.nih.gov/src/tzselect.ksh237
-rw-r--r--elsie.nci.nih.gov/src/zdump.815
-rw-r--r--elsie.nci.nih.gov/src/zdump.8.txt10
-rw-r--r--elsie.nci.nih.gov/src/zdump.c116
-rw-r--r--elsie.nci.nih.gov/src/zic.886
-rw-r--r--elsie.nci.nih.gov/src/zic.8.txt110
-rw-r--r--elsie.nci.nih.gov/src/zic.c307
-rw-r--r--elsie.nci.nih.gov/src/zone.tab32
42 files changed, 2013 insertions, 846 deletions
diff --git a/elsie.nci.nih.gov/src/Makefile b/elsie.nci.nih.gov/src/Makefile
index 3659378..dfdb112 100644
--- a/elsie.nci.nih.gov/src/Makefile
+++ b/elsie.nci.nih.gov/src/Makefile
@@ -6,7 +6,7 @@
PACKAGE= tzcode
# Version numbers of the code and data distributions.
-VERSION= 2013d
+VERSION= 2013e
# Email address for bug reports.
BUGEMAIL= tz@iana.org
@@ -28,7 +28,7 @@ LOCALTIME= GMT
# time zone files, or adding it to a time zone file).
# (When a POSIX-style environment variable is handled, the rules in the
# template file are used to determine "spring forward" and "fall back" days and
-# times; the environment variable itself specifies UTC offsets of standard and
+# times; the environment variable itself specifies UT offsets of standard and
# summer time.)
# Alternately, if you discover you've got the wrong time zone, you can just
# zic -p rightzone
@@ -51,7 +51,8 @@ TOPDIR= /usr/local
# (and subdirectories).
# Use an absolute path name for TZDIR unless you're just testing the software.
-TZDIR= $(TOPDIR)/etc/zoneinfo
+TZDIR_BASENAME= zoneinfo
+TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME)
# Types to try, as an alternative to time_t. int64_t should be first.
TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t
@@ -120,7 +121,6 @@ LDLIBS=
# -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
# if you do not want run time warnings about formats that may cause
# year 2000 grief
-# -DTIME_T_FLOATING=1 if your time_t (or time_tz) is floating point
# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t
# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
# -TTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
@@ -187,7 +187,7 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
# that gives an offset to add to the time_t when converting it.
# "timelocal" is equivalent to "mktime".
# "timegm" is like "timelocal" except that it turns a struct tm into
-# a time_t using UTC (rather than local time as "timelocal" does).
+# a time_t using UT (rather than local time as "timelocal" does).
# "timeoff" is like "timegm" except that it accepts a second (long) argument
# that gives an offset to use when converting to a time_t.
# "posix2time" and "time2posix" are described in an included manual page.
@@ -241,6 +241,8 @@ LDFLAGS= $(LFLAGS)
zic= ./zic
ZIC= $(zic) $(ZFLAGS)
+ZFLAGS=
+
# The name of a Posix-compliant `awk' on your system.
AWK= awk
@@ -318,10 +320,12 @@ NDATA= systemv factory
SDATA= solar87 solar88 solar89
TDATA= $(YDATA) $(NDATA) $(SDATA)
TABDATA= iso3166.tab zone.tab
-DATA= $(YDATA) $(NDATA) $(SDATA) $(TABDATA) leapseconds yearistype.sh
+DATA= $(YDATA) $(NDATA) $(SDATA) $(TABDATA) \
+ leap-seconds.list yearistype.sh
WEB_PAGES= tz-art.htm tz-link.htm
+AWK_SCRIPTS= checktab.awk leapseconds.awk
MISC= usno1988 usno1989 usno1989a usno1995 usno1997 usno1998 \
- $(WEB_PAGES) checktab.awk workman.sh \
+ $(WEB_PAGES) $(AWK_SCRIPTS) workman.sh \
zoneinfo2tdf.pl
ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
@@ -330,35 +334,38 @@ ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
SHELL= /bin/sh
-all: tzselect zic zdump $(LIBOBJS)
+all: tzselect zic zdump $(LIBOBJS) $(TABDATA)
ALL: all date
-install: all $(DATA) $(REDO) $(TZLIB) $(MANS) $(TABDATA)
+install: all $(DATA) $(REDO) $(DESTDIR)$(TZLIB) $(MANS)
$(ZIC) -y $(YEARISTYPE) \
- -d $(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
- -rm -f $(TZDIR)/iso3166.tab $(TZDIR)/zone.tab
- cp iso3166.tab zone.tab $(TZDIR)/.
- -mkdir $(TOPDIR) $(ETCDIR)
- cp tzselect zic zdump $(ETCDIR)/.
- -mkdir $(TOPDIR) $(MANDIR) \
- $(MANDIR)/man3 $(MANDIR)/man5 $(MANDIR)/man8
- -rm -f $(MANDIR)/man3/newctime.3 \
- $(MANDIR)/man3/newtzset.3 \
- $(MANDIR)/man5/tzfile.5 \
- $(MANDIR)/man8/tzselect.8 \
- $(MANDIR)/man8/zdump.8 \
- $(MANDIR)/man8/zic.8
- cp newctime.3 newtzset.3 $(MANDIR)/man3/.
- cp tzfile.5 $(MANDIR)/man5/.
- cp tzselect.8 zdump.8 zic.8 $(MANDIR)/man8/.
+ -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+ -rm -f $(DESTDIR)$(TZDIR)/iso3166.tab \
+ $(DESTDIR)$(TZDIR)/zone.tab
+ cp iso3166.tab zone.tab $(DESTDIR)$(TZDIR)/.
+ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(ETCDIR)
+ cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
+ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(MANDIR) \
+ $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
+ $(DESTDIR)$(MANDIR)/man8
+ -rm -f $(DESTDIR)$(MANDIR)/man3/newctime.3 \
+ $(DESTDIR)$(MANDIR)/man3/newtzset.3 \
+ $(DESTDIR)$(MANDIR)/man5/tzfile.5 \
+ $(DESTDIR)$(MANDIR)/man8/tzselect.8 \
+ $(DESTDIR)$(MANDIR)/man8/zdump.8 \
+ $(DESTDIR)$(MANDIR)/man8/zic.8
+ cp newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
+ cp tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
+ cp tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
INSTALL: ALL install date.1
- -mkdir $(TOPDIR) $(BINDIR)
- cp date $(BINDIR)/.
- -mkdir $(TOPDIR) $(MANDIR) $(MANDIR)/man1
- -rm -f $(MANDIR)/man1/date.1
- cp date.1 $(MANDIR)/man1/.
+ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(BINDIR)
+ cp date $(DESTDIR)$(BINDIR)/.
+ -mkdir $(DESTDIR)$(TOPDIR) $(DESTDIR)$(MANDIR) \
+ $(DESTDIR)$(MANDIR)/man1
+ -rm -f $(DESTDIR)$(MANDIR)/man1/date.1
+ cp date.1 $(DESTDIR)$(MANDIR)/man1/.
version.h:
(echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \
@@ -375,11 +382,16 @@ yearistype: yearistype.sh
cp yearistype.sh yearistype
chmod +x yearistype
+leapseconds: leapseconds.awk leap-seconds.list
+ $(AWK) -f leapseconds.awk leap-seconds.list >$@
+
posix_only: zic $(TDATA)
- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
+ -L /dev/null $(TDATA)
right_only: zic leapseconds $(TDATA)
- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \
+ -L leapseconds $(TDATA)
# In earlier versions of this makefile, the other two directories were
# subdirectories of $(TZDIR). However, this led to configuration errors.
@@ -390,19 +402,26 @@ right_only: zic leapseconds $(TDATA)
# Therefore, the other two directories are now siblings of $(TZDIR).
# You must replace all of $(TZDIR) to switch from not using leap seconds
# to using them, or vice versa.
-other_two: zic leapseconds $(TDATA)
- $(ZIC) -y $(YEARISTYPE) -d $(TZDIR)-posix -L /dev/null $(TDATA)
- $(ZIC) -y $(YEARISTYPE) \
- -d $(TZDIR)-leaps -L leapseconds $(TDATA)
-
-posix_right: posix_only other_two
-
-right_posix: right_only other_two
+right_posix: right_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-leaps
+ ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
+ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
+ -L leapseconds $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
+ -L /dev/null $(TDATA)
+
+posix_right: posix_only leapseconds
+ rm -fr $(DESTDIR)$(TZDIR)-posix
+ ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
+ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \
+ -L /dev/null $(TDATA)
+ $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \
+ -L leapseconds $(TDATA)
zones: $(REDO)
-$(TZLIB): $(LIBOBJS)
- -mkdir $(TOPDIR) $(LIBDIR)
+$(DESTDIR)$(TZLIB): $(LIBOBJS)
+ -mkdir -p $(DESTDIR)$(TOPDIR) $(DESTDIR)$(LIBDIR)
ar ru $@ $(LIBOBJS)
if [ -x /usr/ucb/ranlib ] || [ -x /usr/bin/ranlib ]; \
then ranlib $@ ; fi
@@ -434,7 +453,7 @@ check_web: $(WEB_PAGES)
clean_misc:
rm -f core *.o *.out \
- date tzselect version.h zdump zic yearistype
+ date leapseconds tzselect version.h zdump zic yearistype
clean: clean_misc
rm -f -r tzpublic
@@ -534,7 +553,7 @@ tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
typecheck:
make clean
- for i in "long long" unsigned double; \
+ for i in "long long" unsigned; \
do \
make CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
./zdump -v Europe/Rome ; \
diff --git a/elsie.nci.nih.gov/src/Theory b/elsie.nci.nih.gov/src/Theory
index 751b12d..0b02ddc 100644
--- a/elsie.nci.nih.gov/src/Theory
+++ b/elsie.nci.nih.gov/src/Theory
@@ -12,16 +12,13 @@ This file is in the public domain, so clarified as of
----- Time and date functions -----
-These time and date functions are upwards compatible with POSIX,
+These time and date functions are upwards compatible with those of POSIX,
an international standard for UNIX-like systems.
As of this writing, the current edition of POSIX is:
- Standard for Information technology
- -- Portable Operating System Interface (POSIX (R))
- -- System Interfaces
- IEEE Std 1003.1, 2004 Edition
- <http://www.opengroup.org/online-pubs?DOC=7999959899>
- <http://www.opengroup.org/pubs/catalog/t041.htm>
+ The Open Group Base Specifications Issue 7
+ IEEE Std 1003.1, 2013 Edition
+ <http://pubs.opengroup.org/onlinepubs/9699919799/>
POSIX has the following properties and limitations.
@@ -34,7 +31,7 @@ POSIX has the following properties and limitations.
The POSIX TZ string takes the following form:
- stdoffset[dst[offset],date[/time],date[/time]]
+ stdoffset[dst[offset][,date[/time],date[/time]]]
where:
@@ -45,15 +42,17 @@ POSIX has the following properties and limitations.
in a quoted form like "<UTC+10>"; this allows
"+" and "-" in the names.
offset
- is of the form `[-]hh:[mm[:ss]]' and specifies the
- offset west of UTC. The default DST offset is one hour
- ahead of standard time.
+ is of the form '[+-]hh:[mm[:ss]]' and specifies the
+ offset west of UT. 'hh' may be a single digit; 0<=hh<=24.
+ The default DST offset is one hour ahead of standard time.
date[/time],date[/time]
specifies the beginning and end of DST. If this is absent,
the system supplies its own rules for DST, and these can
differ from year to year; typically US DST rules are used.
time
- takes the form `hh:[mm[:ss]]' and defaults to 02:00.
+ takes the form 'hh:[mm[:ss]]' and defaults to 02:00.
+ This is the same format as the offset, except that a
+ leading '+' or '-' is not allowed.
date
takes one of the following forms:
Jn (1<=n<=365)
@@ -63,8 +62,10 @@ POSIX has the following properties and limitations.
Mm.n.d (0[Sunday]<=d<=6[Saturday], 1<=n<=5, 1<=m<=12)
for the dth day of week n of month m of the year,
where week 1 is the first week in which day d appears,
- and `5' stands for the last week in which day d appears
+ and '5' stands for the last week in which day d appears
(which may be either the 4th or 5th week).
+ Typically, this is the only useful form;
+ the n and Jn forms are rarely used.
Here is an example POSIX TZ string, for US Pacific time using rules
appropriate from 1987 through 2006:
@@ -95,6 +96,19 @@ POSIX has the following properties and limitations.
* POSIX requires that systems ignore leap seconds.
+* The tz code attempts attempts to support all the time_t implementations
+ allowed by POSIX. The time_t type represents a nonnegative count of
+ seconds since 1970-01-01 00:00:00 UTC, ignoring leap seconds.
+ In practice, time_t is usually a signed 64- or 32-bit integer; 32-bit
+ signed time_t values stop working after 2038-01-19 03:14:07 UTC, so
+ new implementations these days typically use a signed 64-bit integer.
+ Unsigned 32-bit integers are used on one or two platforms,
+ and 36-bit integers are also used occasionally.
+ Although earlier POSIX versions allowed time_t to be a
+ floating-point type, this was not supported by any practical
+ systems, and POSIX.1-2013 and the tz code both require time_t
+ to be an integer type.
+
These are the extensions that have been made to the POSIX functions:
* The "TZ" environment variable is used in generating the name of a file
@@ -146,6 +160,8 @@ These are the extensions that have been made to the POSIX functions:
environment variable; portable applications should not, however, rely
on this behavior since it's not the way SVR2 systems behave.)
+* Negative time_t values are supported, on systems where time_t is signed.
+
* These functions can account for leap seconds, thanks to Bradley White.
Points of interest to folks with other systems:
@@ -155,7 +171,7 @@ Points of interest to folks with other systems:
On such hosts, the primary use of this package
is to update obsolete time zone rule tables.
To do this, you may need to compile the time zone compiler
- `zic' supplied with this package instead of using the system `zic',
+ 'zic' supplied with this package instead of using the system 'zic',
since the format of zic's input changed slightly in late 1994,
and many vendors still do not support the new input format.
@@ -173,7 +189,7 @@ Points of interest to folks with other systems:
but this functionality was removed in later versions of BSD.
* In SVR2, time conversion fails for near-minimum or near-maximum
- time_t values when doing conversions for places that don't use UTC.
+ time_t values when doing conversions for places that don't use UT.
This package takes care to do these conversions correctly.
The functions that are conditionally compiled if STD_INSPIRED is defined
@@ -200,7 +216,10 @@ data, the world is partitioned into regions whose clocks all agree
about time stamps that occur after the somewhat-arbitrary cutoff point
of the POSIX Epoch (1970-01-01 00:00:00 UTC). For each such region,
the database records all known clock transitions, and labels the region
-with a notable location.
+with a notable location. Although 1970 is a somewhat-arbitrary
+cutoff, there are significant challenges to moving the cutoff earlier
+even by a decade or two, due to the wide variety of local practices
+before computer timekeeping became prevalent.
Clock transitions before 1970 are recorded for each such location,
because most POSIX-compatible systems support negative time stamps and
@@ -210,12 +229,134 @@ applications requiring accurate handling of all past times everywhere,
as it would take far too much effort and guesswork to record all
details of pre-1970 civil timekeeping.
-As noted in the README file, the tz database is not authoritative
-(particularly not for pre-1970 time stamps), and it surely has errors.
+
+----- Accuracy of the tz database -----
+
+The tz database is not authoritative, and it surely has errors.
Corrections are welcome and encouraged. Users requiring authoritative
data should consult national standards bodies and the references cited
in the database's comments.
+Errors in the tz database arise from many sources:
+
+ * The tz database predicts future time stamps, 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
+ daylight saving rules, software can mess up after the rule change
+ if it blithely relies on conversions made before the change.
+
+ * The pre-1970 data in this database cover only a tiny sliver of how
+ clocks actually behaved; the vast majority of the necessary
+ information was lost or never recorded. Thousands more zones would
+ be needed if the tz database's scope were extended to cover even
+ just the known or guessed history of standard time; for example,
+ the current single entry for France would need to split into dozens
+ of entries, perhaps hundreds.
+
+ * Most of the pre-1970 data comes from unreliable sources, often
+ astrology books that lack citations and whose compilers evidently
+ invented entries when the true facts were unknown, without
+ reporting which entries were known and which were invented.
+ These books often contradict each other or give implausible entries,
+ and on the rare occasions when their old data are checked they are
+ typically found to be incorrect.
+
+ * For the UK the tz database relies on years of first-class work done by
+ Joseph Myers and others; see <http://www.polyomino.org.uk/british-time/>.
+ Other countries are not done nearly as well.
+
+ * Sometimes, different people in the same city would maintain clocks
+ that differed significantly. Railway time was used by railroad
+ companies (which did not always agree with each other),
+ church-clock time was used for birth certificates, etc.
+ Often this was merely common practice, but sometimes it was set by law.
+ For example, from 1891 to 1911 the UT offset in France was legally
+ 0:09:21 outside train stations and 0:04:21 inside.
+
+ * Although a named location in the tz database stands for the
+ containing region, its pre-1970 data entries are often accurate for
+ only a small subset of that region. For example, Europe/London
+ stands for the United Kingdom, but its pre-1847 times are valid
+ only for locations that have London's exact meridian, and its 1847
+ transition to GMT is known to be valid only for the L&NW and the
+ Caledonian railways.
+
+ * The tz database does not record the earliest time for which a
+ zone's data is thereafter valid for every location in the region.
+ For example, Europe/London is valid for all locations in its
+ region after GMT was made the standard time, but the date of
+ standardization (1880-08-02) is not in the tz database, other than
+ in commentary. For many zones the earliest time of validity is
+ unknown.
+
+ * The tz database does not record a region's boundaries, and in many
+ cases the boundaries are not known. For example, the zone
+ America/Kentucky/Louisville represents a region around the city of
+ Louisville, the boundaries of which are unclear.
+
+ * Changes that are modeled as instantaneous transitions in the tz
+ database were often spread out over hours, days, or even decades.
+
+ * Even if the time is specified by law, locations sometimes
+ deliberately flout the law.
+
+ * Early timekeeping practices, even assuming perfect clocks, were
+ often not specified to the accuracy that the tz database requires.
+
+ * Sometimes historical timekeeping was specified more precisely
+ than what the tz database can handle. For example, from 1909 to
+ 1937 Netherlands clocks were legally UT+00:19:32.13, but the tz
+ database cannot represent the fractional second.
+
+ * Even when all the timestamp transitions recorded by the tz database
+ are correct, the tz rules that generate them may not faithfully
+ reflect the historical rules. For example, from 1922 until World
+ War II the UK moved clocks forward the day following the third
+ Saturday in April unless that was Easter, in which case it moved
+ clocks forward the previous Sunday. Because the tz database has no
+ way to specify Easter, these exceptional years are entered as
+ separate tz Rule lines, even though the legal rules did not change.
+
+ * The tz database models pre-standard time using the Gregorian
+ calendar and local mean time (LMT), but many people used other
+ calendars and other timescales. For example, the Roman Empire used
+ the Julian calendar, and had 12 varying-length daytime hours with a
+ non-hour-based system at night.
+
+ * Early clocks were less reliable, and the data do not represent this
+ unreliability.
+
+ * As for leap seconds, civil time was not based on atomic time before
+ 1972, and we don't know the history of earth's rotation accurately
+ enough to map SI seconds to historical solar time to more than
+ about one-hour accuracy. See: Morrison LV, Stephenson FR.
+ Historical values of the Earth's clock error Delta T and the
+ calculation of eclipses. J Hist Astron. 2004;35:327-36
+ <http://adsabs.harvard.edu/full/2004JHA....35..327M>;
+ Historical values of the Earth's clock error. J Hist Astron. 2005;36:339
+ <http://adsabs.harvard.edu/full/2005JHA....36..339M>.
+
+ * The relationship between POSIX time (that is, UTC but ignoring leap
+ seconds) and UTC is not agreed upon after 1972. 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.
+
+ * The tz database does not represent how uncertain its information is.
+ Ideally it would contain information about when the data are
+ incomplete or dicey. Partial temporal knowledge is a field of
+ active research, though, and it's not clear how to apply it here.
+
+In short, many, perhaps most, of the tz database's pre-1970 and future
+time stamps are either wrong or misleading. Any attempt to pass the
+tz database off as the definition of time should be unacceptable to
+anybody who cares about the facts. In particular, the tz database's
+LMT offsets should not be considered meaningful, and should not prompt
+creation of zones merely because two locations differ in LMT or
+transitioned to standard time at different dates.
+
----- Names of time zone rule files -----
@@ -251,75 +392,88 @@ one example.
Names normally have the form AREA/LOCATION, where AREA is the name
of a continent or ocean, and LOCATION is the name of a specific
location within that region. North and South America share the same
-area, `America'. Typical names are `Africa/Cairo', `America/New_York',
-and `Pacific/Honolulu'.
+area, 'America'. Typical names are 'Africa/Cairo', 'America/New_York',
+and 'Pacific/Honolulu'.
Here are the general rules used for choosing location names,
in decreasing order of importance:
Use only valid POSIX file name components (i.e., the parts of
- names other than `/'). Within a file name component,
- use only ASCII letters, `.', `-' and `_'. Do not use
+ names other than '/'). Do not use the file name
+ components '.' and '..'. Within a file name component,
+ use only ASCII letters, '.', '-' and '_'. Do not use
digits, as that might create an ambiguity with POSIX
TZ strings. A file name component must not exceed 14
- characters or start with `-'. E.g., prefer `Brunei'
- to `Bandar_Seri_Begawan'.
+ characters or start with '-'. E.g., prefer 'Brunei'
+ to 'Bandar_Seri_Begawan'.
+ A name must not be empty, or contain '//', or start or end with '/'.
Do not use names that differ only in case. Although the reference
- implementation is case-sensitive, some other implementations
+ implementation is case-sensitive, some other implementations
are not, and they would mishandle names differing only in case.
+ If one name A is an initial prefix of another name AB (ignoring case),
+ then B must not start with '/', as a regular file cannot have
+ the same name as a directory in POSIX. For example,
+ 'America/New_York' precludes 'America/New_York/Bronx'.
Uninhabited regions like the North Pole and Bouvet Island
do not need locations, since local time is not defined there.
+ There should typically be at least one name for each ISO 3166-1
+ officially assigned two-letter code for an inhabited country
+ or territory.
If all the clocks in a region have agreed since 1970,
don't bother to include more than one location
even if subregions' clocks disagreed before 1970.
Otherwise these tables would become annoyingly large.
If a name is ambiguous, use a less ambiguous alternative;
e.g. many cities are named San Jose and Georgetown, so
- prefer `Costa_Rica' to `San_Jose' and `Guyana' to `Georgetown'.
+ prefer 'Costa_Rica' to 'San_Jose' and 'Guyana' to 'Georgetown'.
Keep locations compact. Use cities or small islands, not countries
or regions, so that any future time zone changes do not split
- locations into different time zones. E.g. prefer `Paris'
- to `France', since France has had multiple time zones.
- Use mainstream English spelling, e.g. prefer `Rome' to `Roma', and
- prefer `Athens' to the true name (which uses Greek letters).
+ locations into different time zones. E.g. prefer 'Paris'
+ to 'France', since France has had multiple time zones.
+ Use mainstream English spelling, e.g. prefer 'Rome' to 'Roma', and
+ prefer 'Athens' to the true name (which uses Greek letters).
The POSIX file name restrictions encourage this rule.
Use the most populous among locations in a zone,
- e.g. prefer `Shanghai' to `Beijing'. Among locations with
+ e.g. prefer 'Shanghai' to 'Beijing'. Among locations with
similar populations, pick the best-known location,
- e.g. prefer `Rome' to `Milan'.
- Use the singular form, e.g. prefer `Canary' to `Canaries'.
- Omit common suffixes like `_Islands' and `_City', unless that
- would lead to ambiguity. E.g. prefer `Cayman' to
- `Cayman_Islands' and `Guatemala' to `Guatemala_City',
- but prefer `Mexico_City' to `Mexico' because the country
+ e.g. prefer 'Rome' to 'Milan'.
+ Use the singular form, e.g. prefer 'Canary' to 'Canaries'.
+ Omit common suffixes like '_Islands' and '_City', unless that
+ would lead to ambiguity. E.g. prefer 'Cayman' to
+ 'Cayman_Islands' and 'Guatemala' to 'Guatemala_City',
+ but prefer 'Mexico_City' to 'Mexico' because the country
of Mexico has several time zones.
- Use `_' to represent a space.
- Omit `.' from abbreviations in names, e.g. prefer `St_Helena'
- to `St._Helena'.
+ Use '_' to represent a space.
+ Omit '.' from abbreviations in names, e.g. prefer 'St_Helena'
+ to 'St._Helena'.
Do not change established names if they only marginally
violate the above rules. For example, don't change
- the existing name `Rome' to `Milan' merely because
+ the existing name 'Rome' to 'Milan' merely because
Milan's population has grown to be somewhat greater
than Rome's.
- If a name is changed, put its old spelling in the `backward' file.
+ If a name is changed, put its old spelling in the 'backward' file.
This means old spellings will continue to work.
-The file `zone.tab' lists the geographical locations used to name
-time zone rule files. It is intended to be an exhaustive list
-of names for geographic regions as described above.
+The file 'zone.tab' lists geographical locations used to name time
+zone rule files. It is intended to be an exhaustive list of names
+for geographic regions as described above; this is a subset of the
+names in the data. Although a 'zone.tab' location's longitude
+corresponds to its LMT offset with one hour for every 15 degrees east
+longitude, this relationship is not exact.
Older versions of this package used a different naming scheme,
and these older names are still supported.
-See the file `backward' for most of these older names
-(e.g. `US/Eastern' instead of `America/New_York').
+See the file 'backward' for most of these older names
+(e.g. 'US/Eastern' instead of 'America/New_York');
+excluding 'backward' should not affect the other data.
The other old-fashioned names still supported are
-`WET', `CET', `MET', and `EET' (see the file `europe').
+'WET', 'CET', 'MET', and 'EET' (see the file 'europe').
----- Time zone abbreviations -----
When this package is installed, it generates time zone abbreviations
-like `EST' to be compatible with human tradition and POSIX.
+like 'EST' to be compatible with human tradition and POSIX.
Here are the general rules used for choosing time zone abbreviations,
in decreasing order of importance:
@@ -346,37 +500,40 @@ in decreasing order of importance:
letters.
Use abbreviations that are in common use among English-speakers,
- e.g. `EST' for Eastern Standard Time in North America.
+ e.g. 'EST' for Eastern Standard Time in North America.
We assume that applications translate them to other languages
as part of the normal localization process; for example,
- a French application might translate `EST' to `HNE'.
+ a French application might translate 'EST' to 'HNE'.
For zones whose times are taken from a city's longitude, use the
- traditional xMT notation, e.g. `PMT' for Paris Mean Time.
- The only name like this in current use is `GMT'.
+ traditional xMT notation, e.g. 'PMT' for Paris Mean Time.
+ The only name like this in current use is 'GMT'.
If there is no common English abbreviation, abbreviate the English
translation of the usual phrase used by native speakers.
If this is not available or is a phrase mentioning the country
- (e.g. ``Cape Verde Time''), then:
+ (e.g. "Cape Verde Time"), then:
When a country is identified with a single or principal zone,
- append `T' to the country's ISO code, e.g. `CVT' for
- Cape Verde Time. For summer time append `ST';
- for double summer time append `DST'; etc.
+ append 'T' to the country's ISO code, e.g. 'CVT' for
+ Cape Verde Time. For summer time append 'ST';
+ for double summer time append 'DST'; etc.
Otherwise, take the first three letters of an English place
name identifying each zone and append 'T', 'ST', etc.
as before; e.g. 'VLAST' for VLAdivostok Summer Time.
- Use UTC (with time zone abbreviation "zzz") for locations while
- uninhabited. The "zzz" mnemonic is that these locations are,
+ Use 'LMT' for local mean time of locations before the introduction
+ of standard time; see "Scope of the tz database".
+
+ Use UT (with time zone abbreviation 'zzz') for locations while
+ uninhabited. The 'zzz' mnemonic is that these locations are,
in some sense, asleep.
Application writers should note that these abbreviations are ambiguous
-in practice: e.g. `EST' has a different meaning in Australia than
+in practice: e.g. 'EST' has a different meaning in Australia than
it does in the United States. In new applications, it's often better
-to use numeric UTC offsets like `-0500' instead of time zone
-abbreviations like `EST'; this avoids the ambiguity.
+to use numeric UT offsets like '-0500' instead of time zone
+abbreviations like 'EST'; this avoids the ambiguity.
----- Calendrical issues -----
@@ -401,7 +558,7 @@ and (in Paris only) 1871-05-06 through 1871-05-23.
Russia
From Chris Carrier (1996-12-02):
-On 1929-10-01 the Soviet Union instituted an ``Eternal Calendar''
+On 1929-10-01 the Soviet Union instituted an "Eternal Calendar"
with 30-day months plus 5 holidays, with a 5-day week.
On 1931-12-01 it changed to a 6-day week; in 1934 it reverted to the
Gregorian calendar while retaining the 6-day week; on 1940-06-27 it
diff --git a/elsie.nci.nih.gov/src/africa b/elsie.nci.nih.gov/src/africa
index a92d7f5..9a5d93b 100644
--- a/elsie.nci.nih.gov/src/africa
+++ b/elsie.nci.nih.gov/src/africa
@@ -1100,9 +1100,7 @@ Zone Africa/Khartoum 2:10:08 - LMT 1931
3:00 - EAT
# South Sudan
-Zone Africa/Juba 2:06:24 - LMT 1931
- 2:00 Sudan CA%sT 2000 Jan 15 12:00
- 3:00 - EAT
+Link Africa/Khartoum Africa/Juba
# Swaziland
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
diff --git a/elsie.nci.nih.gov/src/antarctica b/elsie.nci.nih.gov/src/antarctica
index 9bf2494..5333b7b 100644
--- a/elsie.nci.nih.gov/src/antarctica
+++ b/elsie.nci.nih.gov/src/antarctica
@@ -16,9 +16,9 @@
#
# Except for the French entries,
# I made up all time zone abbreviations mentioned here; corrections welcome!
-# FORMAT is `zzz' and GMTOFF is 0 for locations while uninhabited.
+# FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited.
-# These rules are stolen from the `southamerica' file.
+# These rules are stolen from the 'southamerica' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule ArgAQ 1964 1966 - Mar 1 0:00 0 -
Rule ArgAQ 1964 1966 - Oct 15 0:00 1:00 S
@@ -228,9 +228,10 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 29
# Scott Island (never inhabited)
#
# year-round base
-# Scott, Ross Island, since 1957-01, is like Antarctica/McMurdo.
+# Scott Base, Ross Island, since 1957-01.
+# See Pacific/Auckland.
#
-# These rules for New Zealand are stolen from the `australasia' file.
+# These rules for New Zealand are stolen from the 'australasia' file.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule NZAQ 1974 only - Nov 3 2:00s 1:00 D
Rule NZAQ 1975 1988 - Oct lastSun 2:00s 1:00 D
@@ -268,11 +269,11 @@ Rule NZAQ 2008 max - Apr Sun>=1 2:00s 0 S
# From Lee Hotz (2001-03-08):
# I queried the folks at Columbia who spent the summer at Vostok and this is
# what they had to say about time there:
-# ``in the US Camp (East Camp) we have been on New Zealand (McMurdo)
+# "in the US Camp (East Camp) we have been on New Zealand (McMurdo)
# time, which is 12 hours ahead of GMT. The Russian Station Vostok was
# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead
# of GMT). This is a time zone I think two hours east of Moscow. The
-# natural time zone is in between the two: 8 hours ahead of GMT.''
+# natural time zone is in between the two: 8 hours ahead of GMT."
#
# From Paul Eggert (2001-05-04):
# This seems to be hopelessly confusing, so I asked Lee Hotz about it
@@ -337,16 +338,8 @@ Zone Antarctica/Palmer 0 - zzz 1965
-4:00 ChileAQ CL%sT
#
#
-# McMurdo, Ross Island, since 1955-12
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Antarctica/McMurdo 0 - zzz 1956
- 12:00 NZAQ NZ%sT
-#
-# Amundsen-Scott, South Pole, continuously occupied since 1956-11-20
-#
-# From Paul Eggert (1996-09-03):
-# Normally it wouldn't have a separate entry, since it's like the
-# larger Antarctica/McMurdo since 1970, but it's too famous to omit.
+# McMurdo Station, Ross Island, since 1955-12
+# Amundsen-Scott South Pole Station, continuously occupied since 1956-11-20
#
# From Chris Carrier (1996-06-27):
# Siple, the first commander of the South Pole station,
@@ -368,4 +361,4 @@ Zone Antarctica/McMurdo 0 - zzz 1956
# we have to go around and set them back 5 minutes or so.
# Maybe if we let them run fast all of the time, we'd get to leave here sooner!!
#
-Link Antarctica/McMurdo Antarctica/South_Pole
+# See 'australasia' for Antarctica/McMurdo.
diff --git a/elsie.nci.nih.gov/src/asia b/elsie.nci.nih.gov/src/asia
index 79cfc48..5a824f8 100644
--- a/elsie.nci.nih.gov/src/asia
+++ b/elsie.nci.nih.gov/src/asia
@@ -6,7 +6,7 @@
# go ahead and edit the file (and please send any changes to
# tz@iana.org for general use in the future).
-# From Paul Eggert (2013-02-21):
+# From Paul Eggert (2013-08-11):
#
# A good source for time zone historical data outside the U.S. is
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
@@ -44,11 +44,11 @@
# 4:00 GST Gulf*
# 5:30 IST India
# 7:00 ICT Indochina*
-# 7:00 WIT west Indonesia
-# 8:00 CIT central Indonesia
+# 7:00 WIB west Indonesia (Waktu Indonesia Barat)
+# 8:00 WITA central Indonesia (Waktu Indonesia Tengah)
# 8:00 CST China
# 9:00 CJT Central Japanese Time (1896/1937)*
-# 9:00 EIT east Indonesia
+# 9:00 WIT east Indonesia (Waktu Indonesia Timur)
# 9:00 JST JDT Japan
# 9:00 KST KDT Korea
# 9:30 CST (Australian) Central Standard Time
@@ -756,7 +756,7 @@ Zone Asia/Dili 8:22:20 - LMT 1912
8:00 - TLT 1942 Feb 21 23:00 # E Timor Time
9:00 - JST 1945 Sep 23
9:00 - TLT 1976 May 3
- 8:00 - CIT 2000 Sep 17 00:00
+ 8:00 - WITA 2000 Sep 17 00:00
9:00 - TLT
# India
@@ -793,36 +793,53 @@ Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata
# (Hollandia). For now, assume all Indonesian locations other than Jayapura
# switched on 1945-09-23.
#
+# From Paul Eggert (2013-08-11):
+# Normally the tz database uses English-language abbreviations, but in
+# Indonesia it's typical to use Indonesian-language abbreviations even
+# when writing in English. For example, see the English-language
+# summary published by the Time and Frequency Laboratory of the
+# Research Center for Calibration, Instrumentation and Metrology,
+# Indonesia, <http://time.kim.lipi.go.id/time-eng.php> (2006-09-29).
+# The abbreviations are:
+#
+# WIB - UTC+7 - Waktu Indonesia Barat (Indonesia western time)
+# WITA - UTC+8 - Waktu Indonesia Tengah (Indonesia central time)
+# WIT - UTC+9 - Waktu Indonesia Timur (Indonesia eastern time)
+#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+# Java, Sumatra
Zone Asia/Jakarta 7:07:12 - LMT 1867 Aug 10
# Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13,
# but this must be a typo.
- 7:07:12 - JMT 1923 Dec 31 23:47:12 # Jakarta
+ 7:07:12 - BMT 1923 Dec 31 23:47:12 # Batavia
7:20 - JAVT 1932 Nov # Java Time
- 7:30 - WIT 1942 Mar 23
+ 7:30 - WIB 1942 Mar 23
9:00 - JST 1945 Sep 23
- 7:30 - WIT 1948 May
- 8:00 - WIT 1950 May
- 7:30 - WIT 1964
- 7:00 - WIT
+ 7:30 - WIB 1948 May
+ 8:00 - WIB 1950 May
+ 7:30 - WIB 1964
+ 7:00 - WIB
+# west and central Borneo
Zone Asia/Pontianak 7:17:20 - LMT 1908 May
7:17:20 - PMT 1932 Nov # Pontianak MT
- 7:30 - WIT 1942 Jan 29
+ 7:30 - WIB 1942 Jan 29
9:00 - JST 1945 Sep 23
- 7:30 - WIT 1948 May
- 8:00 - WIT 1950 May
- 7:30 - WIT 1964
- 8:00 - CIT 1988 Jan 1
- 7:00 - WIT
+ 7:30 - WIB 1948 May
+ 8:00 - WIB 1950 May
+ 7:30 - WIB 1964
+ 8:00 - WITA 1988 Jan 1
+ 7:00 - WIB
+# Sulawesi, Lesser Sundas, east and south Borneo
Zone Asia/Makassar 7:57:36 - LMT 1920
7:57:36 - MMT 1932 Nov # Macassar MT
- 8:00 - CIT 1942 Feb 9
+ 8:00 - WITA 1942 Feb 9
9:00 - JST 1945 Sep 23
- 8:00 - CIT
+ 8:00 - WITA
+# Maluku Islands, West Papua, Papua
Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov
- 9:00 - EIT 1944 Sep 1
+ 9:00 - WIT 1944 Sep 1
9:30 - CST 1964
- 9:00 - EIT
+ 9:00 - WIT
# Iran
diff --git a/elsie.nci.nih.gov/src/australasia b/elsie.nci.nih.gov/src/australasia
index 797f81c..8685d00 100644
--- a/elsie.nci.nih.gov/src/australasia
+++ b/elsie.nci.nih.gov/src/australasia
@@ -352,16 +352,25 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# today confirmed that Fiji will start daylight savings at 2 am on Sunday 21st
# October 2012 and end at 3 am on Sunday 20th January 2013.
# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
+
+# From the Fijian Government Media Center (2013-08-30) via David Wheeler:
+# Fiji will start daylight savings on Sunday 27th October, 2013 and end at 3am
+# on Sunday 19th January, 2014.... move clocks forward by one hour from 2am
+# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
#
-# From Paul Eggert (2012-08-31):
-# For now, guess a pattern of the penultimate Sundays in October and January.
+# From Paul Eggert (2013-09-09):
+# For now, guess that Fiji springs forward the Sunday before the fourth
+# Monday in October. This matches both recent practice and
+# timeanddate.com's current spring-forward prediction.
+# For the January 2014 transition we guessed right while timeanddate.com
+# guessed wrong, so leave the fall-back prediction alone.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
Rule Fiji 1999 2000 - Feb lastSun 3:00 0 -
Rule Fiji 2009 only - Nov 29 2:00 1:00 S
Rule Fiji 2010 only - Mar lastSun 3:00 0 -
-Rule Fiji 2010 max - Oct Sun>=18 2:00 1:00 S
+Rule Fiji 2010 max - Oct Sun>=21 2:00 1:00 S
Rule Fiji 2011 only - Mar Sun>=1 3:00 0 -
Rule Fiji 2012 max - Jan Sun>=18 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -487,6 +496,7 @@ Zone Pacific/Auckland 11:39:04 - LMT 1868 Nov 2
Zone Pacific/Chatham 12:13:48 - LMT 1957 Jan 1
12:45 Chatham CHA%sT
+Link Pacific/Auckland Antarctica/McMurdo
# Auckland Is
# uninhabited; Maori and Moriori, colonial settlers, pastoralists, sealers,
@@ -736,7 +746,7 @@ Zone Pacific/Funafuti 11:56:52 - LMT 1901
# 1886-1891; Baker was similar but exact dates are not known.
# Inhabited by civilians 1935-1942; U.S. military bases 1943-1944;
# uninhabited thereafter.
-# Howland observed Hawaii Standard Time (UTC-10:30) in 1937;
+# Howland observed Hawaii Standard Time (UT-10:30) in 1937;
# see page 206 of Elgen M. Long and Marie K. Long,
# Amelia Earhart: the Mystery Solved, Simon & Schuster (2000).
# So most likely Howland and Baker observed Hawaii Time from 1935
@@ -749,8 +759,17 @@ Zone Pacific/Funafuti 11:56:52 - LMT 1901
# no information; was probably like Pacific/Kiritimati
# Johnston
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Pacific/Johnston -10:00 - HST
+#
+# From Paul Eggert (2013-09-03):
+# In his memoirs of June 6th to October 4, 1945
+# <http://www.315bw.org/Herb_Bach.htm> (2005), Herbert C. Bach writes,
+# "We started our letdown to Kwajalein Atoll and landed there at 5:00 AM
+# Johnston time, 1:30 AM Kwajalein time." This was in June 1945, and
+# confirms that Johnston kept the same time as Honolulu in summer 1945.
+# We have no better information, so for now, assume this has been true
+# indefinitely into the past.
+#
+# See 'northamerica' for Pacific/Johnston.
# Kingman
# uninhabited
diff --git a/elsie.nci.nih.gov/src/backward b/elsie.nci.nih.gov/src/backward
index dc7769f..06fb192 100644
--- a/elsie.nci.nih.gov/src/backward
+++ b/elsie.nci.nih.gov/src/backward
@@ -22,15 +22,17 @@ Link America/Kentucky/Louisville America/Louisville
Link America/Argentina/Mendoza America/Mendoza
Link America/Rio_Branco America/Porto_Acre
Link America/Argentina/Cordoba America/Rosario
-Link America/St_Thomas America/Virgin
+Link America/Denver America/Shiprock
+Link America/Port_of_Spain America/Virgin
+Link Pacific/Auckland Antarctica/South_Pole
Link Asia/Ashgabat Asia/Ashkhabad
+Link Asia/Kolkata Asia/Calcutta
Link Asia/Chongqing Asia/Chungking
Link Asia/Dhaka Asia/Dacca
Link Asia/Kathmandu Asia/Katmandu
-Link Asia/Kolkata Asia/Calcutta
Link Asia/Macau Asia/Macao
-Link Asia/Jerusalem Asia/Tel_Aviv
Link Asia/Ho_Chi_Minh Asia/Saigon
+Link Asia/Jerusalem Asia/Tel_Aviv
Link Asia/Thimphu Asia/Thimbu
Link Asia/Makassar Asia/Ujung_Pandang
Link Asia/Ulaanbaatar Asia/Ulan_Bator
@@ -88,10 +90,10 @@ Link Pacific/Auckland NZ
Link Pacific/Chatham NZ-CHAT
Link America/Denver Navajo
Link Asia/Shanghai PRC
+Link Pacific/Pohnpei Pacific/Ponape
Link Pacific/Pago_Pago Pacific/Samoa
-Link Pacific/Chuuk Pacific/Yap
Link Pacific/Chuuk Pacific/Truk
-Link Pacific/Pohnpei Pacific/Ponape
+Link Pacific/Chuuk Pacific/Yap
Link Europe/Warsaw Poland
Link Europe/Lisbon Portugal
Link Asia/Taipei ROC
diff --git a/elsie.nci.nih.gov/src/checktab.awk b/elsie.nci.nih.gov/src/checktab.awk
index c88b12f..fec4f62 100644
--- a/elsie.nci.nih.gov/src/checktab.awk
+++ b/elsie.nci.nih.gov/src/checktab.awk
@@ -9,6 +9,9 @@ BEGIN {
if (!zone_table) zone_table = "zone.tab"
if (!want_warnings) want_warnings = -1
+ # A special (and we hope temporary) case.
+ tztab["America/Montreal"] = 1
+
while (getline <iso_table) {
iso_NR++
if ($0 ~ /^#/) continue
@@ -69,13 +72,10 @@ BEGIN {
status = 1
}
cc0 = cc
- if (tz2cc[tz]) {
- printf "%s:%d: %s: duplicate TZ column\n", \
- zone_table, zone_NR, tz >>"/dev/stderr"
- status = 1
- }
- tz2cc[tz] = cc
- tz2comments[tz] = comments
+ cctz = cc tz
+ cctztab[cctz] = 1
+ tztab[tz] = 1
+ tz2comments[cctz] = comments
tz2NR[tz] = zone_NR
if (cc2name[cc]) {
cc_used[cc]++
@@ -92,16 +92,19 @@ BEGIN {
}
}
- for (tz in tz2cc) {
- if (cc_used[tz2cc[tz]] == 1) {
- if (tz2comments[tz]) {
+ for (cctz in cctztab) {
+ cc = substr (cctz, 1, 2)
+ tz = substr (cctz, 3)
+ if (cc_used[cc] == 1) {
+ if (tz2comments[cctz]) {
printf "%s:%d: unnecessary comment `%s'\n", \
- zone_table, tz2NR[tz], tz2comments[tz] \
+ zone_table, tz2NR[tz], \
+ tz2comments[cctz] \
>>"/dev/stderr"
status = 1
}
} else {
- if (!tz2comments[tz]) {
+ if (!tz2comments[cctz]) {
printf "%s:%d: missing comment\n", \
zone_table, tz2NR[tz] >>"/dev/stderr"
status = 1
@@ -125,7 +128,7 @@ BEGIN {
if (src != dst) tz = $3
}
if (tz && tz ~ /\//) {
- if (!tz2cc[tz]) {
+ if (!tztab[tz]) {
printf "%s: no data for `%s'\n", zone_table, tz \
>>"/dev/stderr"
status = 1
diff --git a/elsie.nci.nih.gov/src/date.1 b/elsie.nci.nih.gov/src/date.1
index 408525c..72c44d0 100644
--- a/elsie.nci.nih.gov/src/date.1
+++ b/elsie.nci.nih.gov/src/date.1
@@ -10,6 +10,9 @@ date \- show and set date and time
] [
.B \-c
] [
+.B \-r
+seconds
+] [
.B \-n
] [
.B \-d
@@ -131,7 +134,15 @@ the seconds part of the new time; if no seconds are given, zero is assumed.
These options are available:
.TP
.BR \-u " or " \-c
-Use UTC when setting and showing the date and time.
+Use Universal Time when setting and showing the date and time.
+.TP
+.BI "\-r " seconds
+Output the date that corresponds to
+.I seconds
+past the epoch of 1970-01-01 00:00:00 UTC, where
+.I seconds
+should be an integer, either decimal, octal (leading 0), or
+hexadecimal (leading 0x), preceded by an optional sign.
.TP
.B \-n
Do not notify other networked systems of the time change.
diff --git a/elsie.nci.nih.gov/src/date.1.txt b/elsie.nci.nih.gov/src/date.1.txt
index 0b4d4b0..80de8e4 100644
--- a/elsie.nci.nih.gov/src/date.1.txt
+++ b/elsie.nci.nih.gov/src/date.1.txt
@@ -4,8 +4,8 @@ NAME
date - show and set date and time
SYNOPSIS
- date [ -u ] [ -c ] [ -n ] [ -d dsttype ] [ -t minutes-west ] [ -a
- [+|-]sss.fff ] [ +format ] [ [yyyy]mmddhhmm[yy][.ss] ]
+ date [ -u ] [ -c ] [ -r seconds ] [ -n ] [ -d dsttype ] [ -t minutes-
+ west ] [ -a [+|-]sss.fff ] [ +format ] [ [yyyy]mmddhhmm[yy][.ss] ]
DESCRIPTION
Date without arguments writes the date and time to the standard output
@@ -85,7 +85,13 @@ DESCRIPTION
These options are available:
-u or -c
- Use UTC when setting and showing the date and time.
+ Use Universal Time when setting and showing the date and time.
+
+ -r seconds
+ Output the date that corresponds to seconds past the epoch of
+ 1970-01-01 00:00:00 UTC, where seconds should be an integer,
+ either decimal, octal (leading 0), or hexadecimal (leading 0x),
+ preceded by an optional sign.
-n Do not notify other networked systems of the time change.
diff --git a/elsie.nci.nih.gov/src/date.c b/elsie.nci.nih.gov/src/date.c
index 047969f..fe1311a 100644
--- a/elsie.nci.nih.gov/src/date.c
+++ b/elsie.nci.nih.gov/src/date.c
@@ -54,21 +54,16 @@ static char sccsid[] = "@(#)date.c 4.23 (Berkeley) 9/20/88";
#define SECSPERMIN 60
#endif /* !defined SECSPERMIN */
-extern double atof();
extern char ** environ;
-extern char * getlogin();
-extern time_t mktime();
extern char * optarg;
extern int optind;
-extern char * strchr();
-extern time_t time();
extern char * tzname[2];
static int retval = EXIT_SUCCESS;
static void checkfinal(const char *, int, time_t, time_t);
static time_t convert(const char *, int, time_t);
-static void display(const char *);
+static void display(const char *, time_t);
static void dogmt(void);
static void errensure(void);
static void iffy(time_t, time_t, const char *, const char *);
@@ -94,11 +89,14 @@ main(const int argc, char *argv[])
register int dflag = 0;
register int nflag = 0;
register int tflag = 0;
+ register int rflag = 0;
register int minuteswest;
register int dsttime;
register double adjust;
time_t now;
time_t t;
+ intmax_t secs;
+ char * endarg;
INITIALIZE(dousg);
INITIALIZE(minuteswest);
@@ -114,16 +112,36 @@ main(const int argc, char *argv[])
#endif /* defined(TEXTDOMAINDIR) */
(void) textdomain(TZ_DOMAIN);
#endif /* HAVE_GETTEXT */
- (void) time(&now);
+ t = now = time(NULL);
format = value = NULL;
- while ((ch = getopt(argc, argv, "ucnd:t:a:")) != EOF && ch != -1) {
+ while ((ch = getopt(argc, argv, "ucr:nd:t:a:")) != EOF && ch != -1) {
switch (ch) {
default:
usage();
- case 'u': /* do it in UTC */
+ case 'u': /* do it in UT */
case 'c':
dogmt();
break;
+ case 'r': /* seconds since 1970 */
+ if (rflag) {
+ (void) fprintf(stderr,
+ _("date: error: multiple -r's used"));
+ usage();
+ }
+ rflag = 1;
+ errno = 0;
+ secs = strtoimax (optarg, &endarg, 0);
+ if (*endarg || optarg == endarg)
+ errno = EINVAL;
+ else if (! (time_t_min <= secs && secs <= time_t_max))
+ errno = ERANGE;
+ if (errno) {
+ perror(optarg);
+ errensure();
+ exit(retval);
+ }
+ t = secs;
+ break;
case 'n': /* don't set network */
nflag = 1;
break;
@@ -188,7 +206,7 @@ main(const int argc, char *argv[])
_("date: error: multiple formats in command line\n"));
usage();
}
- else if (value == NULL)
+ else if (value == NULL && !rflag)
value = cp;
else {
(void) fprintf(stderr,
@@ -270,33 +288,21 @@ _("date: error: multiple values in command line\n"));
oops("settimeofday");
#endif /* HAVE_SETTIMEOFDAY == 2 */
#if HAVE_SETTIMEOFDAY != 2
+ (void) dsttime;
+ (void) minuteswest;
(void) fprintf(stderr,
_("date: warning: kernel doesn't keep -d/-t information, option ignored\n"));
#endif /* HAVE_SETTIMEOFDAY != 2 */
}
- if (value == NULL)
- display(format);
-
- reset(t, nflag);
-
- checkfinal(value, dousg, t, now);
-
-#ifdef EBUG
- {
- struct tm tm;
-
- tm = *localtime(&t);
- timeout(stdout, "%c\n", &tm);
- exit(retval);
+ if (value) {
+ reset(t, nflag);
+ checkfinal(value, dousg, t, now);
+ t = time(NULL);
}
-#endif /* defined EBUG */
-
- display(format);
- /* gcc -Wall pacifier */
- for ( ; ; )
- continue;
+ display(format, t);
+ return retval;
}
static void
@@ -452,9 +458,6 @@ reset(const time_t newt, const int nflag)
register const char * username;
static struct timeval tv; /* static so tv_usec is 0 */
-#ifdef EBUG
- return;
-#endif /* defined EBUG */
username = getlogin();
if (username == NULL || *username == '\0') /* single-user or no tty */
username = "root";
@@ -494,7 +497,7 @@ errensure(void)
retval = EXIT_FAILURE;
}
-static const char *
+static const char * ATTRIBUTE_PURE
nondigit(register const char *cp)
{
while (is_digit(*cp))
@@ -505,8 +508,10 @@ nondigit(register const char *cp)
static void
usage(void)
{
- (void) fprintf(stderr, _("date: usage is date [-u] [-c] [-n] [-d dst] \
-[-t min-west] [-a sss.fff] [[yyyy]mmddhhmm[yyyy][.ss]] [+format]\n"));
+ (void) fprintf(stderr,
+ _("date: usage: date [-u] [-c] [-r seconds] [-n]"
+ " [-d dst] [-t min-west] [-a sss.fff]"
+ " [[yyyy]mmddhhmm[yyyy][.ss]] [+format]\n"));
errensure();
exit(retval);
}
@@ -520,18 +525,23 @@ oops(const char *const string)
errno = e;
(void) perror(string);
errensure();
- display(NULL);
+ display(NULL, time(NULL));
+ exit(retval);
}
static void
-display(const char *const format)
+display(const char *const format, time_t const now)
{
- struct tm tm;
- time_t now;
+ struct tm *tmp;
- (void) time(&now);
- tm = *localtime(&now);
- timeout(stdout, format ? format : "%+", &tm);
+ tmp = localtime(&now);
+ if (!tmp) {
+ (void) fprintf(stderr,
+ _("date: error: time out of range\n"));
+ errensure();
+ return;
+ }
+ timeout(stdout, format ? format : "%+", tmp);
(void) putchar('\n');
(void) fflush(stdout);
(void) fflush(stderr);
@@ -540,22 +550,27 @@ display(const char *const format)
_("date: error: couldn't write results\n"));
errensure();
}
- exit(retval);
}
-extern size_t strftime();
-
#define INCR 1024
static void
-timeout(FILE *const fp, const char *const format, const struct tm *const tmp)
+timeout(FILE *const fp, const char *const format, const struct tm *tmp)
{
char * cp;
size_t result;
size_t size;
+ struct tm tm;
if (*format == '\0')
return;
+ if (!tmp) {
+ (void) fprintf(stderr, _("date: error: time out of range\n"));
+ errensure();
+ return;
+ }
+ tm = *tmp;
+ tmp = &tm;
size = INCR;
cp = malloc(size);
for ( ; ; ) {
@@ -601,10 +616,13 @@ convert(register const char * const value, const int dousg, const time_t t)
register const char * cp;
register const char * dotp;
register int cent, year_in_cent, month, hour, day, mins, secs;
- struct tm tm, outtm;
+ struct tm tm, outtm, *tmp;
time_t outt;
- tm = *localtime(&t);
+ tmp = localtime(&t);
+ if (!tmp)
+ return -1;
+ tm = *tmp;
#define DIVISOR 100
year_in_cent = tm.tm_year % DIVISOR + TM_YEAR_BASE % DIVISOR;
cent = tm.tm_year / DIVISOR + TM_YEAR_BASE / DIVISOR +
@@ -706,7 +724,7 @@ checkfinal(const char * const value,
const time_t oldnow)
{
time_t othert;
- struct tm tm;
+ struct tm tm, *tmp;
struct tm othertm;
register int pass, offset;
@@ -719,8 +737,10 @@ checkfinal(const char * const value,
/*
** See if there's both a DST and a STD version.
*/
- tm = *localtime(&t);
- othertm = tm;
+ tmp = localtime(&t);
+ if (!tmp)
+ iffy(t, othert, value, _("time out of range"));
+ othertm = tm = *tmp;
othertm.tm_isdst = !tm.tm_isdst;
othert = mktime(&othertm);
if (othert != -1 && othertm.tm_isdst != tm.tm_isdst &&
@@ -753,7 +773,11 @@ checkfinal(const char * const value,
else if (pass == 3)
othert = t + 60 * offset;
else othert = t - 60 * offset;
- othertm = *localtime(&othert);
+ tmp = localtime(&othert);
+ if (!tmp)
+ iffy(t, othert, value,
+ _("time out of range"));
+ othertm = *tmp;
if (sametm(&tm, &othertm))
iffy(t, othert, value,
_("multiple matching times exist"));
@@ -764,29 +788,32 @@ static void
iffy(const time_t thist, const time_t thatt,
const char * const value, const char * const reason)
{
- struct tm tm;
+ struct tm *tmp;
+ int dst;
(void) fprintf(stderr, _("date: warning: ambiguous time \"%s\", %s.\n"),
value, reason);
- tm = *gmtime(&thist);
+ tmp = gmtime(&thist);
/*
** Avoid running afoul of SCCS!
*/
timeout(stderr, _("Time was set as if you used\n\tdate -u %m%d%H\
%M\
-%Y.%S\n"), &tm);
- tm = *localtime(&thist);
- timeout(stderr, _("to get %c"), &tm);
+%Y.%S\n"), tmp);
+ tmp = localtime(&thist);
+ dst = tmp ? tmp->tm_isdst : 0;
+ timeout(stderr, _("to get %c"), tmp);
(void) fprintf(stderr, _(" (%s). Use\n"),
- tm.tm_isdst ? _("summer time") : _("standard time"));
- tm = *gmtime(&thatt);
+ dst ? _("summer time") : _("standard time"));
+ tmp = gmtime(&thatt);
timeout(stderr, _("\tdate -u %m%d%H\
%M\
-%Y.%S\n"), &tm);
- tm = *localtime(&thatt);
- timeout(stderr, _("to get %c"), &tm);
+%Y.%S\n"), tmp);
+ tmp = localtime(&thatt);
+ dst = tmp ? tmp->tm_isdst : 0;
+ timeout(stderr, _("to get %c"), tmp);
(void) fprintf(stderr, _(" (%s).\n"),
- tm.tm_isdst ? _("summer time") : _("standard time"));
+ dst ? _("summer time") : _("standard time"));
errensure();
exit(retval);
}
diff --git a/elsie.nci.nih.gov/src/difftime.c b/elsie.nci.nih.gov/src/difftime.c
index fcd18ce..449cdf0 100644
--- a/elsie.nci.nih.gov/src/difftime.c
+++ b/elsie.nci.nih.gov/src/difftime.c
@@ -5,7 +5,7 @@
/*LINTLIBRARY*/
-#include "private.h" /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */
+#include "private.h" /* for time_t and TYPE_SIGNED */
double ATTRIBUTE_CONST
difftime(const time_t time1, const time_t time0)
@@ -16,15 +16,8 @@ difftime(const time_t time1, const time_t time0)
*/
if (sizeof (double) > sizeof (time_t))
return (double) time1 - (double) time0;
- if (!TYPE_INTEGRAL(time_t)) {
- /*
- ** time_t is floating.
- */
- return time1 - time0;
- }
if (!TYPE_SIGNED(time_t)) {
/*
- ** time_t is integral and unsigned.
** The difference of two unsigned values can't overflow
** if the minuend is greater than or equal to the subtrahend.
*/
@@ -33,7 +26,6 @@ difftime(const time_t time1, const time_t time0)
else return -(double) (time0 - time1);
}
/*
- ** time_t is integral and signed.
** Handle cases where both time1 and time0 have the same sign
** (meaning that their difference cannot overflow).
*/
diff --git a/elsie.nci.nih.gov/src/etcetera b/elsie.nci.nih.gov/src/etcetera
index a9ff729..9ba7f7b 100644
--- a/elsie.nci.nih.gov/src/etcetera
+++ b/elsie.nci.nih.gov/src/etcetera
@@ -31,9 +31,9 @@ Link Etc/GMT Etc/GMT0
# even though this is the opposite of what many people expect.
# POSIX has positive signs west of Greenwich, but many people expect
# positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses
-# the abbreviation "GMT+4" and corresponds to 4 hours behind UTC
+# the abbreviation "GMT+4" and corresponds to 4 hours behind UT
# (i.e. west of Greenwich) even though many people would expect it to
-# mean 4 hours ahead of UTC (i.e. east of Greenwich).
+# mean 4 hours ahead of UT (i.e. east of Greenwich).
#
# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation allows for
# TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to
diff --git a/elsie.nci.nih.gov/src/europe b/elsie.nci.nih.gov/src/europe
index 0f429da..a7b1676 100644
--- a/elsie.nci.nih.gov/src/europe
+++ b/elsie.nci.nih.gov/src/europe
@@ -42,7 +42,7 @@
# </a> (1998-09-21, in Portuguese)
#
-# I invented the abbreviations marked `*' in the following table;
+# I invented the abbreviations marked '*' in the following table;
# the rest are from earlier versions of this file, or from other sources.
# Corrections are welcome!
# std dst 2dst
@@ -96,7 +96,7 @@
# and a sketch map showing some of the sightlines involved. One paragraph
# of the text said:
#
-# `An old stone obelisk marking a forgotten terrestrial meridian stands
+# 'An old stone obelisk marking a forgotten terrestrial meridian stands
# beside the river at Kew. In the 18th century, before time and longitude
# was standardised by the Royal Observatory in Greenwich, scholars observed
# this stone and the movement of stars from Kew Observatory nearby. They
@@ -140,7 +140,7 @@
# From Paul Eggert (2003-09-27):
# Summer Time was first seriously proposed by William Willett (1857-1915),
# a London builder and member of the Royal Astronomical Society
-# who circulated a pamphlet ``The Waste of Daylight'' (1907)
+# who circulated a pamphlet "The Waste of Daylight" (1907)
# that proposed advancing clocks 20 minutes on each of four Sundays in April,
# and retarding them by the same amount on four Sundays in September.
# A bill was drafted in 1909 and introduced in Parliament several times,
@@ -165,10 +165,10 @@
# </a>
# From Paul Eggert (1996-09-03):
-# The OED Supplement says that the English originally said ``Daylight Saving''
+# The OED Supplement says that the English originally said "Daylight Saving"
# when they were debating the adoption of DST in 1908; but by 1916 this
# term appears only in quotes taken from DST's opponents, whereas the
-# proponents (who eventually won the argument) are quoted as using ``Summer''.
+# proponents (who eventually won the argument) are quoted as using "Summer".
# From Arthur David Olson (1989-01-19):
#
@@ -208,9 +208,9 @@
# which could not be said to run counter to any official description.
# From Paul Eggert (2000-10-02):
-# Howse writes (p 157) `DBST' too, but `BDST' seems to have been common
+# Howse writes (p 157) 'DBST' too, but 'BDST' seems to have been common
# and follows the more usual convention of putting the location name first,
-# so we use `BDST'.
+# so we use 'BDST'.
# Peter Ilieve (1998-04-19) described at length
# the history of summer time legislation in the United Kingdom.
@@ -431,6 +431,8 @@ Rule GB-Eire 1981 1989 - Oct Sun>=23 1:00u 0 GMT
Rule GB-Eire 1990 1995 - Oct Sun>=22 1:00u 0 GMT
# Summer Time Order 1997 (S.I. 1997/2982)
# See EU for rules starting in 1996.
+#
+# Use Europe/London for Jersey, Guernsey, and the Isle of Man.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/London -0:01:15 - LMT 1847 Dec 1 0:00s
@@ -797,7 +799,7 @@ Zone Europe/Brussels 0:17:30 - LMT 1880
1:00 EU CE%sT
# Bosnia and Herzegovina
-# see Serbia
+# See Europe/Belgrade.
# Bulgaria
#
@@ -825,10 +827,10 @@ Zone Europe/Sofia 1:33:16 - LMT 1880
2:00 EU EE%sT
# Croatia
-# see Serbia
+# See Europe/Belgrade.
# Cyprus
-# Please see the `asia' file for Asia/Nicosia.
+# Please see the 'asia' file for Asia/Nicosia.
# Czech Republic
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@@ -845,6 +847,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850
1:00 C-Eur CE%sT 1944 Sep 17 2:00s
1:00 Czech CE%sT 1979
1:00 EU CE%sT
+# Use Europe/Prague also for Slovakia.
# Denmark, Faroe Islands, and Greenland
@@ -1008,12 +1011,12 @@ Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik air base
# From Peter Ilieve (1996-10-28):
# [IATA SSIM (1992/1996) claims that the Baltic republics switch at 01:00s,
# but a relative confirms that Estonia still switches at 02:00s, writing:]
-# ``I do not [know] exactly but there are some little different
+# "I do not [know] exactly but there are some little different
# (confusing) rules for International Air and Railway Transport Schedules
# conversion in Sunday connected with end of summer time in Estonia....
# A discussion is running about the summer time efficiency and effect on
# human physiology. It seems that Estonia maybe will not change to
-# summer time next spring.''
+# summer time next spring."
# From Peter Ilieve (1998-11-04), heavily edited:
# <a href="http://trip.rk.ee/cgi-bin/thw?${BASE}=akt&${OOHTML}=rtd&TA=1998&TO=1&AN=1390">
@@ -1068,7 +1071,7 @@ Zone Europe/Tallinn 1:39:00 - LMT 1880
# Well, here in Helsinki we're just changing from summer time to regular one,
# and it's supposed to change at 4am...
-# From Janne Snabb (2010-0715):
+# From Janne Snabb (2010-07-15):
#
# I noticed that the Finland data is not accurate for years 1981 and 1982.
# During these two first trial years the DST adjustment was made one hour
@@ -1125,7 +1128,7 @@ Link Europe/Helsinki Europe/Mariehamn
#
-# Shank & Pottenger seem to use `24:00' ambiguously; resolve it with Whitman.
+# Shank & Pottenger seem to use '24:00' ambiguously; resolve it with Whitman.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule France 1916 only - Jun 14 23:00s 1:00 S
Rule France 1916 1919 - Oct Sun>=1 23:00s 0 -
@@ -1415,7 +1418,7 @@ Zone Atlantic/Reykjavik -1:27:24 - LMT 1837
# <a href="http://toi.iriti.cnr.it/uk/ienitlt.html">
# Day-light Saving Time in Italy (2006-02-03)
# </a>
-# (`FP' below), taken from an Italian National Electrotechnical Institute
+# ('FP' below), taken from an Italian National Electrotechnical Institute
# publication. When the three sources disagree, guess who's right, as follows:
#
# year FP Shanks&P. (S) Whitman (W) Go with:
@@ -1561,10 +1564,22 @@ Zone Europe/Riga 1:36:24 - LMT 1880
2:00 EU EE%sT
# Liechtenstein
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Europe/Vaduz 0:38:04 - LMT 1894 Jun
- 1:00 - CET 1981
- 1:00 EU CE%sT
+
+# From Paul Eggert (2013-09-09):
+# Shanks & Pottenger say Vaduz is like Zurich.
+
+# From Alois Treindl (2013-09-18):
+# http://www.eliechtensteinensia.li/LIJ/1978/1938-1978/1941.pdf
+# ... confirms on p. 6 that Liechtenstein followed Switzerland in 1941 and 1942.
+# I ... translate only the last two paragraphs:
+# ... during second world war, in the years 1941 and 1942, Liechtenstein
+# introduced daylight saving time, adapting to Switzerland. From 1943 on
+# central European time was in force throughout the year.
+# From a report of the duke's government to the high council,
+# regarding the introduction of a time law, of 31 May 1977.
+
+Link Europe/Zurich Europe/Vaduz
+
# Lithuania
@@ -1652,7 +1667,7 @@ Zone Europe/Luxembourg 0:24:36 - LMT 1904 Jun
1:00 EU CE%sT
# Macedonia
-# see Serbia
+# See Europe/Belgrade.
# Malta
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@@ -1745,7 +1760,7 @@ Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15
1:00 EU CE%sT
# Montenegro
-# see Serbia
+# See Europe/Belgrade.
# Netherlands
@@ -1860,7 +1875,7 @@ Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1
# before 1895, and therefore probably changed the local time somewhere
# between 1895 and 1925 (inclusive).
-# From Paul Eggert (2001-05-01):
+# From Paul Eggert (2013-09-04):
#
# Actually, Jan Mayen was never occupied by Germany during World War II,
# so it must have diverged from Oslo time during the war, as Oslo was
@@ -1871,7 +1886,7 @@ Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1
# 1941 with a small Norwegian garrison and continued operations despite
# frequent air ttacks from Germans. In 1943 the Americans established a
# radiolocating station on the island, called "Atlantic City". Possibly
-# the UTC offset changed during the war, but I think it unlikely that
+# the UT offset changed during the war, but I think it unlikely that
# Jan Mayen used German daylight-saving rules.
#
# Svalbard is more complicated, as it was raided in August 1941 by an
@@ -1884,9 +1899,8 @@ Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1
# the German armed forces at the Svalbard weather station code-named
# Haudegen did not surrender to the Allies until September 1945.
#
-# All these events predate our cutoff date of 1970. Unless we can
-# come up with more definitive info about the timekeeping during the
-# war years it's probably best just do...the following for now:
+# All these events predate our cutoff date of 1970, so use Europe/Oslo
+# for these regions.
Link Europe/Oslo Arctic/Longyearbyen
# Poland
@@ -2144,7 +2158,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct
# so we (Novosibirsk) simply did not switch.
#
# From Andrey A. Chernov (1996-10-04):
-# `MSK' and `MSD' were born and used initially on Moscow computers with
+# 'MSK' and 'MSD' were born and used initially on Moscow computers with
# UNIX-like OSes by several developer groups (e.g. Demos group, Kiae group)....
# The next step was the UUCP network, the Relcom predecessor
# (used mainly for mail), and MSK/MSD was actively used there.
@@ -2443,6 +2457,9 @@ Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2
11:00 Russia ANA%sT 2011 Mar 27 2:00s
12:00 - ANAT
+# San Marino
+# See Europe/Rome.
+
# Serbia
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Belgrade 1:22:00 - LMT 1884
@@ -2465,7 +2482,7 @@ Link Europe/Belgrade Europe/Zagreb # Croatia
Link Europe/Prague Europe/Bratislava
# Slovenia
-# see Serbia
+# See Europe/Belgrade.
# Spain
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@@ -2599,7 +2616,7 @@ Zone Europe/Stockholm 1:12:12 - LMT 1879 Jan 1
# and their performance improved enormously. Communities began to keep
# mean time in preference to apparent time -- Geneva from 1780 ....
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-# From Whitman (who writes ``Midnight?''):
+# From Whitman (who writes "Midnight?"):
# Rule Swiss 1940 only - Nov 2 0:00 1:00 S
# Rule Swiss 1940 only - Dec 31 0:00 0 -
# From Shanks & Pottenger:
@@ -2644,23 +2661,53 @@ Zone Europe/Stockholm 1:12:12 - LMT 1879 Jan 1
# The 1940 rules must be deleted.
#
# One further detail for Switzerland, which is probably out of scope for
-# most users of tzdata:
-# The zone file
-# Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12
-# 0:29:44 - BMT 1894 Jun #Bern Mean Time
-# 1:00 Swiss CE%sT 1981
-# 1:00 EU CE%sT
+# most users of tzdata: The [Europe/Zurich zone] ...
# describes all of Switzerland correctly, with the exception of
# the Cantone Geneve (Geneva, Genf). Between 1848 and 1894 Geneve did not
# follow Bern Mean Time but kept its own local mean time.
# To represent this, an extra zone would be needed.
+#
+# From Alois Treindl (2013-09-11):
+# The Federal regulations say
+# http://www.admin.ch/opc/de/classified-compilation/20071096/index.html
+# ... the meridian for Bern mean time ... is 7 degrees 26'22.50".
+# Expressed in time, it is 0h29m45.5s.
+
+# From Pierre-Yves Berger (2013-09-11):
+# the "Circulaire du conseil federal" (December 11 1893)
+# <http://www.amtsdruckschriften.bar.admin.ch/viewOrigDoc.do?id=10071353> ...
+# clearly states that the [1894-06-01] change should be done at midnight
+# but if no one is present after 11 at night, could be postponed until one
+# hour before the beginning of service.
+
+# From Paul Eggert (2013-09-11):
+# Round BMT to the nearest even second, 0:29:46.
+#
+# We can find no reliable source for Shanks's assertion that all of Switzerland
+# except Geneva switched to Bern Mean Time at 00:00 on 1848-09-12. This book:
+#
+# Jakob Messerli. Gleichmassig, punktlich, schnell: Zeiteinteilung und
+# Zeitgebrauch in der Schweiz im 19. Jahrhundert. Chronos, Zurich 1995,
+# ISBN 3-905311-68-2, OCLC 717570797.
+#
+# suggests that the transition was more gradual, and that the Swiss did not
+# agree about civil time during the transition. The timekeeping it gives the
+# most detail for is postal and telegraph time: here, federal legislation (the
+# "Bundesgesetz uber die Erstellung von elektrischen Telegraphen") passed on
+# 1851-11-23, and an official implementation notice was published 1853-07-16
+# (Bundesblatt 1853, Bd. II, S. 859). On p 72 Messerli writes that in
+# practice since July 1853 Bernese time was used in "all postal and telegraph
+# offices in Switzerland from Geneva to St. Gallen and Basel to Chiasso"
+# (Google translation). For now, model this transition as occurring on
+# 1853-07-16, though it probably occurred at some other date in Zurich, and
+# legal civil time probably changed at still some other transition date.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S
Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12
- 0:29:44 - BMT 1894 Jun # Bern Mean Time
+Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment.
+ 0:29:46 - BMT 1894 Jun # Bern Mean Time
1:00 Swiss CE%sT 1981
1:00 EU CE%sT
@@ -2884,7 +2931,7 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880
# From Paul Eggert (2006-03-22):
# The _Economist_ (1994-05-28, p 45) reports that central Crimea switched
# from Kiev to Moscow time sometime after the January 1994 elections.
-# Shanks (1999) says ``date of change uncertain'', but implies that it happened
+# Shanks (1999) says "date of change uncertain", but implies that it happened
# sometime between the 1994 DST switches. Shanks & Pottenger simply say
# 1994-09-25 03:00, but that can't be right. For now, guess it
# changed in May.
@@ -2898,6 +2945,9 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880
3:00 - MSK 1997 Mar lastSun 1:00u
2:00 EU EE%sT
+# Vatican City
+# See Europe/Rome.
+
###############################################################################
# One source shows that Bulgaria, Cyprus, Finland, and Greece observe DST from
diff --git a/elsie.nci.nih.gov/src/iso3166.tab b/elsie.nci.nih.gov/src/iso3166.tab
index c184a81..a1e4b42 100644
--- a/elsie.nci.nih.gov/src/iso3166.tab
+++ b/elsie.nci.nih.gov/src/iso3166.tab
@@ -9,7 +9,7 @@
# 1. ISO 3166-1 alpha-2 country code, current as of
# ISO 3166-1 Newsletter VI-15 (2013-05-10). See: Updates on ISO 3166
# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
-# 2. The usual English name for the country,
+# 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables.
#
@@ -23,7 +23,7 @@
# to take or endorse any position on legal or territorial claims.
#
#country-
-#code country name
+#code name of country, territory, area, or subdivision
AD Andorra
AE United Arab Emirates
AF Afghanistan
@@ -53,7 +53,7 @@ BL St Barthelemy
BM Bermuda
BN Brunei
BO Bolivia
-BQ Bonaire, St Eustatius & Saba
+BQ Caribbean Netherlands
BR Brazil
BS Bahamas
BT Bhutan
diff --git a/elsie.nci.nih.gov/src/leap-seconds.list b/elsie.nci.nih.gov/src/leap-seconds.list
new file mode 100644
index 0000000..7df3de6
--- /dev/null
+++ b/elsie.nci.nih.gov/src/leap-seconds.list
@@ -0,0 +1,231 @@
+#
+# In the following text, the symbol '#' introduces
+# a comment, which continues from that symbol until
+# the end of the line. A plain comment line has a
+# whitespace character following the comment indicator.
+# There are also special comment lines defined below.
+# A special comment will always have a non-whitespace
+# character in column 2.
+#
+# A blank line should be ignored.
+#
+# The following table shows the corrections that must
+# be applied to compute International Atomic Time (TAI)
+# from the Coordinated Universal Time (UTC) values that
+# are transmitted by almost all time services.
+#
+# The first column shows an epoch as a number of seconds
+# since 1900.0 and the second column shows the number of
+# seconds that must be added to UTC to compute TAI for
+# any timestamp at or after that epoch. The value on
+# each line is valid from the indicated initial instant
+# until the epoch given on the next one or indefinitely
+# into the future if there is no next line.
+# (The comment on each line shows the representation of
+# the corresponding initial epoch in the usual
+# day-month-year format. The epoch always begins at
+# 00:00:00 UTC on the indicated day. See Note 5 below.)
+#
+# Important notes:
+#
+# 1. Coordinated Universal Time (UTC) is often referred to
+# as Greenwich Mean Time (GMT). The GMT time scale is no
+# longer used, and the use of GMT to designate UTC is
+# discouraged.
+#
+# 2. The UTC time scale is realized by many national
+# laboratories and timing centers. Each laboratory
+# identifies its realization with its name: Thus
+# UTC(NIST), UTC(USNO), etc. The differences among
+# these different realizations are typically on the
+# order of a few nanoseconds (i.e., 0.000 000 00x s)
+# and can be ignored for many purposes. These differences
+# are tabulated in Circular T, which is published monthly
+# by the International Bureau of Weights and Measures
+# (BIPM). See www.bipm.fr for more information.
+#
+# 3. The current defintion of the relationship between UTC
+# and TAI dates from 1 January 1972. A number of different
+# time scales were in use before than epoch, and it can be
+# quite difficult to compute precise timestamps and time
+# intervals in those "prehistoric" days. For more information,
+# consult:
+#
+# The Explanatory Supplement to the Astronomical
+# Ephemeris.
+# or
+# Terry Quinn, "The BIPM and the Accurate Measurement
+# of Time," Proc. of the IEEE, Vol. 79, pp. 894-905,
+# July, 1991.
+#
+# 4. The insertion of leap seconds into UTC is currently the
+# responsibility of the International Earth Rotation Service,
+# which is located at the Paris Observatory:
+#
+# Central Bureau of IERS
+# 61, Avenue de l'Observatoire
+# 75014 Paris, France.
+#
+# Leap seconds are announced by the IERS in its Bulletin C
+#
+# See hpiers.obspm.fr or www.iers.org for more details.
+#
+# All national laboratories and timing centers use the
+# data from the BIPM and the IERS to construct their
+# local realizations of UTC.
+#
+# Although the definition also includes the possibility
+# of dropping seconds ("negative" leap seconds), this has
+# never been done and is unlikely to be necessary in the
+# foreseeable future.
+#
+# 5. If your system keeps time as the number of seconds since
+# some epoch (e.g., NTP timestamps), then the algorithm for
+# assigning a UTC time stamp to an event that happens during a positive
+# leap second is not well defined. The official name of that leap
+# second is 23:59:60, but there is no way of representing that time
+# in these systems.
+# Many systems of this type effectively stop the system clock for
+# one second during the leap second and use a time that is equivalent
+# to 23:59:59 UTC twice. For these systems, the corresponding TAI
+# timestamp would be obtained by advancing to the next entry in the
+# following table when the time equivalent to 23:59:59 UTC
+# is used for the second time. Thus the leap second which
+# occurred on 30 June 1972 at 23:59:59 UTC would have TAI
+# timestamps computed as follows:
+#
+# ...
+# 30 June 1972 23:59:59 (2287785599, first time): TAI= UTC + 10 seconds
+# 30 June 1972 23:59:60 (2287785599,second time): TAI= UTC + 11 seconds
+# 1 July 1972 00:00:00 (2287785600) TAI= UTC + 11 seconds
+# ...
+#
+# If your system realizes the leap second by repeating 00:00:00 UTC twice
+# (this is possible but not usual), then the advance to the next entry
+# in the table must occur the second time that a time equivlent to
+# 00:00:00 UTC is used. Thus, using the same example as above:
+#
+# ...
+# 30 June 1972 23:59:59 (2287785599): TAI= UTC + 10 seconds
+# 30 June 1972 23:59:60 (2287785600, first time): TAI= UTC + 10 seconds
+# 1 July 1972 00:00:00 (2287785600,second time): TAI= UTC + 11 seconds
+# ...
+#
+# in both cases the use of timestamps based on TAI produces a smooth
+# time scale with no discontinuity in the time interval.
+#
+# This complexity would not be needed for negative leap seconds (if they
+# are ever used). The UTC time would skip 23:59:59 and advance from
+# 23:59:58 to 00:00:00 in that case. The TAI offset would decrease by
+# 1 second at the same instant. This is a much easier situation to deal
+# with, since the difficulty of unambiguously representing the epoch
+# during the leap second does not arise.
+#
+# Questions or comments to:
+# Judah Levine
+# Time and Frequency Division
+# NIST
+# Boulder, Colorado
+# jlevine@boulder.nist.gov
+#
+# Last Update of leap second values: 11 January 2012
+#
+# The following line shows this last update date in NTP timestamp
+# format. This is the date on which the most recent change to
+# the leap second data was added to the file. This line can
+# be identified by the unique pair of characters in the first two
+# columns as shown below.
+#
+#$ 3535228800
+#
+# The NTP timestamps are in units of seconds since the NTP epoch,
+# which is 1900.0. The Modified Julian Day number corresponding
+# to the NTP time stamp, X, can be computed as
+#
+# X/86400 + 15020
+#
+# where the first term converts seconds to days and the second
+# term adds the MJD corresponding to 1900.0. The integer portion
+# of the result is the integer MJD for that day, and any remainder
+# is the time of day, expressed as the fraction of the day since 0
+# hours UTC. The conversion from day fraction to seconds or to
+# hours, minutes, and seconds may involve rounding or truncation,
+# depending on the method used in the computation.
+#
+# The data in this file will be updated periodically as new leap
+# seconds are announced. In addition to being entered on the line
+# above, the update time (in NTP format) will be added to the basic
+# file name leap-seconds to form the name leap-seconds.<NTP TIME>.
+# In addition, the generic name leap-seconds.list will always point to
+# the most recent version of the file.
+#
+# This update procedure will be performed only when a new leap second
+# is announced.
+#
+# The following entry specifies the expiration date of the data
+# in this file in units of seconds since 1900.0. This expiration date
+# will be changed at least twice per year whether or not a new leap
+# second is announced. These semi-annual changes will be made no
+# later than 1 June and 1 December of each year to indicate what
+# action (if any) is to be taken on 30 June and 31 December,
+# respectively. (These are the customary effective dates for new
+# leap seconds.) This expiration date will be identified by a
+# unique pair of characters in columns 1 and 2 as shown below.
+# In the unlikely event that a leap second is announced with an
+# effective date other than 30 June or 31 December, then this
+# file will be edited to include that leap second as soon as it is
+# announced or at least one month before the effective date
+# (whichever is later).
+# If an announcement by the IERS specifies that no leap second is
+# scheduled, then only the expiration date of the file will
+# be advanced to show that the information in the file is still
+# current -- the update time stamp, the data and the name of the file
+# will not change.
+#
+# Updated through IERS Bulletin C46
+# File expires on: 28 June 2014
+#
+#@ 3612902400
+#
+2272060800 10 # 1 Jan 1972
+2287785600 11 # 1 Jul 1972
+2303683200 12 # 1 Jan 1973
+2335219200 13 # 1 Jan 1974
+2366755200 14 # 1 Jan 1975
+2398291200 15 # 1 Jan 1976
+2429913600 16 # 1 Jan 1977
+2461449600 17 # 1 Jan 1978
+2492985600 18 # 1 Jan 1979
+2524521600 19 # 1 Jan 1980
+2571782400 20 # 1 Jul 1981
+2603318400 21 # 1 Jul 1982
+2634854400 22 # 1 Jul 1983
+2698012800 23 # 1 Jul 1985
+2776982400 24 # 1 Jan 1988
+2840140800 25 # 1 Jan 1990
+2871676800 26 # 1 Jan 1991
+2918937600 27 # 1 Jul 1992
+2950473600 28 # 1 Jul 1993
+2982009600 29 # 1 Jul 1994
+3029443200 30 # 1 Jan 1996
+3076704000 31 # 1 Jul 1997
+3124137600 32 # 1 Jan 1999
+3345062400 33 # 1 Jan 2006
+3439756800 34 # 1 Jan 2009
+3550089600 35 # 1 Jul 2012
+#
+# the following special comment contains the
+# hash value of the data in this file computed
+# use the secure hash algorithm as specified
+# by FIPS 180-1. See the files in ~/pub/sha for
+# the details of how this hash value is
+# computed. Note that the hash computation
+# ignores comments and whitespace characters
+# in data lines. It includes the NTP values
+# of both the last modification time and the
+# expiration time of the file, but not the
+# white space on those lines.
+# the hash line is also ignored in the
+# computation.
+#
+#h 1151a8f e85a5069 9000fcdb 3d5e5365 1d505b37
diff --git a/elsie.nci.nih.gov/src/leapseconds.awk b/elsie.nci.nih.gov/src/leapseconds.awk
new file mode 100644
index 0000000..732db99
--- /dev/null
+++ b/elsie.nci.nih.gov/src/leapseconds.awk
@@ -0,0 +1,68 @@
+# Generate the 'leapseconds' file from 'leap-seconds.list'.
+
+# This file is in the public domain.
+
+BEGIN {
+ printf "%s", "\
+# Allowance for leapseconds added to each timezone file.\n\
+\n\
+# This file is in the public domain.\n\
+\n\
+# This file is generated automatically from the data in the public-domain\n\
+# leap-seconds.list file available from most NIST time servers.\n\
+# If the URL <ftp://time.nist.gov/pub/leap-seconds.list> does not work,\n\
+# you should be able to pick up leap-seconds.list from a secondary NIST server.\n\
+# For more about leap-seconds.list, please see\n\
+# The NTP Timescale and Leap Seconds\n\
+# <http://www.eecis.udel.edu/~mills/leap.html>.\n\
+\n\
+# The International Earth Rotation Service periodically uses leap seconds\n\
+# to keep UTC to within 0.9 s of UT1\n\
+# (which measures the true angular orientation of the earth in space); see\n\
+# Terry J Quinn, The BIPM and the accurate measure of time,\n\
+# Proc IEEE 79, 7 (July 1991), 894-905 <http://dx.doi.org/10.1109/5.84965>.\n\
+# There were no leap seconds before 1972, because the official mechanism\n\
+# accounting for the discrepancy between atomic time and the earth's rotation\n\
+# did not exist until the early 1970s.\n\
+\n\
+# The correction (+ or -) is made at the given time, so lines\n\
+# will typically look like:\n\
+# Leap YEAR MON DAY 23:59:60 + R/S\n\
+# or\n\
+# Leap YEAR MON DAY 23:59:59 - R/S\n\
+\n\
+# If the leapsecond is Rolling (R) the given time is local time.\n\
+# If the leapsecond is Stationary (S) the given time is UTC.\n\
+\n\
+# Leap YEAR MONTH DAY HH:MM:SS CORR R/S\n\
+"
+}
+
+/^ *$/ { next }
+/^#/ { next }
+
+{
+ NTP_timestamp = $1
+ TAI_minus_UTC = $2
+ hash_mark = $3
+ one = $4
+ month = $5
+ year = $6
+ if (old_TAI_minus_UTC) {
+ if (old_TAI_minus_UTC < TAI_minus_UTC) {
+ sign = "23:59:60\t+"
+ } else {
+ sign = "23:59:59\t-"
+ }
+ if (month == "Jan") {
+ year--;
+ month = "Dec";
+ day = 31
+ } else if (month == "Jul") {
+ month = "Jun";
+ day = 30
+ }
+ printf "Leap\t%s\t%s\t%s\t%s\tS\n", year, month, day, sign
+ }
+ old_TAI_minus_UTC = TAI_minus_UTC
+}
diff --git a/elsie.nci.nih.gov/src/localtime.c b/elsie.nci.nih.gov/src/localtime.c
index 7db8ceb..f2004b5 100644
--- a/elsie.nci.nih.gov/src/localtime.c
+++ b/elsie.nci.nih.gov/src/localtime.c
@@ -13,7 +13,6 @@
#include "private.h"
#include "tzfile.h"
#include "fcntl.h"
-#include "float.h" /* for FLT_MAX and DBL_MAX */
#ifndef TZ_ABBR_MAX_LEN
#define TZ_ABBR_MAX_LEN 16
@@ -78,11 +77,11 @@ static const char gmt[] = "GMT";
#endif /* !defined TZDEFDST */
struct ttinfo { /* time type information */
- int_fast32_t tt_gmtoff; /* UTC offset in seconds */
+ int_fast32_t tt_gmtoff; /* UT offset in seconds */
int tt_isdst; /* used to set tm_isdst */
int tt_abbrind; /* abbreviation list index */
int tt_ttisstd; /* TRUE if transition is std time */
- int tt_ttisgmt; /* TRUE if transition is UTC */
+ int tt_ttisgmt; /* TRUE if transition is UT */
};
struct lsinfo { /* leap second information */
@@ -318,9 +317,8 @@ settzname(void)
static int
differ_by_repeat(const time_t t1, const time_t t0)
{
- if (TYPE_INTEGRAL(time_t) &&
- TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS)
- return 0;
+ if (TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS)
+ return 0;
return t1 - t0 == SECSPERREPEAT;
}
@@ -527,9 +525,9 @@ tzload(register const char *name, register struct state *const sp,
for (i = 0; i < nread; ++i)
up->buf[i] = p[i];
/*
- ** If this is a narrow integer time_t system, we're done.
+ ** If this is a narrow time_t system, we're done.
*/
- if (stored >= (int) sizeof(time_t) && TYPE_INTEGRAL(time_t))
+ if (stored >= (int) sizeof(time_t))
break;
}
if (doextend && nread > 2 &&
@@ -837,14 +835,14 @@ getrule(const char *strp, register struct rule *const rulep)
** Time specified.
*/
++strp;
- strp = getsecs(strp, &rulep->r_time);
+ strp = getoffset(strp, &rulep->r_time);
} else rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */
return strp;
}
/*
** Given the Epoch-relative time of January 1, 00:00:00 UTC, in a year, the
-** year, a rule, and the offset from UTC at the time that rule takes effect,
+** year, a rule, and the offset from UT at the time that rule takes effect,
** calculate the Epoch-relative time that rule takes effect.
*/
@@ -927,10 +925,10 @@ transtime(const time_t janfirst, const int year,
}
/*
- ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
+ ** "value" is the Epoch-relative time of 00:00:00 UT on the day in
** question. To get the Epoch-relative time of the specified local
** time on that day, add the transition time and the current offset
- ** from UTC.
+ ** from UT.
*/
return value + rulep->r_time + offset;
}
@@ -1010,6 +1008,7 @@ tzparse(const char *name, register struct state *const sp,
struct rule start;
struct rule end;
register int year;
+ register int yearlim;
register time_t janfirst;
time_t starttime;
time_t endtime;
@@ -1037,35 +1036,43 @@ tzparse(const char *name, register struct state *const sp,
atp = sp->ats;
typep = sp->types;
janfirst = 0;
- sp->timecnt = 0;
- for (year = EPOCH_YEAR;
- sp->timecnt + 2 <= TZ_MAX_TIMES;
- ++year) {
- time_t newfirst;
+ yearlim = EPOCH_YEAR + YEARSPERREPEAT;
+ for (year = EPOCH_YEAR; year < yearlim; year++) {
+ int_fast32_t yearsecs;
starttime = transtime(janfirst, year, &start,
stdoffset);
endtime = transtime(janfirst, year, &end,
dstoffset);
- if (starttime > endtime) {
- *atp++ = endtime;
- *typep++ = 1; /* DST ends */
- *atp++ = starttime;
- *typep++ = 0; /* DST begins */
- } else {
- *atp++ = starttime;
- *typep++ = 0; /* DST begins */
- *atp++ = endtime;
- *typep++ = 1; /* DST ends */
+ yearsecs = (year_lengths[isleap(year)]
+ * SECSPERDAY);
+ if (starttime > endtime
+ || (starttime < endtime
+ && (endtime - starttime
+ < (yearsecs
+ + (stdoffset - dstoffset))))) {
+ if (&sp->ats[TZ_MAX_TIMES - 2] < atp)
+ break;
+ yearlim = year + YEARSPERREPEAT + 1;
+ if (starttime > endtime) {
+ *atp++ = endtime;
+ *typep++ = 1; /* DST ends */
+ *atp++ = starttime;
+ *typep++ = 0; /* DST begins */
+ } else {
+ *atp++ = starttime;
+ *typep++ = 0; /* DST begins */
+ *atp++ = endtime;
+ *typep++ = 1; /* DST ends */
+ }
}
- sp->timecnt += 2;
- newfirst = janfirst;
- newfirst += year_lengths[isleap(year)] *
- SECSPERDAY;
- if (newfirst <= janfirst)
+ if (time_t_max - janfirst < yearsecs)
break;
- janfirst = newfirst;
+ janfirst += yearsecs;
}
+ sp->timecnt = atp - sp->ats;
+ if (!sp->timecnt)
+ sp->typecnt = 1; /* Perpetual DST. */
} else {
register int_fast32_t theirstdoffset;
register int_fast32_t theirdstoffset;
@@ -1283,21 +1290,14 @@ localsub(const time_t *const timep, const int_fast32_t offset,
(sp->goahead && t > sp->ats[sp->timecnt - 1])) {
time_t newt = t;
register time_t seconds;
- register time_t tcycles;
- register int_fast64_t icycles;
+ register time_t years;
if (t < sp->ats[0])
seconds = sp->ats[0] - t;
else seconds = t - sp->ats[sp->timecnt - 1];
--seconds;
- tcycles = seconds / YEARSPERREPEAT / AVGSECSPERYEAR;
- ++tcycles;
- icycles = tcycles;
- if (tcycles - icycles >= 1 || icycles - tcycles >= 1)
- return NULL;
- seconds = icycles;
- seconds *= YEARSPERREPEAT;
- seconds *= AVGSECSPERYEAR;
+ years = (seconds / SECSPERREPEAT + 1) * YEARSPERREPEAT;
+ seconds = years * AVGSECSPERYEAR;
if (t < sp->ats[0])
newt += seconds;
else newt -= seconds;
@@ -1310,8 +1310,8 @@ localsub(const time_t *const timep, const int_fast32_t offset,
newy = tmp->tm_year;
if (t < sp->ats[0])
- newy -= icycles * YEARSPERREPEAT;
- else newy += icycles * YEARSPERREPEAT;
+ newy -= years;
+ else newy += years;
tmp->tm_year = newy;
if (tmp->tm_year != newy)
return NULL;
@@ -1388,7 +1388,7 @@ gmtsub(const time_t *const timep, const int_fast32_t offset,
#ifdef TM_ZONE
/*
** Could get fancy here and deliver something such as
- ** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero,
+ ** "UT+xxxx" or "UT-xxxx" if offset is non-zero,
** but this is no time for a treasure hunt.
*/
if (offset != 0)
@@ -1426,7 +1426,7 @@ gmtime_r(const time_t *const timep, struct tm *tmp)
#ifdef STD_INSPIRED
struct tm *
-offtime(const time_t *const timep, const int_fast32_t offset)
+offtime(const time_t *const timep, const long offset)
{
return gmtsub(timep, offset, &tm);
}
@@ -1498,9 +1498,10 @@ timesub(const time_t *const timep, const int_fast32_t offset,
register int leapdays;
tdelta = tdays / DAYSPERLYEAR;
- idelta = tdelta;
- if (tdelta - idelta >= 1 || idelta - tdelta >= 1)
+ if (! ((! TYPE_SIGNED(time_t) || INT_MIN <= tdelta)
+ && tdelta <= INT_MAX))
return NULL;
+ idelta = tdelta;
if (idelta == 0)
idelta = (tdays < 0) ? -1 : 1;
newy = y;
@@ -1514,9 +1515,8 @@ timesub(const time_t *const timep, const int_fast32_t offset,
}
{
register int_fast32_t seconds;
- register time_t half_second = 0.5;
- seconds = tdays * SECSPERDAY + half_second;
+ seconds = tdays * SECSPERDAY;
tdays = seconds / SECSPERDAY;
rem += seconds - tdays * SECSPERDAY;
}
@@ -1674,8 +1674,9 @@ tmcomp(register const struct tm *const atmp,
{
register int result;
- if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
- (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
+ if (atmp->tm_year != btmp->tm_year)
+ return atmp->tm_year < btmp->tm_year ? -1 : 1;
+ if ((result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
(result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
(result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
(result = (atmp->tm_min - btmp->tm_min)) == 0)
@@ -1775,11 +1776,6 @@ time2sub(struct tm *const tmp,
if (!TYPE_SIGNED(time_t)) {
lo = 0;
hi = lo - 1;
- } else if (!TYPE_INTEGRAL(time_t)) {
- if (sizeof(time_t) > sizeof(float))
- hi = (time_t) DBL_MAX;
- else hi = (time_t) FLT_MAX;
- lo = -hi;
} else {
lo = 1;
for (i = 0; i < (int) TYPE_BIT(time_t) - 1; ++i)
@@ -1802,14 +1798,14 @@ time2sub(struct tm *const tmp,
} else dir = tmcomp(&mytm, &yourtm);
if (dir != 0) {
if (t == lo) {
- ++t;
- if (t <= lo)
+ if (t == time_t_max)
return WRONG;
+ ++t;
++lo;
} else if (t == hi) {
- --t;
- if (t >= hi)
+ if (t == time_t_min)
return WRONG;
+ --t;
--hi;
}
if (lo > hi)
@@ -1985,7 +1981,7 @@ timegm(struct tm *const tmp)
}
time_t
-timeoff(struct tm *const tmp, const int_fast32_t offset)
+timeoff(struct tm *const tmp, const long offset)
{
if (tmp != NULL)
tmp->tm_isdst = 0;
@@ -2001,7 +1997,7 @@ timeoff(struct tm *const tmp, const int_fast32_t offset)
** previous versions of the CMUCS runtime library.
*/
-int_fast32_t
+long
gtime(struct tm *const tmp)
{
const time_t t = mktime(tmp);
diff --git a/elsie.nci.nih.gov/src/newctime.3 b/elsie.nci.nih.gov/src/newctime.3
index 3583a91..61cd9e4 100644
--- a/elsie.nci.nih.gov/src/newctime.3
+++ b/elsie.nci.nih.gov/src/newctime.3
@@ -36,8 +36,6 @@ asctime, ctime, difftime, gmtime, localtime, mktime \- convert date and time to
.I Ctime\^
converts a long integer, pointed to by
.IR clock ,
-representing the time in seconds since
-00:00:00 UTC, 1970-01-01,
and returns a pointer to a
string of the form
.br
@@ -59,6 +57,17 @@ These unusual formats are designed to make it less likely that older
software that expects exactly 26 bytes of output will mistakenly output
misleading values for out-of-range years.
.PP
+The
+.BI * clock
+time stamp represents the time in seconds since 1970-01-01 00:00:00
+Coordinated Universal Time (UTC).
+The POSIX standard says that time stamps must be nonnegative
+and must ignore leap seconds.
+Many implementations extend POSIX by allowing negative time stamps,
+and can therefore represent time stamps that predate the
+introduction of UTC and are some other flavor of Universal Time (UT).
+Some implementations support leap seconds, in contradiction to POSIX.
+.PP
.I Localtime\^
and
.I gmtime\^
@@ -165,7 +174,7 @@ includes the following fields:
int tm_yday; /\(** day of year (0 - 365) \(**/
int tm_isdst; /\(** is summer time in effect? \(**/
char \(**tm_zone; /\(** abbreviation of timezone name \(**/
- long tm_gmtoff; /\(** offset from UTC in seconds \(**/
+ long tm_gmtoff; /\(** offset from UT in seconds \(**/
.fi
.RE
.PP
@@ -184,8 +193,9 @@ is non-zero if summer time is in effect.
.PP
.I Tm_gmtoff
is the offset (in seconds) of the time represented
-from UTC, with positive values indicating east
+from UT, with positive values indicating east
of the Prime Meridian.
+The field's name is derived from Greenwich Mean Time, a precursor of UT.
.SH FILES
.ta \w'/usr/local/etc/zoneinfo/posixrules\0\0'u
/usr/local/etc/zoneinfo time zone information directory
diff --git a/elsie.nci.nih.gov/src/newctime.3.txt b/elsie.nci.nih.gov/src/newctime.3.txt
index cd3ace7..0cbe94d 100644
--- a/elsie.nci.nih.gov/src/newctime.3.txt
+++ b/elsie.nci.nih.gov/src/newctime.3.txt
@@ -35,9 +35,8 @@ SYNOPSIS
cc ... -ltz
DESCRIPTION
- Ctime converts a long integer, pointed to by clock, representing the
- time in seconds since 00:00:00 UTC, 1970-01-01, and returns a pointer
- to a string of the form
+ Ctime converts a long integer, pointed to by clock, and returns a
+ pointer to a string of the form
Thu Nov 24 18:22:48 1986\n\0
Years requiring fewer than four characters are padded with leading
zeroes. For years longer than four characters, the string is of the
@@ -48,6 +47,14 @@ DESCRIPTION
bytes of output will mistakenly output misleading values for out-of-
range years.
+ The *clock time stamp represents the time in seconds since 1970-01-01
+ 00:00:00 Coordinated Universal Time (UTC). The POSIX standard says
+ that time stamps must be nonnegative and must ignore leap seconds.
+ Many implementations extend POSIX by allowing negative time stamps, and
+ can therefore represent time stamps that predate the introduction of
+ UTC and are some other flavor of Universal Time (UT). Some
+ implementations support leap seconds, in contradiction to POSIX.
+
Localtime and gmtime return pointers to ``tm'' structures, described
below. Localtime corrects for the time zone and any time zone
adjustments (such as Daylight Saving Time in the United States). After
@@ -98,7 +105,7 @@ DESCRIPTION
int tm_yday; /* day of year (0 - 365) */
int tm_isdst; /* is summer time in effect? */
char *tm_zone; /* abbreviation of timezone name */
- long tm_gmtoff; /* offset from UTC in seconds */
+ long tm_gmtoff; /* offset from UT in seconds */
The tm_zone and tm_gmtoff fields exist, and are filled in, only if
arrangements to do so were made when the library containing these
@@ -107,8 +114,9 @@ DESCRIPTION
Tm_isdst is non-zero if summer time is in effect.
- Tm_gmtoff is the offset (in seconds) of the time represented from UTC,
- with positive values indicating east of the Prime Meridian.
+ Tm_gmtoff is the offset (in seconds) of the time represented from UT,
+ with positive values indicating east of the Prime Meridian. The
+ field's name is derived from Greenwich Mean Time, a precursor of UT.
FILES
/usr/local/etc/zoneinfo time zone information directory
diff --git a/elsie.nci.nih.gov/src/newstrftime.3 b/elsie.nci.nih.gov/src/newstrftime.3
index ef79e4d..d39915c 100644
--- a/elsie.nci.nih.gov/src/newstrftime.3
+++ b/elsie.nci.nih.gov/src/newstrftime.3
@@ -164,7 +164,7 @@ using AM/PM notation.
is replaced by the second as a decimal number (00-60).
.TP
%s
-is replaced by the number of seconds since the Epoch, UTC (see mktime(3)).
+is replaced by the number of seconds since the Epoch (see newctime(3)).
.TP
%T
is replaced by the time in the format %H:%M:%S.
@@ -211,7 +211,8 @@ is replaced by the time zone name,
or by the empty string if this is not determinable.
.TP
%z
-is replaced by the offset from UTC in the format +HHMM or -HHMM as appropriate,
+is replaced by the offset from the Prime Meridian
+in the format +HHMM or \(miHHMM as appropriate,
with positive values representing locations east of Greenwich,
or by the empty string if this is not determinable.
.TP
diff --git a/elsie.nci.nih.gov/src/newstrftime.3.txt b/elsie.nci.nih.gov/src/newstrftime.3.txt
index fdafa4d..772d1a3 100644
--- a/elsie.nci.nih.gov/src/newstrftime.3.txt
+++ b/elsie.nci.nih.gov/src/newstrftime.3.txt
@@ -93,8 +93,8 @@ DESCRIPTION
%S is replaced by the second as a decimal number (00-60).
- %s is replaced by the number of seconds since the Epoch, UTC (see
- mktime(3)).
+ %s is replaced by the number of seconds since the Epoch (see
+ newctime(3)).
%T is replaced by the time in the format %H:%M:%S.
@@ -130,10 +130,10 @@ DESCRIPTION
%Z is replaced by the time zone name, or by the empty string if
this is not determinable.
- %z is replaced by the offset from UTC in the format +HHMM or -HHMM
- as appropriate, with positive values representing locations east
- of Greenwich, or by the empty string if this is not
- determinable.
+ %z is replaced by the offset from the Prime Meridian in the format
+ +HHMM or -HHMM as appropriate, with positive values representing
+ locations east of Greenwich, or by the empty string if this is
+ not determinable.
%% is replaced by a single %.
diff --git a/elsie.nci.nih.gov/src/newtzset.3 b/elsie.nci.nih.gov/src/newtzset.3
index fd6b677..3462f4f 100644
--- a/elsie.nci.nih.gov/src/newtzset.3
+++ b/elsie.nci.nih.gov/src/newtzset.3
@@ -26,8 +26,10 @@ in the system time conversion information directory, is used by
If
.B TZ
appears in the environment but its value is a null string,
-Coordinated Universal Time (UTC) is used (without leap second
-correction). If
+Universal Time (UT) is used, with the abbreviation "UTC"
+and without leap second correction; please see
+.IR newctime (3)
+for more about UT, UTC, and leap seconds. If
.B TZ
appears in the environment and its value is not a null string:
.IP
@@ -130,6 +132,10 @@ describes when the change back happens. Each
.I time
field describes when, in current local time, the change to the other
time is made.
+As an extension to POSIX, daylight saving is assumed to be in effect
+all year if it begins January 1 at 00:00 and ends December 31 at
+24:00 plus the difference between daylight saving and standard time,
+leaving no room for standard time in the calendar.
.IP
The format of
.I date
@@ -175,16 +181,58 @@ The
.I time
has the same format as
.I offset
-except that no leading sign
+except that POSIX does not allow a leading sign
.RB (`` \(mi ''
or
-.RB `` \(pl '')
-is allowed. The default, if
+.RB `` \(pl '').
+As an extension to POSIX, the hours part of
+.I time
+can range from \(mi167 through 167; this allows for unusual rules such
+as "the Saturday before the first Sunday of March". The default, if
.I time
is not given, is
.BR 02:00:00 .
.RE
.LP
+Here are some examples of
+.B TZ
+values that directly specify the time zone rules; they use some of the
+extensions to POSIX.
+.TP
+.B EST5
+stands for US eastern
+time (EST), 5 hours behind UTC, without daylight saving.
+.TP
+.B FJT\(mi12FJST,M10.3.1/146,M1.3.4/75
+stands for Fiji Time (FJT) and Fiji Summer Time (FJST), 12 hours ahead
+of UTC, springing forward on October's third Monday at
+146:00 (i.e., 02:00 on the first Sunday on or after October 21), and
+falling back on January's third Thursday at 75:00 (i.e., 03:00 on the
+first Sunday on or after January 18).
+.TP
+.B IST\(mi2IDT,M3.4.4/26,M10.5.0
+stands for Israel Standard Time (IST) and Israel Daylight Time (IDT),
+2 hours ahead of UTC, springing forward on March's fourth
+Tuesday at 26:00 (i.e., 02:00 on the first Friday on or after March
+23), and falling back on October's last Sunday at 02:00.
+.TP
+.B WART4WARST,J1/0,J365/25
+stands for Western Argentina Summer Time (WARST), 3 hours behind UTC.
+There is a dummy fall-back transition on December 31 at 25:00 daylight
+saving time (i.e., 24:00 standard time, equivalent to January 1 at
+00:00 standard time), and a simultaneous spring-forward transition on
+January 1 at 00:00 standard time, so daylight saving time is in effect
+all year and the initial
+.B WART
+is a placeholder.
+.TP
+.B WGT3WGST,M3.5.0/\(mi2,M10.5.0/\(mi1
+stands for Western Greenland time (WGT) and Western Greenland Summer
+Time (WGST), 3 hours behind UTC, where clocks follow the EU rules of
+springing forward on March's last Sunday at 01:00 UTC (\(mi02:00 local
+time) and falling back on October's last Sunday at 01:00 UTC
+(\(mi01:00 local time).
+.PP
If no
.I rule
is present in
diff --git a/elsie.nci.nih.gov/src/newtzset.3.txt b/elsie.nci.nih.gov/src/newtzset.3.txt
index 16dc464..98af1b0 100644
--- a/elsie.nci.nih.gov/src/newtzset.3.txt
+++ b/elsie.nci.nih.gov/src/newtzset.3.txt
@@ -14,9 +14,11 @@ DESCRIPTION
environment, the best available approximation to local wall clock time,
as specified by the tzfile(5)-format file localtime in the system time
conversion information directory, is used by localtime. If TZ appears
- in the environment but its value is a null string, Coordinated
- Universal Time (UTC) is used (without leap second correction). If TZ
- appears in the environment and its value is not a null string:
+ in the environment but its value is a null string, Universal Time (UT)
+ is used, with the abbreviation "UTC" and without leap second
+ correction; please see newctime(3) for more about UT, UTC, and leap
+ seconds. If TZ appears in the environment and its value is not a null
+ string:
if the value begins with a colon, it is used as a pathname of a
file from which to read the time conversion information;
@@ -78,7 +80,12 @@ DESCRIPTION
second date describes when the change back
happens. Each time field describes when, in
current local time, the change to the other time
- is made.
+ is made. As an extension to POSIX, daylight
+ saving is assumed to be in effect all year if it
+ begins January 1 at 00:00 and ends December 31 at
+ 24:00 plus the difference between daylight saving
+ and standard time, leaving no room for standard
+ time in the calendar.
The format of date is one of the following:
@@ -104,8 +111,47 @@ DESCRIPTION
Sunday.
The time has the same format as offset except
- that no leading sign (``-'' or ``+'') is allowed.
- The default, if time is not given, is 02:00:00.
+ that POSIX does not allow a leading sign (``-''
+ or ``+''). As an extension to POSIX, the hours
+ part of time can range from -167 through 167;
+ this allows for unusual rules such as "the
+ Saturday before the first Sunday of March". The
+ default, if time is not given, is 02:00:00.
+
+ Here are some examples of TZ values that directly specify the time zone
+ rules; they use some of the extensions to POSIX.
+
+ EST5 stands for US eastern time (EST), 5 hours behind UTC, without
+ daylight saving.
+
+ FJT-12FJST,M10.3.1/146,M1.3.4/75
+ stands for Fiji Time (FJT) and Fiji Summer Time (FJST), 12 hours
+ ahead of UTC, springing forward on October's third Monday at
+ 146:00 (i.e., 02:00 on the first Sunday on or after October 21),
+ and falling back on January's third Thursday at 75:00 (i.e.,
+ 03:00 on the first Sunday on or after January 18).
+
+ IST-2IDT,M3.4.4/26,M10.5.0
+ stands for Israel Standard Time (IST) and Israel Daylight Time
+ (IDT), 2 hours ahead of UTC, springing forward on March's fourth
+ Tuesday at 26:00 (i.e., 02:00 on the first Friday on or after
+ March 23), and falling back on October's last Sunday at 02:00.
+
+ WART4WARST,J1/0,J365/25
+ stands for Western Argentina Summer Time (WARST), 3 hours behind
+ UTC. There is a dummy fall-back transition on December 31 at
+ 25:00 daylight saving time (i.e., 24:00 standard time,
+ equivalent to January 1 at 00:00 standard time), and a
+ simultaneous spring-forward transition on January 1 at 00:00
+ standard time, so daylight saving time is in effect all year and
+ the initial WART is a placeholder.
+
+ WGT3WGST,M3.5.0/-2,M10.5.0/-1
+ stands for Western Greenland time (WGT) and Western Greenland
+ Summer Time (WGST), 3 hours behind UTC, where clocks follow the
+ EU rules of springing forward on March's last Sunday at 01:00
+ UTC (-02:00 local time) and falling back on October's last
+ Sunday at 01:00 UTC (-01:00 local time).
If no rule is present in TZ, the rules specified by the
tzfile(5)-format file posixrules in the system time conversion
diff --git a/elsie.nci.nih.gov/src/northamerica b/elsie.nci.nih.gov/src/northamerica
index 1964903..c3921d3 100644
--- a/elsie.nci.nih.gov/src/northamerica
+++ b/elsie.nci.nih.gov/src/northamerica
@@ -20,7 +20,7 @@
# Howse writes (pp 121-125) that time zones were invented by
# Professor Charles Ferdinand Dowd (1825-1904),
# Principal of Temple Grove Ladies' Seminary (Saratoga Springs, NY).
-# His pamphlet ``A System of National Time for Railroads'' (1870)
+# His pamphlet "A System of National Time for Railroads" (1870)
# was the result of his proposals at the Convention of Railroad Trunk Lines
# in New York City (1869-10). His 1870 proposal was based on Washington, DC,
# but in 1872-05 he moved the proposed origin to Greenwich.
@@ -40,8 +40,8 @@
# From Paul Eggert (2001-03-06):
# Daylight Saving Time was first suggested as a joke by Benjamin Franklin
-# in his whimsical essay ``An Economical Project for Diminishing the Cost
-# of Light'' published in the Journal de Paris (1784-04-26).
+# in his whimsical essay "An Economical Project for Diminishing the Cost
+# of Light" published in the Journal de Paris (1784-04-26).
# Not everyone is happy with the results:
#
# I don't really care how time is reckoned so long as there is some
@@ -167,8 +167,8 @@ Zone PST8PDT -8:00 US P%sT
# of the Aleutian islands. No DST.
# From Paul Eggert (1995-12-19):
-# The tables below use `NST', not `NT', for Nome Standard Time.
-# I invented `CAWT' for Central Alaska War Time.
+# The tables below use 'NST', not 'NT', for Nome Standard Time.
+# I invented 'CAWT' for Central Alaska War Time.
# From U. S. Naval Observatory (1989-01-19):
# USA EASTERN 5 H BEHIND UTC NEW YORK, WASHINGTON
@@ -237,9 +237,9 @@ Zone PST8PDT -8:00 US P%sT
# H.R. 6, Energy Policy Act of 2005, SEC. 110. DAYLIGHT SAVINGS.
# (a) Amendment- Section 3(a) of the Uniform Time Act of 1966 (15
# U.S.C. 260a(a)) is amended--
-# (1) by striking `first Sunday of April' and inserting `second
+# (1) by striking 'first Sunday of April' and inserting 'second
# Sunday of March'; and
-# (2) by striking `last Sunday of October' and inserting `first
+# (2) by striking 'last Sunday of October' and inserting 'first
# Sunday of November'.
# (b) Effective Date- Subsection (a) shall take effect 1 year after the
# date of enactment of this Act or March 1, 2007, whichever is later.
@@ -600,6 +600,8 @@ Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 #Schmitt&Cox
-10:30 - HST 1947 Jun 8 2:00 #Schmitt&Cox+2
-10:00 - HST
+Link Pacific/Honolulu Pacific/Johnston
+
# Now we turn to US areas that have diverged from the consensus since 1970.
# Arizona mostly uses MST.
@@ -636,8 +638,9 @@ Zone America/Phoenix -7:28:18 - LMT 1883 Nov 18 11:31:42
# Navajo Nation participates in the Daylight Saving Time policy, due to its
# large size and location in three states." (The "only" means that other
# tribal nations don't use DST.)
-
-Link America/Denver America/Shiprock
+#
+# From Paul Eggert (2013-08-26):
+# See America/Denver for a zone appropriate for the Navajo Nation.
# Southern Idaho (Ada, Adams, Bannock, Bear Lake, Bingham, Blaine,
# Boise, Bonneville, Butte, Camas, Canyon, Caribou, Cassia, Clark,
@@ -677,13 +680,13 @@ Zone America/Boise -7:44:49 - LMT 1883 Nov 18 12:15:11
# and Switzerland counties have their own time zone histories as noted below.
#
# Shanks partitioned Indiana into 345 regions, each with its own time history,
-# and wrote ``Even newspaper reports present contradictory information.''
+# and wrote "Even newspaper reports present contradictory information."
# Those Hoosiers! Such a flighty and changeable people!
# Fortunately, most of the complexity occurred before our cutoff date of 1970.
#
# Other than Indianapolis, the Indiana place names are so nondescript
-# that they would be ambiguous if we left them at the `America' level.
-# So we reluctantly put them all in a subdirectory `America/Indiana'.
+# that they would be ambiguous if we left them at the 'America' level.
+# So we reluctantly put them all in a subdirectory 'America/Indiana'.
# From Paul Eggert (2005-08-16):
# http://www.mccsc.edu/time.html says that Indiana will use DST starting 2006.
@@ -947,8 +950,8 @@ Zone America/Kentucky/Monticello -5:39:24 - LMT 1883 Nov 18 12:20:36
# This story is too entertaining to be false, so go with Howse over Shanks.
#
# From Paul Eggert (2001-03-06):
-# Garland (1927) writes ``Cleveland and Detroit advanced their clocks
-# one hour in 1914.'' This change is not in Shanks. We have no more
+# Garland (1927) writes "Cleveland and Detroit advanced their clocks
+# one hour in 1914." This change is not in Shanks. We have no more
# info, so omit this for now.
#
# Most of Michigan observed DST from 1973 on, but was a bit late in 1975.
@@ -988,7 +991,7 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
# occupied 1857/1900 by the Navassa Phosphate Co
# US lighthouse 1917/1996-09
# currently uninhabited
-# see Mark Fineman, ``An Isle Rich in Guano and Discord'',
+# see Mark Fineman, "An Isle Rich in Guano and Discord",
# _Los Angeles Times_ (1998-11-10), A1, A10; it cites
# Jimmy Skaggs, _The Great Guano Rush_ (1994).
@@ -1022,7 +1025,7 @@ Zone America/Menominee -5:50:27 - LMT 1885 Sep 18 12:00
# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
# <http://www.jstor.org/stable/1774359>.
#
-# See the `europe' file for Greenland.
+# See the 'europe' file for Greenland.
# Canada
@@ -1223,7 +1226,7 @@ Zone America/St_Johns -3:30:52 - LMT 1884
# most of east Labrador
-# The name `Happy Valley-Goose Bay' is too long; use `Goose Bay'.
+# The name 'Happy Valley-Goose Bay' is too long; use 'Goose Bay'.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Goose_Bay -4:01:40 - LMT 1884 # Happy Valley-Goose Bay
-3:30:52 - NST 1918
@@ -1340,25 +1343,27 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9
# Quebec
-# From Paul Eggert (2006-07-09):
-# Shanks & Pottenger write that since 1970 most of Quebec has been
-# like Montreal.
+# From Paul Eggert (2013-08-30):
+# Since 1970 most of Quebec has been like Toronto.
+# However, because earlier versions of the tz database mistakenly relied on data
+# from Shanks & Pottenger saying that Quebec differed from Ontario after 1970,
+# a separate entry was created for most of Quebec. We're loath to lose
+# its pre-1970 info, even though the tz database is normally limited to
+# zones that differ after 1970, so keep this otherwise out-of-scope entry.
-# From Paul Eggert (2006-06-27):
# Matthews and Vincent (1998) also write that Quebec east of the -63
# meridian is supposed to observe AST, but residents as far east as
# Natashquan use EST/EDT, and residents east of Natashquan use AST.
-# In "Official time in Quebec" the Quebec department of justice writes in
-# http://www.justice.gouv.qc.ca/english/publications/generale/temps-regl-1-a.htm
-# that "The residents of the Municipality of the
-# Cote-Nord-du-Golfe-Saint-Laurent and the municipalities of Saint-Augustin,
-# Bonne-Esperance and Blanc-Sablon apply the Official Time Act as it is
-# written and use Atlantic standard time all year round. The same applies to
-# the residents of the Native facilities along the lower North Shore."
-# <http://www.assnat.qc.ca/eng/37legislature2/Projets-loi/Publics/06-a002.htm>
+# The Quebec department of justice writes in
+# "The situation in Minganie and Basse-Cote-Nord"
+# http://www.justice.gouv.qc.ca/english/publications/generale/temps-minganie-a.htm
+# that the coastal strip from just east of Natashquan to Blanc-Sablon
+# observes Atlantic standard time all year round.
+# http://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en
# says this common practice was codified into law as of 2007.
# For lack of better info, guess this practice began around 1970, contra to
# Shanks & Pottenger who have this region observing AST/ADT.
+# for post-1970 data America/Puerto_Rico.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mont 1917 only - Mar 25 2:00 1:00 D
@@ -1402,7 +1407,6 @@ Zone America/Montreal -4:54:16 - LMT 1884
-5:00 Mont E%sT 1974
-5:00 Canada E%sT
-
# Ontario
# From Paul Eggert (2006-07-09):
@@ -1621,7 +1625,7 @@ Zone America/Thunder_Bay -5:57:00 - LMT 1895
-6:00 - CST 1910
-5:00 - EST 1942
-5:00 Canada E%sT 1970
- -5:00 Mont E%sT 1973
+ -5:00 Toronto E%sT 1973
-5:00 - EST 1974
-5:00 Canada E%sT
Zone America/Nipigon -5:53:04 - LMT 1895
@@ -2208,7 +2212,7 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20
# From Paul Eggert (1996-06-12):
# For an English translation of the decree, see
# <a href="http://mexico-travel.com/extra/timezone_eng.html">
-# ``Diario Oficial: Time Zone Changeover'' (1996-01-04).
+# "Diario Oficial: Time Zone Changeover" (1996-01-04).
# </a>
# From Rives McDow (1998-10-08):
@@ -2545,9 +2549,7 @@ Zone America/Santa_Isabel -7:39:28 - LMT 1922 Jan 1 0:20:32
###############################################################################
# Anguilla
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Anguilla -4:12:16 - LMT 1912 Mar 2
- -4:00 - AST
+# See 'southamerica'.
# Antigua and Barbuda
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -2616,13 +2618,13 @@ Zone America/Belize -5:52:48 - LMT 1912 Apr
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Atlantic/Bermuda -4:19:18 - LMT 1930 Jan 1 2:00 # Hamilton
-4:00 - AST 1974 Apr 28 2:00
- -4:00 Bahamas A%sT 1976
+ -4:00 Canada A%sT 1976
-4:00 US A%sT
# Cayman Is
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown
- -5:07:12 - KMT 1912 Feb # Kingston Mean Time
+ -5:07:11 - KMT 1912 Feb # Kingston Mean Time
-5:00 - EST
# Costa Rica
@@ -2637,7 +2639,7 @@ Rule CR 1991 1992 - Jan Sat>=15 0:00 1:00 D
# go with Shanks & Pottenger.
Rule CR 1991 only - Jul 1 0:00 0 S
Rule CR 1992 only - Mar 15 0:00 0 S
-# There are too many San Joses elsewhere, so we'll use `Costa Rica'.
+# There are too many San Joses elsewhere, so we'll use 'Costa Rica'.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Costa_Rica -5:36:13 - LMT 1890 # San Jose
-5:36:13 - SJMT 1921 Jan 15 # San Jose Mean Time
@@ -2869,9 +2871,7 @@ Zone America/Havana -5:29:28 - LMT 1890
-5:00 Cuba C%sT
# Dominica
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Dominica -4:05:36 - LMT 1911 Jul 1 0:01 # Roseau
- -4:00 - AST
+# See 'southamerica'.
# Dominican Republic
@@ -2920,18 +2920,10 @@ Zone America/El_Salvador -5:56:48 - LMT 1921 # San Salvador
-6:00 Salv C%sT
# Grenada
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Grenada -4:07:00 - LMT 1911 Jul # St George's
- -4:00 - AST
-
# Guadeloupe
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Guadeloupe -4:06:08 - LMT 1911 Jun 8 # Pointe a Pitre
- -4:00 - AST
# St Barthelemy
-Link America/Guadeloupe America/St_Barthelemy
# St Martin (French part)
-Link America/Guadeloupe America/Marigot
+# See 'southamerica'.
# Guatemala
#
@@ -3074,17 +3066,12 @@ Zone America/Tegucigalpa -5:48:52 - LMT 1921 Apr
# Great Swan I ceded by US to Honduras in 1972
# Jamaica
-
-# From Bob Devine (1988-01-28):
-# Follows US rules.
-
-# From U. S. Naval Observatory (1989-01-19):
-# JAMAICA 5 H BEHIND UTC
-
-# From Shanks & Pottenger:
+# Shanks & Pottenger give -5:07:12, but Milne records -5:07:10.41 from an
+# unspecified official document, and says "This time is used throughout the
+# island". Go with Milne. Round to the nearest second as required by zic.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Jamaica -5:07:12 - LMT 1890 # Kingston
- -5:07:12 - KMT 1912 Feb # Kingston Mean Time
+Zone America/Jamaica -5:07:11 - LMT 1890 # Kingston
+ -5:07:11 - KMT 1912 Feb # Kingston Mean Time
-5:00 - EST 1974 Apr 28 2:00
-5:00 US E%sT 1984
-5:00 - EST
@@ -3098,12 +3085,7 @@ Zone America/Martinique -4:04:20 - LMT 1890 # Fort-de-France
-4:00 - AST
# Montserrat
-# From Paul Eggert (2006-03-22):
-# In 1995 volcanic eruptions forced evacuation of Plymouth, the capital.
-# world.gazetteer.com says Cork Hill is the most populous location now.
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Montserrat -4:08:52 - LMT 1911 Jul 1 0:01 # Cork Hill
- -4:00 - AST
+# See 'southamerica'.
# Nicaragua
#
@@ -3177,7 +3159,7 @@ Zone America/Panama -5:18:08 - LMT 1890
-5:00 - EST
# Puerto Rico
-# There are too many San Juans elsewhere, so we'll use `Puerto_Rico'.
+# There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Puerto_Rico -4:24:25 - LMT 1899 Mar 28 12:00 # San Juan
-4:00 - AST 1942 May 3
@@ -3185,18 +3167,11 @@ Zone America/Puerto_Rico -4:24:25 - LMT 1899 Mar 28 12:00 # San Juan
-4:00 - AST
# St Kitts-Nevis
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/St_Kitts -4:10:52 - LMT 1912 Mar 2 # Basseterre
- -4:00 - AST
-
# St Lucia
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/St_Lucia -4:04:00 - LMT 1890 # Castries
- -4:04:00 - CMT 1912 # Castries Mean Time
- -4:00 - AST
+# See 'southamerica'.
# St Pierre and Miquelon
-# There are too many St Pierres elsewhere, so we'll use `Miquelon'.
+# There are too many St Pierres elsewhere, so we'll use 'Miquelon'.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Miquelon -3:44:40 - LMT 1911 May 15 # St Pierre
-4:00 - AST 1980 May
@@ -3204,10 +3179,7 @@ Zone America/Miquelon -3:44:40 - LMT 1911 May 15 # St Pierre
-3:00 Canada PM%sT
# St Vincent and the Grenadines
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/St_Vincent -4:04:56 - LMT 1890 # Kingstown
- -4:04:56 - KMT 1912 # Kingstown Mean Time
- -4:00 - AST
+# See 'southamerica'.
# Turks and Caicos
#
@@ -3237,15 +3209,9 @@ Rule TC 2007 max - Mar Sun>=8 2:00 1:00 D
Rule TC 2007 max - Nov Sun>=1 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Grand_Turk -4:44:32 - LMT 1890
- -5:07:12 - KMT 1912 Feb # Kingston Mean Time
+ -5:07:11 - KMT 1912 Feb # Kingston Mean Time
-5:00 TC E%sT
# British Virgin Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Tortola -4:18:28 - LMT 1911 Jul # Road Town
- -4:00 - AST
-
# Virgin Is
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/St_Thomas -4:19:44 - LMT 1911 Jul # Charlotte Amalie
- -4:00 - AST
+# See 'southamerica'.
diff --git a/elsie.nci.nih.gov/src/private.h b/elsie.nci.nih.gov/src/private.h
index a31a26e..3a19305 100644
--- a/elsie.nci.nih.gov/src/private.h
+++ b/elsie.nci.nih.gov/src/private.h
@@ -166,10 +166,21 @@ typedef int int_fast32_t;
#ifndef INTMAX_MAX
# if defined LLONG_MAX || defined __LONG_LONG_MAX__
typedef long long intmax_t;
+# define strtoimax strtoll
# define PRIdMAX "lld"
+# ifdef LLONG_MAX
+# define INTMAX_MAX LLONG_MAX
+# define INTMAX_MIN LLONG_MIN
+# else
+# define INTMAX_MAX __LONG_LONG_MAX__
+# define INTMAX_MIN __LONG_LONG_MIN__
+# endif
# else
typedef long intmax_t;
+# define strtoimax strtol
# define PRIdMAX "ld"
+# define INTMAX_MAX LONG_MAX
+# define INTMAX_MIN LONG_MIN
# endif
#endif
@@ -193,9 +204,11 @@ typedef unsigned long uintmax_t;
#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
# define ATTRIBUTE_CONST __attribute__ ((const))
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
+# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
#else
# define ATTRIBUTE_CONST /* empty */
# define ATTRIBUTE_PURE /* empty */
+# define ATTRIBUTE_FORMAT(spec) /* empty */
#endif
#if !defined _Noreturn && __STDC_VERSION__ < 201112
@@ -304,14 +317,15 @@ const char * scheck(const char * string, const char * format);
#define TYPE_SIGNED(type) (((type) -1) < 0)
#endif /* !defined TYPE_SIGNED */
-/*
-** Since the definition of TYPE_INTEGRAL contains floating point numbers,
-** it cannot be used in preprocessor directives.
-*/
-
-#ifndef TYPE_INTEGRAL
-#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
-#endif /* !defined TYPE_INTEGRAL */
+/* The minimum and maximum finite time values. */
+static time_t const time_t_min =
+ (TYPE_SIGNED(time_t)
+ ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
+ : 0);
+static time_t const time_t_max =
+ (TYPE_SIGNED(time_t)
+ ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+ : -1);
#ifndef INT_STRLEN_MAXIMUM
/*
diff --git a/elsie.nci.nih.gov/src/southamerica b/elsie.nci.nih.gov/src/southamerica
index 0d8ed7a..464c548 100644
--- a/elsie.nci.nih.gov/src/southamerica
+++ b/elsie.nci.nih.gov/src/southamerica
@@ -451,6 +451,17 @@ Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 S
# rules...San Luis is still using "Western ARgentina Time" and it got
# stuck on Summer daylight savings time even though the summer is over.
+# From Paul Eggert (2013-09-05):
+# Perhaps San Luis operates on the legal fiction that it is at UTC-4
+# with perpetual summer time, but ordinary usage typically seems to
+# just say it's at UTC-3; see, for example,
+# <http://es.wikipedia.org/wiki/Hora_oficial_argentina>.
+# We've documented similar situations as being plain changes to
+# standard time, so let's do that here too. This does not change UTC
+# offsets, only tm_isdst and the time zone abbreviations. One minor
+# plus is that this silences a zic complaint that there's no POSIX TZ
+# setting for time stamps past 2038.
+
# From Paul Eggert (2013-02-21):
# Milne says Cordoba time was -4:16:48.2. Round to the nearest second.
@@ -588,7 +599,7 @@ Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31
# San Luis (SL)
Rule SanLuis 2008 2009 - Mar Sun>=8 0:00 0 -
-Rule SanLuis 2007 2009 - Oct Sun>=8 0:00 1:00 S
+Rule SanLuis 2007 2008 - Oct Sun>=8 0:00 1:00 S
Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31
-4:16:48 - CMT 1920 May
@@ -604,7 +615,8 @@ Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31
-3:00 - ART 2004 May 31
-4:00 - WART 2004 Jul 25
-3:00 Arg AR%sT 2008 Jan 21
- -4:00 SanLuis WAR%sT
+ -4:00 SanLuis WAR%sT 2009 Oct 11
+ -3:00 - ART
#
# Santa Cruz (SC)
Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31
@@ -631,10 +643,7 @@ Zone America/Argentina/Ushuaia -4:33:12 - LMT 1894 Oct 31
-3:00 - ART
# Aruba
-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone America/Aruba -4:40:24 - LMT 1912 Feb 12 # Oranjestad
- -4:30 - ANT 1965 # Netherlands Antilles Time
- -4:00 - AST
+Link America/Curacao America/Aruba
# Bolivia
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -1350,12 +1359,12 @@ Zone America/Curacao -4:35:47 - LMT 1912 Feb 12 # Willemstad
-4:00 - AST
# From Arthur David Olson (2011-06-15):
-# At least for now, use links for places with new iso3166 codes.
+# use links for places with new iso3166 codes.
# The name "Lower Prince's Quarter" is both longer than fourteen charaters
# and contains an apostrophe; use "Lower_Princes" below.
-Link America/Curacao America/Lower_Princes # Sint Maarten
-Link America/Curacao America/Kralendijk # Bonaire, Sint Estatius and Saba
+Link America/Curacao America/Lower_Princes # Sint Maarten
+Link America/Curacao America/Kralendijk # Caribbean Netherlands
# Ecuador
#
@@ -1633,6 +1642,19 @@ Zone America/Paramaribo -3:40:40 - LMT 1911
Zone America/Port_of_Spain -4:06:04 - LMT 1912 Mar 2
-4:00 - AST
+Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Dominica
+Link America/Port_of_Spain America/Grenada
+Link America/Port_of_Spain America/Guadeloupe
+Link America/Port_of_Spain America/Marigot
+Link America/Port_of_Spain America/Montserrat
+Link America/Port_of_Spain America/St_Barthelemy
+Link America/Port_of_Spain America/St_Kitts
+Link America/Port_of_Spain America/St_Lucia
+Link America/Port_of_Spain America/St_Thomas
+Link America/Port_of_Spain America/St_Vincent
+Link America/Port_of_Spain America/Tortola
+
# Uruguay
# From Paul Eggert (1993-11-18):
# Uruguay wins the prize for the strangest peacetime manipulation of the rules.
@@ -1650,7 +1672,7 @@ Rule Uruguay 1937 1941 - Mar lastSun 0:00 0 -
# Whitman gives 1937 Oct 3; go with Shanks & Pottenger.
Rule Uruguay 1937 1940 - Oct lastSun 0:00 0:30 HS
# Whitman gives 1941 Oct 24 - 1942 Mar 27, 1942 Dec 14 - 1943 Apr 13,
-# and 1943 Apr 13 ``to present time''; go with Shanks & Pottenger.
+# and 1943 Apr 13 "to present time"; go with Shanks & Pottenger.
Rule Uruguay 1941 only - Aug 1 0:00 0:30 HS
Rule Uruguay 1942 only - Jan 1 0:00 0 -
Rule Uruguay 1942 only - Dec 14 0:00 1:00 S
diff --git a/elsie.nci.nih.gov/src/strftime.c b/elsie.nci.nih.gov/src/strftime.c
index 821ce7f..aba3d33 100644
--- a/elsie.nci.nih.gov/src/strftime.c
+++ b/elsie.nci.nih.gov/src/strftime.c
@@ -501,7 +501,7 @@ label:
diff = t->TM_GMTOFF;
#else /* !defined TM_GMTOFF */
/*
- ** C99 says that the UTC offset must
+ ** C99 says that the UT offset must
** be computed by looking only at
** tm_isdst. This requirement is
** incorrect, since it means the code
diff --git a/elsie.nci.nih.gov/src/tz-link.htm b/elsie.nci.nih.gov/src/tz-link.htm
index 9eea060..6752cfc 100644
--- a/elsie.nci.nih.gov/src/tz-link.htm
+++ b/elsie.nci.nih.gov/src/tz-link.htm
@@ -8,7 +8,7 @@
<meta http-equiv="Content-type" content='text/html; charset="US-ASCII"'>
<meta name="DC.Creator" content="Eggert, Paul">
<meta name="DC.Contributor" content="Olson, Arthur David">
-<meta name="DC.Date" content="2013-07-03">
+<meta name="DC.Date" content="2013-09-05">
<meta name="DC.Description"
content="Sources of information about time zones and daylight saving time">
<meta name="DC.Identifier"
@@ -394,12 +394,15 @@ but the maps are more up to date.</li>
</ul>
<h2>Time zone boundaries</h2>
<ul>
-<li><a href="http://efele.net/maps/tz/">TZ timezone maps</a> contains a <a
-href="http://en.wikipedia.org/wiki/Shapefile">shapefile</a> of the
-<code>tz</code> regions in the world.</li>
-<li><a href="http://statoids.com/statoids.html">Administrative Divisions
-of Countries ("Statoids")</a> contains detailed lists of
-<code>tz</code>-related zone subdivision data.</li>
+<li><a href="http://efele.net/maps/tz/">TZ timezones maps</a> contains <a
+href="http://en.wikipedia.org/wiki/Shapefile">shapefiles</a> of
+sets of <code>tz</code> regions.</li>
+<li><a href="http://derickrethans.nl/what-time-is-it.html">What Time
+is It Here?</a> applies <a href="http://www.mongodb.org/">MongoDB</a>
+geospatial query operators to shapefiles' data.</li>
+<li><a href="http://statoids.com/statoids.html">Administrative
+Divisions of Countries ("Statoids")</a> contains lists of
+political subdivision data related to time zones.</li>
<li><a href="http://home.tiscali.nl/~t876506/Multizones.html">Time
zone boundaries for multizone countries</a> summarizes legal
boundaries between time zones within countries.</li>
diff --git a/elsie.nci.nih.gov/src/tzfile.5 b/elsie.nci.nih.gov/src/tzfile.5
index 10698a2..69b9e8b 100644
--- a/elsie.nci.nih.gov/src/tzfile.5
+++ b/elsie.nci.nih.gov/src/tzfile.5
@@ -10,17 +10,16 @@ The time zone information files used by
begin with the magic characters "TZif" to identify them as
time zone information files,
followed by a character identifying the version of the file's format
-(as of 2005, either an ASCII NUL or a '2')
+(as of 2013, either an ASCII NUL, or '2', or '3')
followed by fifteen bytes containing zeroes reserved for future use,
-followed by six four-byte values of type
-.BR long ,
-written in a ``standard'' byte order
+followed by six four-byte integer values
+written in a "standard" byte order
(the high-order byte of the value is written first).
These values are,
in order:
.TP
.I tzh_ttisgmtcnt
-The number of UTC/local indicators stored in the file.
+The number of UT/local indicators stored in the file.
.TP
.I tzh_ttisstdcnt
The number of standard/wall indicators stored in the file.
@@ -42,18 +41,15 @@ stored in the file.
.PP
The above header is followed by
.I tzh_timecnt
-four-byte values of type
-.BR long ,
-sorted in ascending order.
-These values are written in ``standard'' byte order.
+four-byte signed integer values sorted in ascending order.
+These values are written in "standard" byte order.
Each is used as a transition time (as returned by
.IR time (2))
at which the rules for computing local time change.
Next come
.I tzh_timecnt
-one-byte values of type
-.BR "unsigned char" ;
-each one tells which of the different types of ``local time'' types
+one-byte unsigned integer values;
+each one tells which of the different types of "local time" types
described in the file is associated with the same-indexed transition time.
These values serve as indices into an array of
.I ttinfo
@@ -64,26 +60,24 @@ these structures are defined as follows:
.in +.5i
.sp
.nf
-.ta .5i +\w'unsigned int\0\0'u
+.ta .5i +\w'unsigned char\0\0'u
struct ttinfo {
- long tt_gmtoff;
- int tt_isdst;
- unsigned int tt_abbrind;
+ int32_t tt_gmtoff;
+ unsigned char tt_isdst;
+ unsigned char tt_abbrind;
};
.in -.5i
.fi
.sp
-Each structure is written as a four-byte value for
-.I tt_gmtoff
-of type
-.BR long ,
+Each structure is written as a four-byte signed integer value for
+.IR tt_gmtoff ,
in a standard byte order, followed by a one-byte value for
.I tt_isdst
and a one-byte value for
.IR tt_abbrind .
In each structure,
.I tt_gmtoff
-gives the number of seconds to be added to UTC,
+gives the number of seconds to be added to UT,
.I tt_isdst
tells whether
.I tm_isdst
@@ -118,9 +112,9 @@ time zone environment variables.
.PP
Finally there are
.I tzh_ttisgmtcnt
-UTC/local indicators, each stored as a one-byte value;
+UT/local indicators, each stored as a one-byte value;
they tell whether the transition times associated with local time types
-were specified as UTC or local time,
+were specified as UT or local time,
and are used when a time zone file is used in handling POSIX-style
time zone environment variables.
.PP
@@ -145,7 +139,18 @@ POSIX-TZ-environment-variable-style string for use in handling instants
after the last transition time stored in the file
(with nothing between the newlines if there is no POSIX representation for
such instants).
+.PP
+For version-3-format time zone files, the POSIX-TZ-style string may
+use two minor extensions to the POSIX TZ format, as described in
+.IR newtzset (3).
+First, the hours part of its transition times may be signed and range from
+\(mi167 through 167 instead of the POSIX-required unsigned values
+from 0 through 24. Second, DST is in effect all year if it starts
+January 1 at 00:00 and ends December 31 at 24:00 plus the difference
+between daylight saving and standard time.
+.PP
+Future changes to the format may append more data.
.SH SEE ALSO
-newctime(3)
+newctime(3), newtzset(3), zdump(8), zic(8)
.\" This file is in the public domain, so clarified as of
.\" 1996-06-05 by Arthur David Olson.
diff --git a/elsie.nci.nih.gov/src/tzfile.5.txt b/elsie.nci.nih.gov/src/tzfile.5.txt
index def7839..40ec6d8 100644
--- a/elsie.nci.nih.gov/src/tzfile.5.txt
+++ b/elsie.nci.nih.gov/src/tzfile.5.txt
@@ -10,13 +10,13 @@ DESCRIPTION
The time zone information files used by tzset(3) begin with the magic
characters "TZif" to identify them as time zone information files,
followed by a character identifying the version of the file's format
- (as of 2005, either an ASCII NUL or a '2') followed by fifteen bytes
- containing zeroes reserved for future use, followed by six four-byte
- values of type long, written in a ``standard'' byte order (the high-
- order byte of the value is written first). These values are, in order:
+ (as of 2013, either an ASCII NUL, or '2', or '3') followed by fifteen
+ bytes containing zeroes reserved for future use, followed by six four-
+ byte integer values written in a "standard" byte order (the high-order
+ byte of the value is written first). These values are, in order:
tzh_ttisgmtcnt
- The number of UTC/local indicators stored in the file.
+ The number of UT/local indicators stored in the file.
tzh_ttisstdcnt
The number of standard/wall indicators stored in the file.
@@ -36,30 +36,30 @@ DESCRIPTION
The number of characters of "time zone abbreviation strings"
stored in the file.
- The above header is followed by tzh_timecnt four-byte values of type
- long, sorted in ascending order. These values are written in
- ``standard'' byte order. Each is used as a transition time (as
- returned by time(2)) at which the rules for computing local time
- change. Next come tzh_timecnt one-byte values of type unsigned char;
- each one tells which of the different types of ``local time'' types
- described in the file is associated with the same-indexed transition
- time. These values serve as indices into an array of ttinfo structures
- (with tzh_typecnt entries) that appears next in the file; these
- structures are defined as follows:
+ The above header is followed by tzh_timecnt four-byte signed integer
+ values sorted in ascending order. These values are written in
+ "standard" byte order. Each is used as a transition time (as returned
+ by time(2)) at which the rules for computing local time change. Next
+ come tzh_timecnt one-byte unsigned integer values; each one tells which
+ of the different types of "local time" types described in the file is
+ associated with the same-indexed transition time. These values serve
+ as indices into an array of ttinfo structures (with tzh_typecnt
+ entries) that appears next in the file; these structures are defined as
+ follows:
struct ttinfo {
- long tt_gmtoff;
- int tt_isdst;
- unsigned int tt_abbrind;
+ int32_t tt_gmtoff;
+ unsigned char tt_isdst;
+ unsigned char tt_abbrind;
};
- Each structure is written as a four-byte value for tt_gmtoff of type
- long, in a standard byte order, followed by a one-byte value for
+ Each structure is written as a four-byte signed integer value for
+ tt_gmtoff, in a standard byte order, followed by a one-byte value for
tt_isdst and a one-byte value for tt_abbrind. In each structure,
- tt_gmtoff gives the number of seconds to be added to UTC, tt_isdst
- tells whether tm_isdst should be set by localtime (3) and tt_abbrind
- serves as an index into the array of time zone abbreviation characters
- that follow the ttinfo structure(s) in the file.
+ tt_gmtoff gives the number of seconds to be added to UT, tt_isdst tells
+ whether tm_isdst should be set by localtime (3) and tt_abbrind serves
+ as an index into the array of time zone abbreviation characters that
+ follow the ttinfo structure(s) in the file.
Then there are tzh_leapcnt pairs of four-byte values, written in
standard byte order; the first value of each pair gives the time (as
@@ -73,9 +73,9 @@ DESCRIPTION
time, and are used when a time zone file is used in handling POSIX-
style time zone environment variables.
- Finally there are tzh_ttisgmtcnt UTC/local indicators, each stored as a
+ Finally there are tzh_ttisgmtcnt UT/local indicators, each stored as a
one-byte value; they tell whether the transition times associated with
- local time types were specified as UTC or local time, and are used when
+ local time types were specified as UT or local time, and are used when
a time zone file is used in handling POSIX-style time zone environment
variables.
@@ -92,7 +92,17 @@ DESCRIPTION
the last transition time stored in the file (with nothing between the
newlines if there is no POSIX representation for such instants).
+ For version-3-format time zone files, the POSIX-TZ-style string may use
+ two minor extensions to the POSIX TZ format, as described in
+ newtzset(3). First, the hours part of its transition times may be
+ signed and range from -167 through 167 instead of the POSIX-required
+ unsigned values from 0 through 24. Second, DST is in effect all year
+ if it starts January 1 at 00:00 and ends December 31 at 24:00 plus the
+ difference between daylight saving and standard time.
+
+ Future changes to the format may append more data.
+
SEE ALSO
- newctime(3)
+ newctime(3), newtzset(3), zdump(8), zic(8)
TZFILE(5)
diff --git a/elsie.nci.nih.gov/src/tzfile.h b/elsie.nci.nih.gov/src/tzfile.h
index d04fe04..a2955dd 100644
--- a/elsie.nci.nih.gov/src/tzfile.h
+++ b/elsie.nci.nih.gov/src/tzfile.h
@@ -39,7 +39,7 @@
struct tzhead {
char tzh_magic[4]; /* TZ_MAGIC */
- char tzh_version[1]; /* '\0' or '2' as of 2005 */
+ char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
char tzh_reserved[15]; /* reserved--must be zero */
char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
@@ -55,7 +55,7 @@ struct tzhead {
** tzh_timecnt (char [4])s coded transition times a la time(2)
** tzh_timecnt (unsigned char)s types of local time starting at above
** tzh_typecnt repetitions of
-** one (char [4]) coded UTC offset in seconds
+** one (char [4]) coded UT offset in seconds
** one (unsigned char) used to set tm_isdst
** one (unsigned char) that's an abbreviation list index
** tzh_charcnt (char)s '\0'-terminated zone abbreviations
@@ -68,7 +68,7 @@ struct tzhead {
** if absent, transition times are
** assumed to be wall clock time
** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition
-** time is UTC, if FALSE,
+** time is UT, if FALSE,
** transition time is local time
** if absent, transition times are
** assumed to be local time
@@ -82,6 +82,13 @@ struct tzhead {
** instants after the last transition time stored in the file
** (with nothing between the newlines if there is no POSIX representation for
** such instants).
+**
+** If tz_version is '3' or greater, the above is extended as follows.
+** First, the POSIX TZ string's hour offset may range from -167
+** through 167 as compared to the POSIX-required 0 through 24.
+** Second, its DST start time may be January 1 at 00:00 and its stop
+** time December 31 at 24:00 plus the difference between DST and
+** standard time, indicating DST all year.
*/
/*
diff --git a/elsie.nci.nih.gov/src/tzselect.8 b/elsie.nci.nih.gov/src/tzselect.8
index 0d02590..1dd721a 100644
--- a/elsie.nci.nih.gov/src/tzselect.8
+++ b/elsie.nci.nih.gov/src/tzselect.8
@@ -3,6 +3,17 @@
tzselect \- select a time zone
.SH SYNOPSIS
.B tzselect
+[
+.B \-c
+.I coord
+] [
+.B \-n
+.I limit
+] [
+.B \-\-help
+] [
+.B \-\-version
+]
.SH DESCRIPTION
The
.B tzselect
@@ -11,6 +22,65 @@ and outputs the resulting time zone description to standard output.
The output is suitable as a value for the TZ environment variable.
.PP
All interaction with the user is done via standard input and standard error.
+.SH OPTIONS
+.TP
+.BI "\-c " coord
+Instead of asking for continent and then country and then city,
+ask for selection from time zones whose largest cities
+are closest to the location with geographical coordinates
+.I coord.
+Use ISO 6709 notation for
+.I coord,
+that is, a latitude immediately followed by a longitude. The latitude
+and longitude should be signed integers followed by an optional
+decimal point and fraction: positive numbers represent north and east,
+negative south and west. Latitudes with two and longitudes with three
+integer digits are treated as degrees; latitudes with four or six and
+longitudes with five or seven integer digits are treated as
+.I "DDMM, DDDMM, DDMMSS,"
+or
+.I DDDMMSS
+representing
+.I DD
+or
+.I DDD
+degrees,
+.I MM
+minutes,
+and zero or
+.I SS
+seconds, with any trailing fractions represent fractional minutes or
+(if
+.I SS
+is present) seconds. The decimal point is that of the current locale.
+For example, in the (default) C locale,
+.B "\-c\ +40.689\-074.045"
+specifies 40.689\(de\|N, 74.045\(de\|W,
+.B "\-c\ +4041.4\-07402.7"
+specifies 40\(de\|41.4\(fm\|N, 74\(de\|2.7\(fm\|W, and
+.B "\-c\ +404121\-0740240"
+specifies 40\(de\|41\(fm\|21\(sd\|N, 74\(de\|2\(fm\|40\(sd\|W.
+If
+.I coord
+is not one of the documented forms, the resulting behavior is unspecified.
+.TP
+.BI "\-n " limit
+When
+.B \-c
+is used, display the closest
+.I limit
+locations (default 10).
+.PP
+Applications should not assume that
+.BR tzselect 's
+output matches the user's political preferences.
+.RE
+.TP
+.B "\-\-help"
+Output help information and exit.
+.TP
+.B "\-\-version"
+Output version information and exit.
.SH "ENVIRONMENT VARIABLES"
.TP
\f3AWK\fP
@@ -28,7 +98,7 @@ Name of the directory containing time zone data files (default:
Table of ISO 3166 2-letter country codes and country names.
.TP
\f2TZDIR\fP\f3/zone.tab\fP
-Table of country codes, latitude and longitude, TZ values, and
+Tables of country codes, latitude and longitude, zone names, and
descriptive comments.
.TP
\f2TZDIR\fP\f3/\fP\f2TZ\fP
diff --git a/elsie.nci.nih.gov/src/tzselect.8.txt b/elsie.nci.nih.gov/src/tzselect.8.txt
index e56ceae..6d39ea2 100644
--- a/elsie.nci.nih.gov/src/tzselect.8.txt
+++ b/elsie.nci.nih.gov/src/tzselect.8.txt
@@ -4,7 +4,7 @@ NAME
tzselect - select a time zone
SYNOPSIS
- tzselect
+ tzselect [ -c coord ] [ -n limit ] [ --help ] [ --version ]
DESCRIPTION
The tzselect program asks the user for information about the current
@@ -15,6 +15,41 @@ DESCRIPTION
All interaction with the user is done via standard input and standard
error.
+OPTIONS
+ -c coord
+ Instead of asking for continent and then country and then city,
+ ask for selection from time zones whose largest cities are
+ closest to the location with geographical coordinates coord.
+ Use ISO 6709 notation for coord, that is, a latitude immediately
+ followed by a longitude. The latitude and longitude should be
+ signed integers followed by an optional decimal point and
+ fraction: positive numbers represent north and east, negative
+ south and west. Latitudes with two and longitudes with three
+ integer digits are treated as degrees; latitudes with four or
+ six and longitudes with five or seven integer digits are treated
+ as DDMM, DDDMM, DDMMSS, or DDDMMSS representing DD or DDD
+ degrees, MM minutes, and zero or SS seconds, with any trailing
+ fractions represent fractional minutes or (if SS is present)
+ seconds. The decimal point is that of the current locale. For
+ example, in the (default) C locale, -c +40.689-074.045 specifies
+ 40.689oN, 74.045oW, -c +4041.4-07402.7 specifies 40o41.4'N,
+ 74o2.7'W, and -c +404121-0740240 specifies 40o41'21''N,
+ 74o2'40''W. If coord is not one of the documented forms, the
+ resulting behavior is unspecified.
+
+ -n limit
+ When -c is used, display the closest limit locations (default
+ 10).
+
+ Applications should not assume that tzselect's output matches the
+ user's political preferences.
+
+--help
+Output help information and exit.
+
+--version
+Output version information and exit.
+
ENVIRONMENT VARIABLES
AWK Name of a Posix-compliant awk program (default: awk).
@@ -26,7 +61,7 @@ FILES
Table of ISO 3166 2-letter country codes and country names.
TZDIR/zone.tab
- Table of country codes, latitude and longitude, TZ values, and
+ Tables of country codes, latitude and longitude, zone names, and
descriptive comments.
TZDIR/TZ
diff --git a/elsie.nci.nih.gov/src/tzselect.ksh b/elsie.nci.nih.gov/src/tzselect.ksh
index 8e66b44..1934dd0 100644
--- a/elsie.nci.nih.gov/src/tzselect.ksh
+++ b/elsie.nci.nih.gov/src/tzselect.ksh
@@ -40,20 +40,56 @@ REPORT_BUGS_TO=tz@iana.org
exit 1
}
-if [ "$1" = "--help" ]; then
- cat <<EOF
-Usage: tzselect
+coord=
+location_limit=10
+
+usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT]
Select a time zone interactively.
-Report bugs to $REPORT_BUGS_TO.
-EOF
- exit
-elif [ "$1" = "--version" ]; then
- cat <<EOF
-tzselect $PKGVERSION$TZVERSION
-EOF
- exit
-fi
+Options:
+
+ -c COORD
+ Instead of asking for continent and then country and then city,
+ ask for selection from time zones whose largest cities
+ are closest to the location with geographical coordinates COORD.
+ COORD should use ISO 6709 notation, for example, '-c +4852+00220'
+ for Paris (in degrees and minutes, North and East), or
+ '-c -35-058' for Buenos Aires (in degrees, South and West).
+
+ -n LIMIT
+ Display at most LIMIT locations when -c is used (default $location_limit).
+
+ --version
+ Output version information.
+
+ --help
+ Output this help.
+
+Report bugs to $REPORT_BUGS_TO."
+
+while getopts c:n:-: opt
+do
+ case $opt$OPTARG in
+ c*)
+ coord=$OPTARG ;;
+ n*)
+ location_limit=$OPTARG ;;
+ -help)
+ exec echo "$usage" ;;
+ -version)
+ exec echo "tzselect $PKGVERSION$TZVERSION" ;;
+ -*)
+ echo >&2 "$0: -$opt$OPTARG: unknown option; try '$0 --help'"; exit 1 ;;
+ *)
+ echo >&2 "$0: try '$0 --help'"; exit 1 ;;
+ esac
+done
+
+shift $((OPTIND-1))
+case $# in
+0) ;;
+*) echo >&2 "$0: $1: unknown argument"; exit 1 ;;
+esac
# Make sure the tables are readable.
TZ_COUNTRY_TABLE=$TZDIR/iso3166.tab
@@ -76,6 +112,65 @@ case $(echo 1 | (select x in x; do break; done) 2>/dev/null) in
?*) PS3=
esac
+# Awk script to read a time zone table and output the same table,
+# with each column preceded by its distance from 'here'.
+output_distances='
+ BEGIN {
+ FS = "\t"
+ while (getline <TZ_COUNTRY_TABLE)
+ if ($0 ~ /^[^#]/)
+ country[$1] = $2
+ country["US"] = "US" # Otherwise the strings get too long.
+ }
+ function convert_coord(coord, deg, min, ilen, sign, sec) {
+ if (coord ~ /^[-+]?[0-9]?[0-9][0-9][0-9][0-9][0-9][0-9]([^0-9]|$)/) {
+ degminsec = coord
+ intdeg = degminsec < 0 ? -int(-degminsec / 10000) : int(degminsec / 10000)
+ minsec = degminsec - intdeg * 10000
+ intmin = minsec < 0 ? -int(-minsec / 100) : int(minsec / 100)
+ sec = minsec - intmin * 100
+ deg = (intdeg * 3600 + intmin * 60 + sec) / 3600
+ } else if (coord ~ /^[-+]?[0-9]?[0-9][0-9][0-9][0-9]([^0-9]|$)/) {
+ degmin = coord
+ intdeg = degmin < 0 ? -int(-degmin / 100) : int(degmin / 100)
+ min = degmin - intdeg * 100
+ deg = (intdeg * 60 + min) / 60
+ } else
+ deg = coord
+ return deg * 0.017453292519943296
+ }
+ function convert_latitude(coord) {
+ match(coord, /..*[-+]/)
+ return convert_coord(substr(coord, 1, RLENGTH - 1))
+ }
+ function convert_longitude(coord) {
+ match(coord, /..*[-+]/)
+ return convert_coord(substr(coord, RLENGTH))
+ }
+ # Great-circle distance between points with given latitude and longitude.
+ # Inputs and output are in radians. This uses the great-circle special
+ # case of the Vicenty formula for distances on ellipsoids.
+ function dist(lat1, long1, lat2, long2, dlong, x, y, num, denom) {
+ dlong = long2 - long1
+ x = cos (lat2) * sin (dlong)
+ y = cos (lat1) * sin (lat2) - sin (lat1) * cos (lat2) * cos (dlong)
+ num = sqrt (x * x + y * y)
+ denom = sin (lat1) * sin (lat2) + cos (lat1) * cos (lat2) * cos (dlong)
+ return atan2(num, denom)
+ }
+ BEGIN {
+ coord_lat = convert_latitude(coord)
+ coord_long = convert_longitude(coord)
+ }
+ /^[^#]/ {
+ here_lat = convert_latitude($2)
+ here_long = convert_longitude($2)
+ line = $1 "\t" $2 "\t" $3 "\t" country[$1]
+ if (NF == 4)
+ line = line " - " $4
+ printf "%g\t%s\n", dist(coord_lat, coord_long, here_lat, here_long), line
+ }
+'
# Begin the main loop. We come back here if the user wants to retry.
while
@@ -87,39 +182,54 @@ while
country=
region=
+ case $coord in
+ ?*)
+ continent=coord;;
+ '')
# Ask the user for continent or ocean.
- echo >&2 'Please select a continent or ocean.'
-
- select continent in \
- Africa \
- Americas \
- Antarctica \
- 'Arctic Ocean' \
- Asia \
- 'Atlantic Ocean' \
- Australia \
- Europe \
- 'Indian Ocean' \
- 'Pacific Ocean' \
- 'none - I want to specify the time zone using the Posix TZ format.'
- do
- case $continent in
- '')
- echo >&2 'Please enter a number in range.';;
- ?*)
+ echo >&2 'Please select a continent, ocean, "coord", or "TZ".'
+
+ quoted_continents=$(
+ $AWK -F'\t' '
+ /^[^#]/ {
+ entry = substr($3, 1, index($3, "/") - 1)
+ if (entry == "America")
+ entry = entry "s"
+ if (entry ~ /^(Arctic|Atlantic|Indian|Pacific)$/)
+ entry = entry " Ocean"
+ printf "'\''%s'\''\n", entry
+ }
+ ' $TZ_ZONE_TABLE |
+ sort -u |
+ tr '\n' ' '
+ echo ''
+ )
+
+ eval '
+ select continent in '"$quoted_continents"' \
+ "coord - I want to use geographical coordinates." \
+ "TZ - I want to specify the time zone using the Posix TZ format."
+ do
case $continent in
- Americas) continent=America;;
- *' '*) continent=$(expr "$continent" : '\([^ ]*\)')
+ "")
+ echo >&2 "Please enter a number in range.";;
+ ?*)
+ case $continent in
+ Americas) continent=America;;
+ *" "*) continent=$(expr "$continent" : '\''\([^ ]*\)'\'')
+ esac
+ break
esac
- break
- esac
- done
+ done
+ '
+ esac
+
case $continent in
'')
exit 1;;
- none)
+ TZ)
# Ask the user for a Posix TZ string. Check that it conforms.
while
echo >&2 'Please enter the desired value' \
@@ -144,6 +254,45 @@ while
done
TZ_for_date=$TZ;;
*)
+ case $continent in
+ coord)
+ case $coord in
+ '')
+ echo >&2 'Please enter coordinates' \
+ 'in ISO 6709 notation.'
+ echo >&2 'For example, +4042-07403 stands for'
+ echo >&2 '40 degrees 42 minutes north,' \
+ '74 degrees 3 minutes west.'
+ read coord;;
+ esac
+ distance_table=$($AWK \
+ -v coord="$coord" \
+ -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
+ "$output_distances" <$TZ_ZONE_TABLE |
+ sort -n |
+ sed "${location_limit}q"
+ )
+ regions=$(echo "$distance_table" | $AWK '
+ BEGIN { FS = "\t" }
+ { print $NF }
+ ')
+ echo >&2 'Please select one of the following' \
+ 'time zone regions,'
+ echo >&2 'listed roughly in increasing order' \
+ "of distance from $coord".
+ select region in $regions
+ do
+ case $region in
+ '') echo >&2 'Please enter a number in range.';;
+ ?*) break;;
+ esac
+ done
+ TZ=$(echo "$distance_table" | $AWK -v region="$region" '
+ BEGIN { FS="\t" }
+ $NF == region { print $4 }
+ ')
+ ;;
+ *)
# Get list of names of countries in the continent or ocean.
countries=$($AWK -F'\t' \
-v continent="$continent" \
@@ -171,7 +320,8 @@ while
# If there's more than one country, ask the user which one.
case $countries in
*"$newline"*)
- echo >&2 'Please select a country.'
+ echo >&2 'Please select a country' \
+ 'whose clocks agree with yours.'
select country in $countries
do
case $country in
@@ -242,6 +392,7 @@ while
}
$1 == cc && $4 == region { print $3 }
' <$TZ_ZONE_TABLE)
+ esac
# Make sure the corresponding zoneinfo file exists.
TZ_for_date=$TZDIR/$TZ
@@ -278,9 +429,11 @@ Universal Time is now: $UTdate."
echo >&2 ""
echo >&2 "The following information has been given:"
echo >&2 ""
- case $country+$region in
- ?*+?*) echo >&2 " $country$newline $region";;
- ?*+) echo >&2 " $country";;
+ case $country%$region%$coord in
+ ?*%?*%) echo >&2 " $country$newline $region";;
+ ?*%%) echo >&2 " $country";;
+ %?*%?*) echo >&2 " coord $coord$newline $region";;
+ %%?*) echo >&2 " coord $coord";;
+) echo >&2 " TZ='$TZ'"
esac
echo >&2 ""
@@ -299,7 +452,7 @@ Universal Time is now: $UTdate."
'') exit 1;;
Yes) break
esac
-do :
+do coord=
done
case $SHELL in
diff --git a/elsie.nci.nih.gov/src/zdump.8 b/elsie.nci.nih.gov/src/zdump.8
index f253e81..106361a 100644
--- a/elsie.nci.nih.gov/src/zdump.8
+++ b/elsie.nci.nih.gov/src/zdump.8
@@ -57,17 +57,18 @@ the program cuts off verbose output near the starts of the years \-500 and 2500.
Cut off verbose output at the start of the given time(s),
given in decimal seconds since 1970-01-01 00:00:00 UTC.
.SH LIMITATIONS
-The
-.B \-v
-and
-.B \-V
-options may not be used on systems with floating-point time_t values
-that are neither float nor double.
-.PP
Time discontinuities are found by sampling the results returned by localtime
at twelve-hour intervals.
This works in all real-world cases;
one can construct artificial time zones for which this fails.
+.PP
+In the output, "UT" denotes the value returned by
+.IR gmtime (3),
+which uses UTC for modern time stamps and some other UT flavor for
+time stamps that predate the introduction of UTC.
+No attempt is currently made to have the output use "UTC" for newer
+and "UT" for older time stamps,
+partly because the exact date of the introduction of UTC is problematic.
.SH "SEE ALSO"
newctime(3), tzfile(5), zic(8)
.\" This file is in the public domain, so clarified as of
diff --git a/elsie.nci.nih.gov/src/zdump.8.txt b/elsie.nci.nih.gov/src/zdump.8.txt
index bf961f9..f633a76 100644
--- a/elsie.nci.nih.gov/src/zdump.8.txt
+++ b/elsie.nci.nih.gov/src/zdump.8.txt
@@ -38,13 +38,17 @@ DESCRIPTION
in decimal seconds since 1970-01-01 00:00:00 UTC.
LIMITATIONS
- The -v and -V options may not be used on systems with floating-point
- time_t values that are neither float nor double.
-
Time discontinuities are found by sampling the results returned by
localtime at twelve-hour intervals. This works in all real-world
cases; one can construct artificial time zones for which this fails.
+ In the output, "UT" denotes the value returned by gmtime(3), which uses
+ UTC for modern time stamps and some other UT flavor for time stamps
+ that predate the introduction of UTC. No attempt is currently made to
+ have the output use "UTC" for newer and "UT" for older time stamps,
+ partly because the exact date of the introduction of UTC is
+ problematic.
+
SEE ALSO
newctime(3), tzfile(5), zic(8)
diff --git a/elsie.nci.nih.gov/src/zdump.c b/elsie.nci.nih.gov/src/zdump.c
index be0a496..2a9860c 100644
--- a/elsie.nci.nih.gov/src/zdump.c
+++ b/elsie.nci.nih.gov/src/zdump.c
@@ -23,7 +23,6 @@
#include "sys/types.h" /* for time_t */
#include "time.h" /* for struct tm */
#include "stdlib.h" /* for exit, malloc, atoi */
-#include "float.h" /* for FLT_MAX and DBL_MAX */
#include "limits.h" /* for CHAR_BIT, LLONG_MAX */
#include "ctype.h" /* for isalpha et al. */
#ifndef isascii
@@ -61,9 +60,15 @@ typedef int int_fast32_t;
# if defined LLONG_MAX || defined __LONG_LONG_MAX__
typedef long long intmax_t;
# define PRIdMAX "lld"
+# ifdef LLONG_MAX
+# define INTMAX_MAX LLONG_MAX
+# else
+# define INTMAX_MAX __LONG_LONG_MAX__
+# endif
# else
typedef long intmax_t;
# define PRIdMAX "ld"
+# define INTMAX_MAX LONG_MAX
# endif
#endif
#ifndef SCNdMAX
@@ -141,6 +146,17 @@ typedef long intmax_t;
#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
#define SECSPERNYEAR (SECSPERDAY * DAYSPERNYEAR)
#define SECSPERLYEAR (SECSPERNYEAR + SECSPERDAY)
+#define SECSPER400YEARS (SECSPERNYEAR * (intmax_t) (300 + 3) \
+ + SECSPERLYEAR * (intmax_t) (100 - 3))
+
+/*
+** True if SECSPER400YEARS is known to be representable as an
+** intmax_t. It's OK that SECSPER400YEARS_FITS can in theory be false
+** even if SECSPER400YEARS is representable, because when that happens
+** the code merely runs a bit more slowly, and this slowness doesn't
+** occur on any practical platform.
+*/
+enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX / 400 };
#ifndef HAVE_GETTEXT
#define HAVE_GETTEXT 0
@@ -193,26 +209,12 @@ extern char * tzname[2];
/* The minimum and maximum finite time values. */
static time_t const absolute_min_time =
- ((time_t) 0.5 == 0.5
- ? (sizeof (time_t) == sizeof (float) ? (time_t) -FLT_MAX
- : sizeof (time_t) == sizeof (double) ? (time_t) -DBL_MAX
- : sizeof (time_t) == sizeof (long double) ? (time_t) -LDBL_MAX
- : 0)
-#ifndef TIME_T_FLOATING
- : (time_t) -1 < 0
+ ((time_t) -1 < 0
? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
-#endif
: 0);
static time_t const absolute_max_time =
- ((time_t) 0.5 == 0.5
- ? (sizeof (time_t) == sizeof (float) ? (time_t) FLT_MAX
- : sizeof (time_t) == sizeof (double) ? (time_t) DBL_MAX
- : sizeof (time_t) == sizeof (long double) ? (time_t) LDBL_MAX
- : -1)
-#ifndef TIME_T_FLOATING
- : (time_t) -1 < 0
+ ((time_t) -1 < 0
? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
-#endif
: -1);
static size_t longest;
static char * progname;
@@ -223,7 +225,6 @@ static void abbrok(const char * abbrp, const char * zone);
static intmax_t delta(struct tm * newp, struct tm * oldp) ATTRIBUTE_PURE;
static void dumptime(const struct tm * tmp);
static time_t hunt(char * name, time_t lot, time_t hit);
-static void checkabsolutes(void);
static void show(char * zone, time_t t, int v);
static const char * tformat(void);
static time_t yeartot(intmax_t y) ATTRIBUTE_PURE;
@@ -243,7 +244,7 @@ my_localtime(time_t *tp)
tm = *tmp;
t = mktime(&tm);
- if (t - *tp >= 1 || *tp - t >= 1) {
+ if (t != *tp) {
(void) fflush(stdout);
(void) fprintf(stderr, "\n%s: ", progname);
(void) fprintf(stderr, tformat(), *tp);
@@ -383,7 +384,6 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
}
- checkabsolutes();
if (cutarg != NULL || cuttimes == NULL) {
cutlotime = yeartot(cutloyear);
cuthitime = yeartot(cuthiyear);
@@ -452,7 +452,7 @@ main(int argc, char *argv[])
t = absolute_min_time;
if (!Vflag) {
show(argv[i], t, TRUE);
- t += SECSPERHOUR * HOURSPERDAY;
+ t += SECSPERDAY;
show(argv[i], t, TRUE);
}
if (t < cutlotime)
@@ -463,9 +463,11 @@ main(int argc, char *argv[])
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
}
for ( ; ; ) {
- if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12)
+ newt = (t < absolute_max_time - SECSPERDAY / 2
+ ? t + SECSPERDAY / 2
+ : absolute_max_time);
+ if (cuthitime <= newt)
break;
- newt = t + SECSPERHOUR * 12;
newtmp = localtime(&newt);
if (newtmp != NULL)
newtm = *newtmp;
@@ -488,9 +490,9 @@ main(int argc, char *argv[])
}
if (!Vflag) {
t = absolute_max_time;
- t -= SECSPERHOUR * HOURSPERDAY;
+ t -= SECSPERDAY;
show(argv[i], t, TRUE);
- t += SECSPERHOUR * HOURSPERDAY;
+ t += SECSPERDAY;
show(argv[i], t, TRUE);
}
}
@@ -504,44 +506,45 @@ main(int argc, char *argv[])
return EXIT_FAILURE;
}
-static void
-checkabsolutes(void)
-{
- if (absolute_max_time < absolute_min_time) {
- (void) fprintf(stderr,
-_("%s: use of -v on system with floating time_t other than float or double\n"),
- progname);
- exit(EXIT_FAILURE);
- }
-}
-
static time_t
yeartot(const intmax_t y)
{
- register intmax_t myy;
- register int_fast32_t seconds;
+ register intmax_t myy, seconds, years;
register time_t t;
myy = EPOCH_YEAR;
t = 0;
- while (myy != y) {
- if (myy < y) {
+ while (myy < y) {
+ if (SECSPER400YEARS_FITS && 400 <= y - myy) {
+ intmax_t diff400 = (y - myy) / 400;
+ if (INTMAX_MAX / SECSPER400YEARS < diff400)
+ return absolute_max_time;
+ seconds = diff400 * SECSPER400YEARS;
+ years = diff400 * 400;
+ } else {
seconds = isleap(myy) ? SECSPERLYEAR : SECSPERNYEAR;
- ++myy;
- if (t > absolute_max_time - seconds) {
- t = absolute_max_time;
- break;
- }
- t += seconds;
+ years = 1;
+ }
+ myy += years;
+ if (t > absolute_max_time - seconds)
+ return absolute_max_time;
+ t += seconds;
+ }
+ while (y < myy) {
+ if (SECSPER400YEARS_FITS && y + 400 <= myy && myy < 0) {
+ intmax_t diff400 = (myy - y) / 400;
+ if (INTMAX_MAX / SECSPER400YEARS < diff400)
+ return absolute_min_time;
+ seconds = diff400 * SECSPER400YEARS;
+ years = diff400 * 400;
} else {
- --myy;
- seconds = isleap(myy) ? SECSPERLYEAR : SECSPERNYEAR;
- if (t < absolute_min_time + seconds) {
- t = absolute_min_time;
- break;
- }
- t -= seconds;
+ seconds = isleap(myy - 1) ? SECSPERLYEAR : SECSPERNYEAR;
+ years = 1;
}
+ myy -= years;
+ if (t < absolute_min_time + seconds)
+ return absolute_min_time;
+ t -= seconds;
}
return t;
}
@@ -625,7 +628,7 @@ show(char *zone, time_t t, int v)
(void) printf(tformat(), t);
} else {
dumptime(tmp);
- (void) printf(" UTC");
+ (void) printf(" UT");
}
(void) printf(" = ");
}
@@ -666,11 +669,6 @@ abbr(struct tm *tmp)
static const char *
tformat(void)
{
- if (0.5 == (time_t) 0.5) { /* floating */
- if (sizeof (time_t) > sizeof (double))
- return "%Lg";
- return "%g";
- }
if (0 > (time_t) -1) { /* signed */
if (sizeof (time_t) == sizeof (intmax_t))
return "%"PRIdMAX;
diff --git a/elsie.nci.nih.gov/src/zic.8 b/elsie.nci.nih.gov/src/zic.8
index d61555e..ca29fd1 100644
--- a/elsie.nci.nih.gov/src/zic.8
+++ b/elsie.nci.nih.gov/src/zic.8
@@ -77,14 +77,42 @@ If this option is not used,
no leap second information appears in output files.
.TP
.B \-v
-Complain if a year that appears in a data file is outside the range
+Be more verbose, and complain about the following situations:
+.RS
+.PP
+The input data specifies a link to a link.
+.PP
+A year that appears in a data file is outside the range
of years representable by
.IR time (2)
values.
-Also complain if a time of 24:00
-(which cannot be handled by pre-1998 versions of
-.IR zic )
-appears in the input.
+.PP
+A time of 24:00 or more appears in the input.
+Pre-1998 versions of
+.I zic
+prohibit 24:00, and pre-2007 versions prohibit times greater than 24:00.
+.PP
+A rule goes past the start or end of the month.
+Pre-2004 versions of
+.I zic
+prohibit this.
+.PP
+The output file does not contain all the information about the
+long-term future of a zone, because the future cannot be summarized as
+an extended POSIX TZ string. For example, as of 2013 this problem
+occurs for Iran's daylight-saving rules for the predicted future, as
+these rules are based on the Iranian calendar, which cannot be
+represented.
+.PP
+The output contains data that may not be handled properly by client
+code designed for older
+.I zic
+output formats. These compatibility issues affect only time stamps
+before 1970 or after the start of 2038.
+.PP
+A time zone abbreviation has fewer than 3 characters.
+POSIX requires at least 3.
+.RE
.TP
.B \-s
Limit time values stored in output files to values that are the same
@@ -99,7 +127,7 @@ rather than
when checking year types (see below).
.PP
Input lines are made up of fields.
-Fields are separated from one another by any number of white space characters.
+Fields are separated from one another by one or more white space characters.
Leading and trailing white space on input lines is ignored.
An unquoted sharp character (#) in the input introduces a comment which extends
to the end of the line the sharp character appears on.
@@ -288,13 +316,13 @@ This is the name used in creating the time conversion information file for the
zone.
.TP
.B GMTOFF
-The amount of time to add to UTC to get standard time in this zone.
+The amount of time to add to UT to get standard time in this zone.
This field has the same format as the
.B AT
and
.B SAVE
fields of rule lines;
-begin the field with a minus sign if time must be subtracted from UTC.
+begin the field with a minus sign if time must be subtracted from UT.
.TP
.B RULES/SAVE
The name of the rule(s) that apply in the time zone or,
@@ -315,10 +343,10 @@ a slash (/)
separates standard and daylight abbreviations.
.TP
.B UNTILYEAR [MONTH [DAY [TIME]]]
-The time at which the UTC offset or the rule(s) change for a location.
+The time at which the UT offset or the rule(s) change for a location.
It is specified as a year, a month, a day, and a time of day.
If this is specified,
-the time zone information is generated from the given UTC offset
+the time zone information is generated from the given UT offset
and rule change until the time specified.
The month, day, and time of day have the same format as the IN, ON, and AT
fields of a rule; trailing fields can be omitted, and default to the
@@ -362,6 +390,9 @@ field is used as an alternate name for that zone.
.PP
Except for continuation lines,
lines may appear in any order in the input.
+However, the behavior is unspecified if multiple zone or link lines
+define the same name, or if the source of one link line is the target
+of another.
.PP
Lines in the file that describes leap seconds have the following form:
.nf
@@ -425,10 +456,8 @@ input, intended to illustrate many of its features.
.ta \w'# Rule\0\0'u +\w'NAME\0\0'u +\w'FROM\0\0'u +\w'1973\0\0'u +\w'TYPE\0\0'u +\w'Apr\0\0'u +\w'lastSun\0\0'u +\w'2:00\0\0'u +\w'SAVE\0\0'u
.sp
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
-Rule Swiss 1940 only - Nov 2 0:00 1:00 S
-Rule Swiss 1940 only - Dec 31 0:00 0 -
-Rule Swiss 1941 1942 - May Sun>=1 2:00 1:00 S
-Rule Swiss 1941 1942 - Oct Sun>=1 0:00 0
+Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S
+Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 -
.sp .5
Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S
Rule EU 1977 only - Sep lastSun 1:00u 0 -
@@ -437,10 +466,10 @@ Rule EU 1979 1995 - Sep lastSun 1:00u 0 -
Rule EU 1981 max - Mar lastSun 1:00u 1:00 S
Rule EU 1996 max - Oct lastSun 1:00u 0 -
.sp
-.ta \w'# Zone\0\0'u +\w'Europe/Zurich\0\0'u +\w'0:34:08\0\0'u +\w'RULES/SAVE\0\0'u +\w'FORMAT\0\0'u
-# Zone NAME GMTOFF RULES FORMAT UNTIL
-Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12
- 0:29:44 - BMT 1894 Jun
+.ta \w'# Zone\0\0'u +\w'Europe/Zurich\0\0'u +\w'GMTOFF\0\0'u +\w'RULES/SAVE\0\0'u +\w'FORMAT\0\0'u
+# Zone NAME GMTOFF RULES/SAVE FORMAT UNTIL
+Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16
+ 0:29:46 - BMT 1894 Jun
1:00 Swiss CE%sT 1981
1:00 EU CE%sT
.sp
@@ -449,17 +478,18 @@ Link Europe/Zurich Switzerland
.in
.fi
In this example, the zone is named Europe/Zurich but it has an alias
-as Switzerland. Zurich was 34 minutes and 8 seconds west of GMT until
-1848-09-12 at 00:00, when the offset changed to 29 minutes and 44
-seconds. After 1894-06-01 at 00:00 Swiss daylight saving rules (defined
-with lines beginning with "Rule Swiss") apply, and the GMT offset
+
+as Switzerland. This example says that Zurich was 34 minutes and 8
+seconds west of UT until 1853-07-16 at 00:00, when the legal offset
+was changed to 7\(de\|26\(fm\|22.50\(sd; although this works out to
+0:29:45.50, the input format cannot represent fractional seconds so it
+is rounded here. After 1894-06-01 at 00:00 Swiss daylight saving rules
+(defined with lines beginning with "Rule Swiss") apply, and the UT offset
became one hour. From 1981 to the present, EU daylight saving rules have
applied, and the UTC offset has remained at one hour.
.PP
-In 1940, daylight saving time applied from November 2 at 00:00 to
-December 31 at 00:00. In 1941 and 1942, daylight saving time applied
-from the first Sunday in May at 02:00 to the first Sunday in October
-at 00:00.
+In 1941 and 1942, daylight saving time applied from the first Monday
+in May at 01:00 to the first Monday in October at 02:00.
The pre-1981 EU daylight-saving rules have no effect
here, but are included for completeness. Since 1981, daylight
saving has begun on the last Sunday in March at 01:00 UTC.
@@ -482,9 +512,9 @@ If,
for a particular zone,
a clock advance caused by the start of daylight saving
coincides with and is equal to
-a clock retreat caused by a change in UTC offset,
+a clock retreat caused by a change in UT offset,
.IR zic
-produces a single transition to daylight saving at the new UTC offset
+produces a single transition to daylight saving at the new UT offset
(without any change in wall clock time).
To get separate transitions
use multiple zone continuation lines
diff --git a/elsie.nci.nih.gov/src/zic.8.txt b/elsie.nci.nih.gov/src/zic.8.txt
index 058185b..4a25ec2 100644
--- a/elsie.nci.nih.gov/src/zic.8.txt
+++ b/elsie.nci.nih.gov/src/zic.8.txt
@@ -40,10 +40,34 @@ DESCRIPTION
If this option is not used, no leap second information appears
in output files.
- -v Complain if a year that appears in a data file is outside the
- range of years representable by time(2) values. Also complain
- if a time of 24:00 (which cannot be handled by pre-1998 versions
- of zic) appears in the input.
+ -v Be more verbose, and complain about the following situations:
+
+ The input data specifies a link to a link.
+
+ A year that appears in a data file is outside the range of years
+ representable by time(2) values.
+
+ A time of 24:00 or more appears in the input. Pre-1998 versions
+ of zic prohibit 24:00, and pre-2007 versions prohibit times
+ greater than 24:00.
+
+ A rule goes past the start or end of the month. Pre-2004
+ versions of zic prohibit this.
+
+ The output file does not contain all the information about the
+ long-term future of a zone, because the future cannot be
+ summarized as an extended POSIX TZ string. For example, as of
+ 2013 this problem occurs for Iran's daylight-saving rules for
+ the predicted future, as these rules are based on the Iranian
+ calendar, which cannot be represented.
+
+ The output contains data that may not be handled properly by
+ client code designed for older zic output formats. These
+ compatibility issues affect only time stamps before 1970 or
+ after the start of 2038.
+
+ A time zone abbreviation has fewer than 3 characters. POSIX
+ requires at least 3.
-s Limit time values stored in output files to values that are the
same whether they're taken to be signed or unsigned. You can
@@ -54,7 +78,7 @@ DESCRIPTION
types (see below).
Input lines are made up of fields. Fields are separated from one
- another by any number of white space characters. Leading and trailing
+ another by one or more white space characters. Leading and trailing
white space on input lines is ignored. An unquoted sharp character (#)
in the input introduces a comment which extends to the end of the line
the sharp character appears on. White space characters and sharp
@@ -158,10 +182,10 @@ DESCRIPTION
time conversion information file for the zone.
GMTOFF
- The amount of time to add to UTC to get standard time in this
+ The amount of time to add to UT to get standard time in this
zone. This field has the same format as the AT and SAVE fields
of rule lines; begin the field with a minus sign if time must be
- subtracted from UTC.
+ subtracted from UT.
RULES/SAVE
The name of the rule(s) that apply in the time zone or,
@@ -176,14 +200,14 @@ DESCRIPTION
separates standard and daylight abbreviations.
UNTILYEAR [MONTH [DAY [TIME]]]
- The time at which the UTC offset or the rule(s) change for a
+ The time at which the UT offset or the rule(s) change for a
location. It is specified as a year, a month, a day, and a time
of day. If this is specified, the time zone information is
- generated from the given UTC offset and rule change until the
- time specified. The month, day, and time of day have the same
- format as the IN, ON, and AT fields of a rule; trailing fields
- can be omitted, and default to the earliest possible value for
- the missing fields.
+ generated from the given UT offset and rule change until the time
+ specified. The month, day, and time of day have the same format
+ as the IN, ON, and AT fields of a rule; trailing fields can be
+ omitted, and default to the earliest possible value for the
+ missing fields.
The next line must be a "continuation" line; this has the same
form as a zone line except that the string "Zone" and the name
@@ -206,7 +230,9 @@ DESCRIPTION
the LINK-TO field is used as an alternate name for that zone.
Except for continuation lines, lines may appear in any order in the
- input.
+ input. However, the behavior is unspecified if multiple zone or link
+ lines define the same name, or if the source of one link line is the
+ target of another.
Lines in the file that describes leap seconds have the following form:
@@ -229,10 +255,8 @@ EXTENDED EXAMPLE
of its features.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
- Rule Swiss 1940 only - Nov 2 0:00 1:00 S
- Rule Swiss 1940 only - Dec 31 0:00 0 -
- Rule Swiss 1941 1942 - May Sun>=1 2:00 1:00 S
- Rule Swiss 1941 1942 - Oct Sun>=1 0:00 0
+ Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S
+ Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 -
Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S
Rule EU 1977 only - Sep lastSun 1:00u 0 -
Rule EU 1978 only - Oct 1 1:00u 0 -
@@ -240,30 +264,32 @@ EXTENDED EXAMPLE
Rule EU 1981 max - Mar lastSun 1:00u 1:00 S
Rule EU 1996 max - Oct lastSun 1:00u 0 -
- # Zone NAME GMTOFF RULES FORMAT UNTIL
- Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12
- 0:29:44 - BMT 1894 Jun
- 1:00 Swiss CE%sT 1981
- 1:00 EU CE%sT
+ # Zone NAME GMTOFF RULES/SAVE FORMAT UNTIL
+ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16
+ 0:29:46 - BMT 1894 Jun
+ 1:00 Swiss CE%sT 1981
+ 1:00 EU CE%sT
Link Europe/Zurich Switzerland
- In this example, the zone is named Europe/Zurich but it has an alias as
- Switzerland. Zurich was 34 minutes and 8 seconds west of GMT until
- 1848-09-12 at 00:00, when the offset changed to 29 minutes and 44
- seconds. After 1894-06-01 at 00:00 Swiss daylight saving rules
- (defined with lines beginning with "Rule Swiss") apply, and the GMT
- offset became one hour. From 1981 to the present, EU daylight saving
- rules have applied, and the UTC offset has remained at one hour.
-
- In 1940, daylight saving time applied from November 2 at 00:00 to
- December 31 at 00:00. In 1941 and 1942, daylight saving time applied
- from the first Sunday in May at 02:00 to the first Sunday in October at
- 00:00. The pre-1981 EU daylight-saving rules have no effect here, but
- are included for completeness. Since 1981, daylight saving has begun
- on the last Sunday in March at 01:00 UTC. Until 1995 it ended the last
- Sunday in September at 01:00 UTC, but this changed to the last Sunday
- in October starting in 1996.
+ In this example, the zone is named Europe/Zurich but it has an alias
+
+ as Switzerland. This example says that Zurich was 34 minutes and 8
+ seconds west of UT until 1853-07-16 at 00:00, when the legal offset was
+ changed to 7o26'22.50''; although this works out to 0:29:45.50, the
+ input format cannot represent fractional seconds so it is rounded here.
+ After 1894-06-01 at 00:00 Swiss daylight saving rules (defined with
+ lines beginning with "Rule Swiss") apply, and the UT offset became one
+ hour. From 1981 to the present, EU daylight saving rules have applied,
+ and the UTC offset has remained at one hour.
+
+ In 1941 and 1942, daylight saving time applied from the first Monday in
+ May at 01:00 to the first Monday in October at 02:00. The pre-1981 EU
+ daylight-saving rules have no effect here, but are included for
+ completeness. Since 1981, daylight saving has begun on the last Sunday
+ in March at 01:00 UTC. Until 1995 it ended the last Sunday in
+ September at 01:00 UTC, but this changed to the last Sunday in October
+ starting in 1996.
For purposes of display, "LMT" and "BMT" were initially used,
respectively. Since Swiss rules and later EU rules were applied, the
@@ -278,13 +304,13 @@ NOTES
If, for a particular zone, a clock advance caused by the start of
daylight saving coincides with and is equal to a clock retreat caused
- by a change in UTC offset, zic produces a single transition to daylight
- saving at the new UTC offset (without any change in wall clock time).
+ by a change in UT offset, zic produces a single transition to daylight
+ saving at the new UT offset (without any change in wall clock time).
To get separate transitions use multiple zone continuation lines
specifying transition instants using universal time.
FILE
- /usr/local/etc/zoneinfo standard directory used for created
+ /usr/local/etc/zoneinfo standard directory used for created
files
SEE ALSO
diff --git a/elsie.nci.nih.gov/src/zic.c b/elsie.nci.nih.gov/src/zic.c
index 1715c4a..7e231b5 100644
--- a/elsie.nci.nih.gov/src/zic.c
+++ b/elsie.nci.nih.gov/src/zic.c
@@ -8,7 +8,10 @@
#include "locale.h"
#include "tzfile.h"
-#define ZIC_VERSION '2'
+#include <stdarg.h>
+
+#define ZIC_VERSION_PRE_2013 '2'
+#define ZIC_VERSION '3'
typedef int_fast64_t zic_t;
#define ZIC_MIN INT_FAST64_MIN
@@ -389,16 +392,16 @@ eat(const char *const name, const int num)
eats(name, num, NULL, -1);
}
-static void
-error(const char *const string)
+static void ATTRIBUTE_FORMAT((printf, 1, 0))
+verror(const char *const string, va_list args)
{
/*
** Match the format of "cc" to allow sh users to
** zic ... 2>&1 | error -t "*" -v
** on BSD systems.
*/
- (void) fprintf(stderr, _("\"%s\", line %d: %s"),
- filename, linenum, string);
+ fprintf(stderr, _("\"%s\", line %d: "), filename, linenum);
+ vfprintf(stderr, string, args);
if (rfilename != NULL)
(void) fprintf(stderr, _(" (rule from \"%s\", line %d)"),
rfilename, rlinenum);
@@ -406,15 +409,23 @@ error(const char *const string)
++errors;
}
-static void
-warning(const char *const string)
+static void ATTRIBUTE_FORMAT((printf, 1, 2))
+error(const char *const string, ...)
{
- char * cp;
+ va_list args;
+ va_start(args, string);
+ verror(string, args);
+ va_end(args);
+}
- cp = ecpyalloc(_("warning: "));
- cp = ecatalloc(cp, string);
- error(cp);
- free(cp);
+static void ATTRIBUTE_FORMAT((printf, 1, 2))
+warning(const char *const string, ...)
+{
+ va_list args;
+ fprintf(stderr, _("warning: "));
+ va_start(args, string);
+ verror(string, args);
+ va_end(args);
--errors;
}
@@ -743,7 +754,7 @@ associate(void)
** a '%s' in the format is a bad thing.
*/
if (strchr(zp->z_format, '%') != 0)
- error(_("%s in ruleless zone"));
+ error("%s", _("%s in ruleless zone"));
}
}
if (errors)
@@ -873,13 +884,13 @@ gethms(const char *string, const char *const errstring, const int signable)
ss = 0;
else if (sscanf(string, scheck(string, "%"SCNdZIC":%d:%d"),
&hh, &mm, &ss) != 3) {
- error(errstring);
+ error("%s", errstring);
return 0;
}
if (hh < 0 ||
mm < 0 || mm >= MINSPERHOUR ||
ss < 0 || ss > SECSPERMIN) {
- error(errstring);
+ error("%s", errstring);
return 0;
}
if (ZIC_MAX / SECSPERHOUR < hh) {
@@ -925,40 +936,31 @@ static int
inzone(register char **const fields, const int nfields)
{
register int i;
- static char * buf;
if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS) {
error(_("wrong number of fields on Zone line"));
return FALSE;
}
if (strcmp(fields[ZF_NAME], TZDEFAULT) == 0 && lcltime != NULL) {
- buf = erealloc(buf, 132 + strlen(TZDEFAULT));
- (void) sprintf(buf,
+ error(
_("\"Zone %s\" line and -l option are mutually exclusive"),
TZDEFAULT);
- error(buf);
return FALSE;
}
if (strcmp(fields[ZF_NAME], TZDEFRULES) == 0 && psxrules != NULL) {
- buf = erealloc(buf, 132 + strlen(TZDEFRULES));
- (void) sprintf(buf,
+ error(
_("\"Zone %s\" line and -p option are mutually exclusive"),
TZDEFRULES);
- error(buf);
return FALSE;
}
for (i = 0; i < nzones; ++i)
if (zones[i].z_name != NULL &&
strcmp(zones[i].z_name, fields[ZF_NAME]) == 0) {
- buf = erealloc(buf,
- (132 + strlen(fields[ZF_NAME])
- + strlen(zones[i].z_filename)));
- (void) sprintf(buf,
+ error(
_("duplicate zone name %s (file \"%s\", line %d)"),
fields[ZF_NAME],
zones[i].z_filename,
zones[i].z_linenum);
- error(buf);
return FALSE;
}
return inzsub(fields, nfields, FALSE);
@@ -1005,7 +1007,7 @@ inzsub(register char **const fields, const int nfields, const int iscont)
}
z.z_filename = filename;
z.z_linenum = linenum;
- z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UTC offset"), TRUE);
+ z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UT offset"), TRUE);
if ((cp = strchr(fields[i_format], '%')) != 0) {
if (*++cp != 's' || strchr(cp, '%') != 0) {
error(_("invalid abbreviation format"));
@@ -1385,7 +1387,7 @@ is32(const zic_t x)
}
static void
-writezone(const char *const name, const char *const string)
+writezone(const char *const name, const char *const string, char version)
{
register FILE * fp;
register int i, j;
@@ -1638,7 +1640,7 @@ writezone(const char *const name, const char *const string)
#define DO(field) ((void) fwrite(tzh.field, sizeof tzh.field, 1, fp))
tzh = tzh0;
(void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
- tzh.tzh_version[0] = ZIC_VERSION;
+ tzh.tzh_version[0] = version;
convert(thistypecnt, tzh.tzh_ttisgmtcnt);
convert(thistypecnt, tzh.tzh_ttisstdcnt);
convert(thisleapcnt, tzh.tzh_leapcnt);
@@ -1776,7 +1778,7 @@ stringoffset(char *result, zic_t offset)
minutes = offset % MINSPERHOUR;
offset /= MINSPERHOUR;
hours = offset;
- if (hours > HOURSPERDAY) {
+ if (hours >= HOURSPERDAY * DAYSPERWEEK) {
result[0] = '\0';
return -1;
}
@@ -1793,7 +1795,8 @@ static int
stringrule(char *result, const struct rule *const rp, const zic_t dstoff,
const zic_t gmtoff)
{
- register zic_t tod;
+ register zic_t tod = rp->r_tod;
+ register int compat = 0;
result = end(result);
if (rp->r_dycode == DC_DOM) {
@@ -1804,44 +1807,76 @@ stringrule(char *result, const struct rule *const rp, const zic_t dstoff,
total = 0;
for (month = 0; month < rp->r_month; ++month)
total += len_months[0][month];
- (void) sprintf(result, "J%d", total + rp->r_dayofmonth);
+ /* Omit the "J" in Jan and Feb, as that's shorter. */
+ if (rp->r_month <= 1)
+ (void) sprintf(result, "%d", total + rp->r_dayofmonth - 1);
+ else
+ (void) sprintf(result, "J%d", total + rp->r_dayofmonth);
} else {
register int week;
+ register int wday = rp->r_wday;
+ register int wdayoff;
if (rp->r_dycode == DC_DOWGEQ) {
- if ((rp->r_dayofmonth % DAYSPERWEEK) != 1)
- return -1;
- week = 1 + rp->r_dayofmonth / DAYSPERWEEK;
+ wdayoff = (rp->r_dayofmonth - 1) % DAYSPERWEEK;
+ if (wdayoff)
+ compat = 2013;
+ wday -= wdayoff;
+ tod += wdayoff * SECSPERDAY;
+ week = 1 + (rp->r_dayofmonth - 1) / DAYSPERWEEK;
} else if (rp->r_dycode == DC_DOWLEQ) {
if (rp->r_dayofmonth == len_months[1][rp->r_month])
week = 5;
else {
- if ((rp->r_dayofmonth % DAYSPERWEEK) != 0)
- return -1;
+ wdayoff = rp->r_dayofmonth % DAYSPERWEEK;
+ if (wdayoff)
+ compat = 2013;
+ wday -= wdayoff;
+ tod += wdayoff * SECSPERDAY;
week = rp->r_dayofmonth / DAYSPERWEEK;
}
} else return -1; /* "cannot happen" */
+ if (wday < 0)
+ wday += DAYSPERWEEK;
(void) sprintf(result, "M%d.%d.%d",
- rp->r_month + 1, week, rp->r_wday);
+ rp->r_month + 1, week, wday);
}
- tod = rp->r_tod;
if (rp->r_todisgmt)
tod += gmtoff;
if (rp->r_todisstd && rp->r_stdoff == 0)
tod += dstoff;
- if (tod < 0) {
- result[0] = '\0';
- return -1;
- }
if (tod != 2 * SECSPERMIN * MINSPERHOUR) {
(void) strcat(result, "/");
if (stringoffset(end(result), tod) != 0)
return -1;
+ if (tod < 0) {
+ if (compat < 2013)
+ compat = 2013;
+ } else if (SECSPERDAY <= tod) {
+ if (compat < 1994)
+ compat = 1994;
+ }
}
- return 0;
+ return compat;
}
-static void
+static int
+rule_cmp(struct rule const *a, struct rule const *b)
+{
+ if (!a)
+ return -!!b;
+ if (!b)
+ return 1;
+ if (a->r_hiyear != b->r_hiyear)
+ return a->r_hiyear < b->r_hiyear ? -1 : 1;
+ if (a->r_month - b->r_month != 0)
+ return a->r_month - b->r_month;
+ return a->r_dayofmonth - b->r_dayofmonth;
+}
+
+enum { YEAR_BY_YEAR_ZONE = 1 };
+
+static int
stringzone(char *result, const struct zone *const zpfirst, const int zonecount)
{
register const struct zone * zp;
@@ -1850,6 +1885,9 @@ stringzone(char *result, const struct zone *const zpfirst, const int zonecount)
register struct rule * dstrp;
register int i;
register const char * abbrvar;
+ register int compat = 0;
+ register int c;
+ struct rule stdr, dstr;
result[0] = '\0';
zp = zpfirst + zonecount - 1;
@@ -1863,64 +1901,90 @@ stringzone(char *result, const struct zone *const zpfirst, const int zonecount)
if (rp->r_stdoff == 0) {
if (stdrp == NULL)
stdrp = rp;
- else return;
+ else return -1;
} else {
if (dstrp == NULL)
dstrp = rp;
- else return;
+ else return -1;
}
}
if (stdrp == NULL && dstrp == NULL) {
/*
** There are no rules running through "max".
- ** Let's find the latest rule.
+ ** Find the latest std rule in stdabbrrp
+ ** and latest rule of any type in stdrp.
*/
+ register struct rule *stdabbrrp = NULL;
for (i = 0; i < zp->z_nrules; ++i) {
rp = &zp->z_rules[i];
- if (stdrp == NULL || rp->r_hiyear > stdrp->r_hiyear ||
- (rp->r_hiyear == stdrp->r_hiyear &&
- (rp->r_month > stdrp->r_month ||
- (rp->r_month == stdrp->r_month &&
- rp->r_dayofmonth > stdrp->r_dayofmonth))))
- stdrp = rp;
+ if (rp->r_stdoff == 0 && rule_cmp(stdabbrrp, rp) < 0)
+ stdabbrrp = rp;
+ if (rule_cmp(stdrp, rp) < 0)
+ stdrp = rp;
}
- if (stdrp != NULL && stdrp->r_stdoff != 0)
- return; /* We end up in DST (a POSIX no-no). */
/*
** Horrid special case: if year is 2037,
** presume this is a zone handled on a year-by-year basis;
** do not try to apply a rule to the zone.
*/
if (stdrp != NULL && stdrp->r_hiyear == 2037)
- return;
+ return YEAR_BY_YEAR_ZONE;
+
+ if (stdrp != NULL && stdrp->r_stdoff != 0) {
+ /* Perpetual DST. */
+ dstr.r_month = TM_JANUARY;
+ dstr.r_dycode = DC_DOM;
+ dstr.r_dayofmonth = 1;
+ dstr.r_tod = 0;
+ dstr.r_todisstd = dstr.r_todisgmt = FALSE;
+ dstr.r_stdoff = stdrp->r_stdoff;
+ dstr.r_abbrvar = stdrp->r_abbrvar;
+ stdr.r_month = TM_DECEMBER;
+ stdr.r_dycode = DC_DOM;
+ stdr.r_dayofmonth = 31;
+ stdr.r_tod = SECSPERDAY + stdrp->r_stdoff;
+ stdr.r_todisstd = stdr.r_todisgmt = FALSE;
+ stdr.r_stdoff = 0;
+ stdr.r_abbrvar
+ = (stdabbrrp ? stdabbrrp->r_abbrvar : "");
+ dstrp = &dstr;
+ stdrp = &stdr;
+ }
}
if (stdrp == NULL && (zp->z_nrules != 0 || zp->z_stdoff != 0))
- return;
+ return -1;
abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar;
doabbr(result, zp->z_format, abbrvar, FALSE, TRUE);
if (stringoffset(end(result), -zp->z_gmtoff) != 0) {
result[0] = '\0';
- return;
+ return -1;
}
if (dstrp == NULL)
- return;
+ return compat;
doabbr(end(result), zp->z_format, dstrp->r_abbrvar, TRUE, TRUE);
if (dstrp->r_stdoff != SECSPERMIN * MINSPERHOUR)
if (stringoffset(end(result),
-(zp->z_gmtoff + dstrp->r_stdoff)) != 0) {
result[0] = '\0';
- return;
+ return -1;
}
(void) strcat(result, ",");
- if (stringrule(result, dstrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) {
+ c = stringrule(result, dstrp, dstrp->r_stdoff, zp->z_gmtoff);
+ if (c < 0) {
result[0] = '\0';
- return;
+ return -1;
}
+ if (compat < c)
+ compat = c;
(void) strcat(result, ",");
- if (stringrule(result, stdrp, dstrp->r_stdoff, zp->z_gmtoff) != 0) {
+ c = stringrule(result, stdrp, dstrp->r_stdoff, zp->z_gmtoff);
+ if (c < 0) {
result[0] = '\0';
- return;
+ return -1;
}
+ if (compat < c)
+ compat = c;
+ return compat;
}
static void
@@ -1944,6 +2008,9 @@ outzone(const struct zone * const zpfirst, const int zonecount)
register int max_abbr_len;
register int max_envvar_len;
register int prodstic; /* all rules are min to max */
+ register int compat;
+ register int do_extend;
+ register char version;
max_abbr_len = 2 + max_format_len + max_abbrvar_len;
max_envvar_len = 2 * max_abbr_len + 5 * 9;
@@ -1992,22 +2059,44 @@ outzone(const struct zone * const zpfirst, const int zonecount)
/*
** Generate lots of data if a rule can't cover all future times.
*/
- stringzone(envvar, zpfirst, zonecount);
- if (noise && envvar[0] == '\0') {
- register char * wp;
-
-wp = ecpyalloc(_("no POSIX environment variable for zone"));
- wp = ecatalloc(wp, " ");
- wp = ecatalloc(wp, zpfirst->z_name);
- warning(wp);
- free(wp);
- }
- if (envvar[0] == '\0') {
- if (min_year >= ZIC_MIN + YEARSPERREPEAT)
- min_year -= YEARSPERREPEAT;
+ compat = stringzone(envvar, zpfirst, zonecount);
+ version = compat < 2013 ? ZIC_VERSION_PRE_2013 : ZIC_VERSION;
+ do_extend = compat < 0 || compat == YEAR_BY_YEAR_ZONE;
+ if (noise && compat != 0 && compat != YEAR_BY_YEAR_ZONE) {
+ if (compat < 0)
+ warning("%s %s",
+ _("no POSIX environment variable for zone"),
+ zpfirst->z_name);
+ else {
+ /* Circa-COMPAT clients, and earlier clients, might
+ not work for this zone when given dates before
+ 1970 or after 2038. */
+ warning(_("%s: pre-%d clients may mishandle"
+ " distant timestamps"),
+ zpfirst->z_name, compat);
+ }
+ }
+ if (do_extend) {
+ /*
+ ** Search through a couple of extra years past the obvious
+ ** 400, to avoid edge cases. For example, suppose a non-POSIX
+ ** rule applies from 2012 onwards and has transitions in March
+ ** and September, plus some one-off transitions in November
+ ** 2013. If zic looked only at the last 400 years, it would
+ ** set max_year=2413, with the intent that the 400 years 2014
+ ** through 2413 will be repeated. The last transition listed
+ ** in the tzfile would be in 2413-09, less than 400 years
+ ** after the last one-off transition in 2013-11. Two years
+ ** might be overkill, but with the kind of edge cases
+ ** available we're not sure that one year would suffice.
+ */
+ enum { years_of_observations = YEARSPERREPEAT + 2 };
+
+ if (min_year >= ZIC_MIN + years_of_observations)
+ min_year -= years_of_observations;
else min_year = ZIC_MIN;
- if (max_year <= ZIC_MAX - YEARSPERREPEAT)
- max_year += YEARSPERREPEAT;
+ if (max_year <= ZIC_MAX - years_of_observations)
+ max_year += years_of_observations;
else max_year = ZIC_MAX;
/*
** Regardless of any of the above,
@@ -2017,7 +2106,7 @@ wp = ecpyalloc(_("no POSIX environment variable for zone"));
*/
if (prodstic) {
min_year = 1900;
- max_year = min_year + YEARSPERREPEAT;
+ max_year = min_year + years_of_observations;
}
}
/*
@@ -2079,7 +2168,7 @@ wp = ecpyalloc(_("no POSIX environment variable for zone"));
INITIALIZE(ktime);
if (useuntil) {
/*
- ** Turn untiltime into UTC
+ ** Turn untiltime into UT
** assuming the current gmtoff and
** stdoff values.
*/
@@ -2183,7 +2272,45 @@ error(_("can't determine time zone abbreviation to use just after until time"));
starttime = tadd(starttime, -gmtoff);
}
}
- writezone(zpfirst->z_name, envvar);
+ if (do_extend) {
+ /*
+ ** If we're extending the explicitly listed observations
+ ** for 400 years because we can't fill the POSIX-TZ field,
+ ** check whether we actually ended up explicitly listing
+ ** observations through that period. If there aren't any
+ ** near the end of the 400-year period, add a redundant
+ ** one at the end of the final year, to make it clear
+ ** that we are claiming to have definite knowledge of
+ ** the lack of transitions up to that point.
+ */
+ struct rule xr;
+ struct attype *lastat;
+ xr.r_month = TM_JANUARY;
+ xr.r_dycode = DC_DOM;
+ xr.r_dayofmonth = 1;
+ xr.r_tod = 0;
+ for (lastat = &attypes[0], i = 1; i < timecnt; i++)
+ if (attypes[i].at > lastat->at)
+ lastat = &attypes[i];
+ if (lastat->at < rpytime(&xr, max_year - 1)) {
+ /*
+ ** Create new type code for the redundant entry,
+ ** to prevent it being optimised away.
+ */
+ if (typecnt >= TZ_MAX_TYPES) {
+ error(_("too many local time types"));
+ exit(EXIT_FAILURE);
+ }
+ gmtoffs[typecnt] = gmtoffs[lastat->type];
+ isdsts[typecnt] = isdsts[lastat->type];
+ ttisstds[typecnt] = ttisstds[lastat->type];
+ ttisgmts[typecnt] = ttisgmts[lastat->type];
+ abbrinds[typecnt] = abbrinds[lastat->type];
+ ++typecnt;
+ addtt(rpytime(&xr, max_year + 1), typecnt-1);
+ }
+ }
+ writezone(zpfirst->z_name, envvar, version);
free(startbuf);
free(ab);
free(envvar);
@@ -2253,7 +2380,7 @@ addtype(const zic_t gmtoff, const char *const abbr, const int isdst,
exit(EXIT_FAILURE);
}
if (! (-1L - 2147483647L <= gmtoff && gmtoff <= 2147483647L)) {
- error(_("UTC offset out of range"));
+ error(_("UT offset out of range"));
exit(EXIT_FAILURE);
}
gmtoffs[i] = gmtoff;
@@ -2583,14 +2710,8 @@ mp = _("time zone abbreviation has too many alphabetics");
}
if (*cp != '\0')
mp = _("time zone abbreviation differs from POSIX standard");
- if (mp != NULL) {
- char *wp = ecpyalloc(mp);
- wp = ecatalloc(wp, " (");
- wp = ecatalloc(wp, string);
- wp = ecatalloc(wp, ")");
- warning(wp);
- free(wp);
- }
+ if (mp != NULL)
+ warning("%s (%s)", mp, string);
}
i = strlen(string) + 1;
if (charcnt + i > TZ_MAX_CHARS) {
diff --git a/elsie.nci.nih.gov/src/zone.tab b/elsie.nci.nih.gov/src/zone.tab
index 3ec24a7..fa4df5f 100644
--- a/elsie.nci.nih.gov/src/zone.tab
+++ b/elsie.nci.nih.gov/src/zone.tab
@@ -3,27 +3,30 @@
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
-# From Paul Eggert (2013-05-27):
+# From Paul Eggert (2013-08-14):
#
-# This file contains a table with the following columns:
-# 1. ISO 3166 2-character country code. See the file `iso3166.tab'.
-# This identifies a country that overlaps the zone. The country may
-# overlap other zones and the zone may overlap other countries.
-# 2. Latitude and longitude of the zone's principal location
+# This file contains a table where each row stands for an area that is
+# the intersection of a region identified by a country code and of a
+# zone where civil clocks have agreed since 1970. The columns of the
+# table are as follows:
+#
+# 1. ISO 3166 2-character country code. See the file 'iso3166.tab'.
+# 2. Latitude and longitude of the area's principal location
# in ISO 6709 sign-degrees-minutes-seconds format,
# either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
# first latitude (+ is north), then longitude (+ is east).
-# This location need not lie within the column-1 country.
# 3. Zone name used in value of TZ environment variable.
# Please see the 'Theory' file for how zone names are chosen.
+# If multiple zones overlap a country, each has a row in the
+# table, with column 1 being duplicated.
# 4. Comments; present if and only if the country has multiple rows.
#
# Columns are separated by a single tab.
# The table is sorted first by country, then an order within the country that
# (1) makes some geographical sense, and
-# (2) puts the most populous zones first, where that does not contradict (1).
+# (2) puts the most populous areas first, where that does not contradict (1).
#
-# Lines beginning with `#' are comments.
+# Lines beginning with '#' are comments.
#
# This table is intended as an aid for users, to help them select time
# zone data appropriate for their practical needs. It is not intended
@@ -39,8 +42,7 @@ AI +1812-06304 America/Anguilla
AL +4120+01950 Europe/Tirane
AM +4011+04430 Asia/Yerevan
AO -0848+01314 Africa/Luanda
-AQ -7750+16636 Antarctica/McMurdo McMurdo Station, Ross Island
-AQ -9000+00000 Antarctica/South_Pole Amundsen-Scott Station, South Pole
+AQ -7750+16636 Antarctica/McMurdo McMurdo, South Pole, Scott (New Zealand time)
AQ -6734-06808 Antarctica/Rothera Rothera Station, Adelaide Island
AQ -6448-06406 Antarctica/Palmer Palmer Station, Anvers Island
AQ -6736+06253 Antarctica/Mawson Mawson Station, Holme Bay
@@ -120,8 +122,7 @@ CA +4612-05957 America/Glace_Bay Atlantic Time - Nova Scotia - places that did n
CA +4606-06447 America/Moncton Atlantic Time - New Brunswick
CA +5320-06025 America/Goose_Bay Atlantic Time - Labrador - most locations
CA +5125-05707 America/Blanc-Sablon Atlantic Standard Time - Quebec - Lower North Shore
-CA +4531-07334 America/Montreal Eastern Time - Quebec - most locations
-CA +4339-07923 America/Toronto Eastern Time - Ontario - most locations
+CA +4339-07923 America/Toronto Eastern Time - Ontario & Quebec - most locations
CA +4901-08816 America/Nipigon Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973
CA +4823-08915 America/Thunder_Bay Eastern Time - Thunder Bay, Ontario
CA +6344-06828 America/Iqaluit Eastern Time - east Nunavut - most locations
@@ -232,7 +233,7 @@ IR +3540+05126 Asia/Tehran
IS +6409-02151 Atlantic/Reykjavik
IT +4154+01229 Europe/Rome
JE +4912-00207 Europe/Jersey
-JM +1800-07648 America/Jamaica
+JM +175805-0764736 America/Jamaica
JO +3157+03556 Asia/Amman
JP +353916+1394441 Asia/Tokyo
KE -0117+03649 Africa/Nairobi
@@ -421,8 +422,7 @@ US +465042-1012439 America/North_Dakota/New_Salem Central Time - North Dakota -
US +471551-1014640 America/North_Dakota/Beulah Central Time - North Dakota - Mercer County
US +394421-1045903 America/Denver Mountain Time
US +433649-1161209 America/Boise Mountain Time - south Idaho & east Oregon
-US +364708-1084111 America/Shiprock Mountain Time - Navajo
-US +332654-1120424 America/Phoenix Mountain Standard Time - Arizona
+US +332654-1120424 America/Phoenix Mountain Standard Time - Arizona (except Navajo)
US +340308-1181434 America/Los_Angeles Pacific Time
US +611305-1495401 America/Anchorage Alaska Time
US +581807-1342511 America/Juneau Alaska Time - Alaska panhandle