summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bishop <stuart@stuartbishop.net>2013-09-04 17:59:50 +0700
committerStuart Bishop <stuart@stuartbishop.net>2013-09-04 17:59:50 +0700
commit051b15e67401a1fe6d54ead7e214be5f280b538d (patch)
treed3cca12bb7804fe149a7c1c33fd8f40605fe2bd5
parent9463e4e25018bb7d9dd7d669b4e5a0e07779736e (diff)
downloadpytz-051b15e67401a1fe6d54ead7e214be5f280b538d.tar.gz
time zone database 2013d
-rw-r--r--elsie.nci.nih.gov/src/Makefile62
-rw-r--r--elsie.nci.nih.gov/src/Theory27
-rw-r--r--elsie.nci.nih.gov/src/africa16
-rw-r--r--elsie.nci.nih.gov/src/asia42
-rw-r--r--elsie.nci.nih.gov/src/australasia20
-rw-r--r--elsie.nci.nih.gov/src/date.1.txt2
-rw-r--r--elsie.nci.nih.gov/src/date.c6
-rw-r--r--elsie.nci.nih.gov/src/difftime.c21
-rw-r--r--elsie.nci.nih.gov/src/europe8
-rw-r--r--elsie.nci.nih.gov/src/iso3166.tab21
-rw-r--r--elsie.nci.nih.gov/src/localtime.c176
-rw-r--r--elsie.nci.nih.gov/src/newctime.3.txt2
-rw-r--r--elsie.nci.nih.gov/src/newstrftime.3.txt2
-rw-r--r--elsie.nci.nih.gov/src/newtzset.3.txt2
-rw-r--r--elsie.nci.nih.gov/src/private.h114
-rw-r--r--elsie.nci.nih.gov/src/scheck.c29
-rw-r--r--elsie.nci.nih.gov/src/southamerica4
-rw-r--r--elsie.nci.nih.gov/src/strftime.c8
-rw-r--r--elsie.nci.nih.gov/src/time2posix.3.txt2
-rw-r--r--elsie.nci.nih.gov/src/tz-art.htm8
-rw-r--r--elsie.nci.nih.gov/src/tz-link.htm43
-rw-r--r--elsie.nci.nih.gov/src/tzfile.5.txt2
-rw-r--r--elsie.nci.nih.gov/src/tzfile.h2
-rw-r--r--elsie.nci.nih.gov/src/tzselect.8.txt2
-rw-r--r--elsie.nci.nih.gov/src/usno19954
-rw-r--r--elsie.nci.nih.gov/src/usno19974
-rw-r--r--elsie.nci.nih.gov/src/usno19984
-rw-r--r--elsie.nci.nih.gov/src/zdump.826
-rw-r--r--elsie.nci.nih.gov/src/zdump.8.txt17
-rw-r--r--elsie.nci.nih.gov/src/zdump.c214
-rw-r--r--elsie.nci.nih.gov/src/zic.8.txt2
-rw-r--r--elsie.nci.nih.gov/src/zic.c244
-rw-r--r--elsie.nci.nih.gov/src/zone.tab17
33 files changed, 738 insertions, 415 deletions
diff --git a/elsie.nci.nih.gov/src/Makefile b/elsie.nci.nih.gov/src/Makefile
index 9028ed0..3659378 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= 2013c
+VERSION= 2013d
# Email address for bug reports.
BUGEMAIL= tz@iana.org
@@ -53,6 +53,9 @@ TOPDIR= /usr/local
TZDIR= $(TOPDIR)/etc/zoneinfo
+# 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
+
# The "tzselect", "zic", and "zdump" commands get installed in. . .
ETCDIR= $(TOPDIR)/etc
@@ -98,9 +101,11 @@ LDLIBS=
# Add the following to the end of the "CFLAGS=" line as needed.
# -DHAVE_ADJTIME=0 if `adjtime' does not exist (SVR0?)
+# -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
# -DHAVE_GETTEXT=1 if `gettext' works (GNU, Linux, Solaris); also see LDLIBS
# -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
# ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8).
+# -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
# -DHAVE_SETTIMEOFDAY=0 if settimeofday does not exist (SVR0?)
# -DHAVE_SETTIMEOFDAY=1 if settimeofday has just 1 arg (SVR4)
# -DHAVE_SETTIMEOFDAY=2 if settimeofday uses 2nd arg (4.3BSD)
@@ -109,21 +114,23 @@ LDLIBS=
# -DHAVE_SYMLINK=0 if your system lacks the symlink function
# -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h"
# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
-# -DLOCALE_HOME=\"path\" if locales are in "path", not "/usr/lib/locale"
# -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
# -DHAVE_UTMPX_H=1 if your compiler has a "utmpx.h"
-# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
-# DST transitions if the time zone files cannot be accessed
-# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz"
-# -TTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
-# the default is system-supplied, typically "/usr/lib/locale"
-# $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking
+# -DLOCALE_HOME=\"path\" if locales are in "path", not "/usr/lib/locale"
# -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;
+# the default is system-supplied, typically "/usr/lib/locale"
+# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
+# DST transitions if the time zone files cannot be accessed
# -DZIC_MAX_ABBR_LEN_WO_WARN=3
# (or some other number) to set the maximum time zone abbreviation length
# that zic will accept without a warning (the default is 6)
+# $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking
GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
-Wall -Wextra \
-Wbad-function-cast -Wcast-align -Wcast-qual \
@@ -189,10 +196,6 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
# These functions may well disappear in future releases of the time
# conversion package.
#
-# If you want Source Code Control System ID's left out of object modules, add
-# -DNOID
-# to the end of the "CFLAGS=" line.
-#
# If you'll never want to handle solar-time-based time zones, add
# -DNOSOLAR
# to the end of the "CFLAGS=" line
@@ -429,9 +432,10 @@ check_tables: checktab.awk $(PRIMARY_YDATA)
check_web: $(WEB_PAGES)
$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
-clean:
+clean_misc:
rm -f core *.o *.out \
date tzselect version.h zdump zic yearistype
+clean: clean_misc
rm -f -r tzpublic
maintainer-clean: clean
@@ -442,7 +446,8 @@ maintainer-clean: clean
names:
@echo $(ENCHILADA)
-public: check check_public set-timestamps tarballs signatures
+public: check check_public check_time_t_alternatives \
+ set-timestamps tarballs signatures
# Set the time stamps to those of the git repository, if available,
# and if the files have not changed since then.
@@ -473,6 +478,35 @@ check_public: $(ENCHILADA)
$(zic) -v -d tzpublic $(TDATA)
rm -f -r tzpublic
+# Check that the code works under various alternative
+# implementations of time_t.
+check_time_t_alternatives:
+ mkdir tzpublic
+ zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone.tab` && \
+ for type in $(TIME_T_ALTERNATIVES); do \
+ mkdir tzpublic/$$type && \
+ make clean_misc && \
+ make TOPDIR=`pwd`/tzpublic/$$type \
+ CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
+ install && \
+ diff -qr tzpublic/int64_t/etc/zoneinfo tzpublic/$$type/etc/zoneinfo && \
+ case $$type in \
+ int32_t) range=-2147483648,2147483647;; \
+ uint32_t) range=0,4294967296;; \
+ int64_t) continue;; \
+ *u*) range=0,10000000000;; \
+ *) range=-10000000000,10000000000;; \
+ esac && \
+ echo checking $$type zones ... && \
+ tzpublic/int64_t/etc/zdump -V -t $$range $$zones \
+ >tzpublic/int64_t.out && \
+ tzpublic/$$type/etc/zdump -V -t $$range $$zones \
+ >tzpublic/$$type.out && \
+ diff -u tzpublic/int64_t.out tzpublic/$$type.out \
+ || exit; \
+ done
+ rm -f -r tzpublic
+
tarballs: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
tzcode$(VERSION).tar.gz: $(COMMON) $(DOCS) $(SOURCES) $(MISC)
diff --git a/elsie.nci.nih.gov/src/Theory b/elsie.nci.nih.gov/src/Theory
index b00a492..751b12d 100644
--- a/elsie.nci.nih.gov/src/Theory
+++ b/elsie.nci.nih.gov/src/Theory
@@ -264,12 +264,12 @@ in decreasing order of importance:
TZ strings. A file name component must not exceed 14
characters or start with `-'. E.g., prefer `Brunei'
to `Bandar_Seri_Begawan'.
- Include at least one location per time zone rule set per country.
- One such location is enough. Use ISO 3166 (see the file
- iso3166.tab) to help decide whether something is a country.
- However, uninhabited ISO 3166 regions like Bouvet Island
+ Do not use names that differ only in case. Although the reference
+ implementation is case-sensitive, some other implementations
+ are not, and they would mishandle names differing only in case.
+ Uninhabited regions like the North Pole and Bouvet Island
do not need locations, since local time is not defined there.
- If all the clocks in a country's region have agreed since 1970,
+ 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.
@@ -283,7 +283,7 @@ in decreasing order of importance:
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 country's time zone,
+ Use the most populous among locations in a zone,
e.g. prefer `Shanghai' to `Beijing'. Among locations with
similar populations, pick the best-known location,
e.g. prefer `Rome' to `Milan'.
@@ -302,10 +302,11 @@ in decreasing order of importance:
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.
+ 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 canonical names for geographic regions.
+of names for geographic regions as described above.
Older versions of this package used a different naming scheme,
and these older names are still supported.
@@ -359,14 +360,13 @@ in decreasing order of importance:
If this is not available or is a phrase mentioning the country
(e.g. ``Cape Verde Time''), then:
- When a country has a single or principal time zone region,
+ 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.
- When a country has multiple time zones, take the first three
- letters of an English place name identifying each zone
- and then append `T', `ST', etc. as before;
- e.g. `VLAST' for VLAdivostok Summer Time.
+ 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,
@@ -587,7 +587,8 @@ Sources:
Michael Allison and Robert Schmunk,
"Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock"
-<http://www.giss.nasa.gov/tools/mars24/help/notes.html> (2004-07-30).
+<http://www.giss.nasa.gov/tools/mars24/help/notes.html> (2012-08-08).
Jia-Rui Chong, "Workdays Fit for a Martian", Los Angeles Times
+<http://articles.latimes.com/2004/jan/14/science/sci-marstime14>
(2004-01-14), pp A1, A20-A21.
diff --git a/elsie.nci.nih.gov/src/africa b/elsie.nci.nih.gov/src/africa
index 5f4f8eb..a92d7f5 100644
--- a/elsie.nci.nih.gov/src/africa
+++ b/elsie.nci.nih.gov/src/africa
@@ -852,12 +852,18 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou
# announced that year's Ramadan daylight-saving transitions would be
# 2012-07-20 and 2012-08-20; see
# <http://www.mmsp.gov.ma/fr/actualites.aspx?id=288>.
-#
+
+# From Andrew Paprocki (2013-07-02):
+# Morocco announced that the year's Ramadan daylight-savings
+# transitions would be 2013-07-07 and 2013-08-10; see:
+# http://www.maroc.ma/en/news/morocco-suspends-daylight-saving-time-july-7-aug10
+
+# From Paul Eggert (2013-07-03):
# To estimate what the Moroccan government will do in future years,
-# transition dates for 2013 through 2021 were determined by running
+# transition dates for 2014 through 2021 were determined by running
# the following program under GNU Emacs 24.3:
#
-# (let ((islamic-year 1434))
+# (let ((islamic-year 1435))
# (while (< islamic-year 1444)
# (let ((a
# (calendar-gregorian-from-absolute
@@ -910,8 +916,8 @@ Rule Morocco 2012 2019 - Apr lastSun 2:00 1:00 S
Rule Morocco 2012 max - Sep lastSun 3:00 0 -
Rule Morocco 2012 only - Jul 20 3:00 0 -
Rule Morocco 2012 only - Aug 20 2:00 1:00 S
-Rule Morocco 2013 only - Jul 9 3:00 0 -
-Rule Morocco 2013 only - Aug 8 2:00 1:00 S
+Rule Morocco 2013 only - Jul 7 3:00 0 -
+Rule Morocco 2013 only - Aug 10 2:00 1:00 S
Rule Morocco 2014 only - Jun 29 3:00 0 -
Rule Morocco 2014 only - Jul 29 2:00 1:00 S
Rule Morocco 2015 only - Jun 18 3:00 0 -
diff --git a/elsie.nci.nih.gov/src/asia b/elsie.nci.nih.gov/src/asia
index e544fcc..79cfc48 100644
--- a/elsie.nci.nih.gov/src/asia
+++ b/elsie.nci.nih.gov/src/asia
@@ -1212,39 +1212,21 @@ Rule Zion 2011 only - Oct 2 2:00 0 S
Rule Zion 2012 only - Mar Fri>=26 2:00 1:00 D
Rule Zion 2012 only - Sep 23 2:00 0 S
-# From Ephraim Silverberg (2012-10-18):
-# Yesterday, the Interior Ministry Committee, after more than a year
-# past, approved sending the proposed June 2011 changes to the Time
-# Decree Law back to the Knesset for second and third (final) votes
-# before the upcoming elections on Jan. 22, 2013. Hence, although the
-# changes are not yet law, they are expected to be so before February 2013.
-#
-# As of 2013, DST starts at 02:00 on the Friday before the last Sunday in March.
-# DST ends at 02:00 on the first Sunday after October 1, unless it occurs on the
-# second day of the Jewish Rosh Hashana holiday, in which case DST ends a day
-# later (i.e. at 02:00 the first Monday after October 2).
-# [Rosh Hashana holidays are factored in until 2100.]
-
-# From Ephraim Silverberg (2012-11-05):
-# The Knesset passed today (in second and final readings) the amendment to the
-# Time Decree Law making the changes ... law.
+# From Ephraim Silverberg (2013-06-27):
+# On June 23, 2013, the Israeli government approved changes to the
+# Time Decree Law. The next day, the changes passed the First Reading
+# in the Knesset. The law is expected to pass the Second and Third
+# (final) Readings by the beginning of September 2013.
+#
+# As of 2013, DST starts at 02:00 on the Friday before the last Sunday
+# in March. DST ends at 02:00 on the last Sunday of October.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 2013 max - Mar Fri>=23 2:00 1:00 D
-Rule Zion 2013 2026 - Oct Sun>=2 2:00 0 S
-Rule Zion 2027 only - Oct Mon>=3 2:00 0 S
-Rule Zion 2028 max - Oct Sun>=2 2:00 0 S
-# The following rules are commented out for now, as they break older
-# versions of zic that support only signed 32-bit timestamps, i.e.,
-# through 2038-01-19 03:14:07 UTC.
-#Rule Zion 2028 2053 - Oct Sun>=2 2:00 0 S
-#Rule Zion 2054 only - Oct Mon>=3 2:00 0 S
-#Rule Zion 2055 2080 - Oct Sun>=2 2:00 0 S
-#Rule Zion 2081 only - Oct Mon>=3 2:00 0 S
-#Rule Zion 2082 max - Oct Sun>=2 2:00 0 S
+Rule Zion 2013 max - Oct lastSun 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
-Zone Asia/Jerusalem 2:20:56 - LMT 1880
+Zone Asia/Jerusalem 2:20:54 - LMT 1880
2:20:40 - JMT 1918 # Jerusalem Mean Time?
2:00 Zion I%sT
@@ -2547,8 +2529,8 @@ Rule Syria 2006 only - Sep 22 0:00 0 -
Rule Syria 2007 only - Mar lastFri 0:00 1:00 S
# From Jesper Norgard (2007-10-27):
# The sister center ICARDA of my work CIMMYT is confirming that Syria DST will
-# not take place 1.st November at 0:00 o'clock but 1.st November at 24:00 or
-# rather Midnight between Thursday and Friday. This does make more sence than
+# not take place 1st November at 0:00 o'clock but 1st November at 24:00 or
+# rather Midnight between Thursday and Friday. This does make more sense than
# having it between Wednesday and Thursday (two workdays in Syria) since the
# weekend in Syria is not Saturday and Sunday, but Friday and Saturday. So now
# it is implemented at midnight of the last workday before weekend...
diff --git a/elsie.nci.nih.gov/src/australasia b/elsie.nci.nih.gov/src/australasia
index 5fe6d53..797f81c 100644
--- a/elsie.nci.nih.gov/src/australasia
+++ b/elsie.nci.nih.gov/src/australasia
@@ -230,10 +230,16 @@ Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb
# - Macquarie Island will stay on UTC+11 for winter and therefore not
# switch back from daylight savings time when other parts of Australia do
# on 4 April.
+#
+# From Arthur David Olson (2013-05-23):
+# The 1919 transition is overspecified below so pre-2013 zics
+# will produce a binary file with an EST-type as the first 32-bit type;
+# this is required for correct handling of times before 1916 by
+# pre-2013 versions of localtime.
Zone Antarctica/Macquarie 0 - zzz 1899 Nov
10:00 - EST 1916 Oct 1 2:00
10:00 1:00 EST 1917 Feb
- 10:00 Aus EST 1919 Apr
+ 10:00 Aus EST 1919 Apr 1 0:00s
0 - zzz 1948 Mar 25
10:00 Aus EST 1967
10:00 AT EST 2010 Apr 4 3:00
@@ -1475,12 +1481,12 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# From Paul Eggert (2000-01-08):
# IATA SSIM (1999-09) says DST ends 0100 local time. Go with McDow.
-# From the BBC World Service (1998-10-31 11:32 UTC):
+# From the BBC World Service in
+# http://news.bbc.co.uk/2/hi/asia-pacific/205226.stm (1998-10-31 16:03 UTC):
# The Fijiian government says the main reasons for the time change is to
-# improve productivity and reduce road accidents. But correspondents say it
-# also hopes the move will boost Fiji's ability to compete with other pacific
-# islands in the effort to attract tourists to witness the dawning of the new
-# millenium.
+# improve productivity and reduce road accidents.... [T]he move is also
+# intended to boost Fiji's ability to attract tourists to witness the dawning
+# of the new millennium.
# http://www.fiji.gov.fj/press/2000_09/2000_09_13-05.shtml (2000-09-13)
# reports that Fiji has discontinued DST.
@@ -1625,7 +1631,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# Shanks & Pottenger say the transition was on 1968-10-01; go with Mundell.
# From Eric Ulevik (1999-05-03):
-# Tonga's director of tourism, who is also secretary of the National Millenium
+# Tonga's director of tourism, who is also secretary of the National Millennium
# Committee, has a plan to get Tonga back in front.
# He has proposed a one-off move to tropical daylight saving for Tonga from
# October to March, which has won approval in principle from the Tongan
diff --git a/elsie.nci.nih.gov/src/date.1.txt b/elsie.nci.nih.gov/src/date.1.txt
index a0671db..0b4d4b0 100644
--- a/elsie.nci.nih.gov/src/date.1.txt
+++ b/elsie.nci.nih.gov/src/date.1.txt
@@ -1,4 +1,4 @@
-DATE(1) DATE(1)
+DATE(1) General Commands Manual DATE(1)
NAME
date - show and set date and time
diff --git a/elsie.nci.nih.gov/src/date.c b/elsie.nci.nih.gov/src/date.c
index b721ad9..047969f 100644
--- a/elsie.nci.nih.gov/src/date.c
+++ b/elsie.nci.nih.gov/src/date.c
@@ -708,8 +708,7 @@ checkfinal(const char * const value,
time_t othert;
struct tm tm;
struct tm othertm;
- register int pass;
- register long offset;
+ register int pass, offset;
/*
** See if there's both a USG and a BSD interpretation.
@@ -807,8 +806,7 @@ iffy(const time_t thist, const time_t thatt,
static int
netsettime(struct timeval ntv)
{
- int s, length, port, timed_ack, found, err;
- long waittime;
+ int s, length, port, timed_ack, found, err, waittime;
fd_set ready;
char hostname[MAXHOSTNAMELEN];
struct timeval tout;
diff --git a/elsie.nci.nih.gov/src/difftime.c b/elsie.nci.nih.gov/src/difftime.c
index c8c85b3..fcd18ce 100644
--- a/elsie.nci.nih.gov/src/difftime.c
+++ b/elsie.nci.nih.gov/src/difftime.c
@@ -7,13 +7,12 @@
#include "private.h" /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */
-double
+double ATTRIBUTE_CONST
difftime(const time_t time1, const time_t time0)
{
/*
** If (sizeof (double) > sizeof (time_t)) simply convert and subtract
** (assuming that the larger type has more precision).
- ** This is the common real-world case circa 2004.
*/
if (sizeof (double) > sizeof (time_t))
return (double) time1 - (double) time0;
@@ -30,8 +29,8 @@ difftime(const time_t time1, const time_t time0)
** if the minuend is greater than or equal to the subtrahend.
*/
if (time1 >= time0)
- return time1 - time0;
- else return -((double) (time0 - time1));
+ return time1 - time0;
+ else return -(double) (time0 - time1);
}
/*
** time_t is integral and signed.
@@ -42,16 +41,16 @@ difftime(const time_t time1, const time_t time0)
return time1 - time0;
/*
** time1 and time0 have opposite signs.
- ** Punt if unsigned long is too narrow.
+ ** Punt if uintmax_t is too narrow.
+ ** This suffers from double rounding; attempt to lessen that
+ ** by using long double temporaries.
*/
- if (sizeof (unsigned long) < sizeof (time_t))
- return (double) time1 - (double) time0;
+ if (sizeof (uintmax_t) < sizeof (time_t))
+ return (long double) time1 - (long double) time0;
/*
** Stay calm...decent optimizers will eliminate the complexity below.
*/
if (time1 >= 0 /* && time0 < 0 */)
- return (unsigned long) time1 +
- (unsigned long) (-(time0 + 1)) + 1;
- return -(double) ((unsigned long) time0 +
- (unsigned long) (-(time1 + 1)) + 1);
+ return (uintmax_t) time1 + (uintmax_t) (-1 - time0) + 1;
+ return -(double) ((uintmax_t) time0 + (uintmax_t) (-1 - time1) + 1);
}
diff --git a/elsie.nci.nih.gov/src/europe b/elsie.nci.nih.gov/src/europe
index 5081a52..0f429da 100644
--- a/elsie.nci.nih.gov/src/europe
+++ b/elsie.nci.nih.gov/src/europe
@@ -523,7 +523,7 @@ Rule C-Eur 1944 only - Oct 2 2:00s 0 -
# It seems that Paris, Monaco, Rule France, Rule Belgium all agree on
# 2:00 standard time, e.g. 3:00 local time. However there are no
# countries that use C-Eur rules in September 1945, so the only items
-# affected are apparently these ficticious zones that translates acronyms
+# affected are apparently these fictitious zones that translate acronyms
# CET and MET:
#
# Zone CET 1:00 C-Eur CE%sT
@@ -2779,9 +2779,9 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
# Ukraine
#
-# From Igor Karpov, who works for the Ukranian Ministry of Justice,
+# From Igor Karpov, who works for the Ukrainian Ministry of Justice,
# via Garrett Wollman (2003-01-27):
-# BTW, I've found the official document on this matter. It's goverment
+# BTW, I've found the official document on this matter. It's government
# regulations number 509, May 13, 1996. In my poor translation it says:
# "Time in Ukraine is set to second timezone (Kiev time). Each last Sunday
# of March at 3am the time is changing to 4am and each last Sunday of
@@ -2815,7 +2815,7 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
# time this year after all.
#
# From Udo Schwedt (2011-10-18):
-# As far as I understand, the recent change to the Ukranian time zone
+# As far as I understand, the recent change to the Ukrainian time zone
# (Europe/Kiev) to introduce permanent daylight saving time (similar
# to Russia) was reverted today:
#
diff --git a/elsie.nci.nih.gov/src/iso3166.tab b/elsie.nci.nih.gov/src/iso3166.tab
index b952ca1..c184a81 100644
--- a/elsie.nci.nih.gov/src/iso3166.tab
+++ b/elsie.nci.nih.gov/src/iso3166.tab
@@ -1,16 +1,14 @@
-# <pre>
+# ISO 3166 alpha-2 country codes
+#
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
-# ISO 3166 alpha-2 country codes
#
-# From Paul Eggert (2006-09-27):
+# From Paul Eggert (2013-05-27):
#
# This file contains a table with the following columns:
# 1. ISO 3166-1 alpha-2 country code, current as of
-# ISO 3166-1 Newsletter VI-1 (2007-09-21). See:
-# <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/index.html">
-# ISO 3166 Maintenance agency (ISO 3166/MA)
-# </a>.
+# 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,
# chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables.
@@ -20,8 +18,9 @@
#
# Lines beginning with `#' are comments.
#
-# From Arthur David Olson (2011-08-17):
-# Resynchronized today with the ISO 3166 site (adding SS for South Sudan).
+# 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
+# to take or endorse any position on legal or territorial claims.
#
#country-
#code country name
@@ -54,7 +53,7 @@ BL St Barthelemy
BM Bermuda
BN Brunei
BO Bolivia
-BQ Bonaire Sint Eustatius & Saba
+BQ Bonaire, St Eustatius & Saba
BR Brazil
BS Bahamas
BT Bhutan
@@ -235,7 +234,7 @@ SR Suriname
SS South Sudan
ST Sao Tome & Principe
SV El Salvador
-SX Sint Maarten
+SX St Maarten (Dutch part)
SY Syria
SZ Swaziland
TC Turks & Caicos Is
diff --git a/elsie.nci.nih.gov/src/localtime.c b/elsie.nci.nih.gov/src/localtime.c
index 47b2323..7db8ceb 100644
--- a/elsie.nci.nih.gov/src/localtime.c
+++ b/elsie.nci.nih.gov/src/localtime.c
@@ -78,7 +78,7 @@ static const char gmt[] = "GMT";
#endif /* !defined TZDEFDST */
struct ttinfo { /* time type information */
- long tt_gmtoff; /* UTC offset in seconds */
+ int_fast32_t tt_gmtoff; /* UTC 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 */
@@ -87,7 +87,7 @@ struct ttinfo { /* time type information */
struct lsinfo { /* leap second information */
time_t ls_trans; /* transition time */
- long ls_corr; /* correction to apply */
+ int_fast64_t ls_corr; /* correction to apply */
};
#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
@@ -112,6 +112,7 @@ struct state {
char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
(2 * (MY_TZNAME_MAX + 1)))];
struct lsinfo lsis[TZ_MAX_LEAPS];
+ int defaulttype; /* for early times or if no transitions */
};
struct rule {
@@ -119,7 +120,7 @@ struct rule {
int r_day; /* day number of rule */
int r_week; /* week number of rule */
int r_mon; /* month number of rule */
- long r_time; /* transition time of rule */
+ int_fast32_t r_time; /* transition time of rule */
};
#define JULIAN_DAY 0 /* Jn - Julian day */
@@ -130,7 +131,7 @@ struct rule {
** Prototypes for static functions.
*/
-static long detzcode(const char * codep);
+static int_fast32_t detzcode(const char * codep);
static time_t detzcode64(const char * codep);
static int differ_by_repeat(time_t t1, time_t t0);
static const char * getzname(const char * strp) ATTRIBUTE_PURE;
@@ -138,40 +139,40 @@ static const char * getqzname(const char * strp, const int delim)
ATTRIBUTE_PURE;
static const char * getnum(const char * strp, int * nump, int min,
int max);
-static const char * getsecs(const char * strp, long * secsp);
-static const char * getoffset(const char * strp, long * offsetp);
+static const char * getsecs(const char * strp, int_fast32_t * secsp);
+static const char * getoffset(const char * strp, int_fast32_t * offsetp);
static const char * getrule(const char * strp, struct rule * rulep);
static void gmtload(struct state * sp);
-static struct tm * gmtsub(const time_t * timep, long offset,
+static struct tm * gmtsub(const time_t * timep, int_fast32_t offset,
struct tm * tmp);
-static struct tm * localsub(const time_t * timep, long offset,
+static struct tm * localsub(const time_t * timep, int_fast32_t offset,
struct tm * tmp);
static int increment_overflow(int * number, int delta);
static int leaps_thru_end_of(int y) ATTRIBUTE_PURE;
-static int long_increment_overflow(long * number, int delta);
-static int long_normalize_overflow(long * tensptr,
+static int increment_overflow32(int_fast32_t * number, int delta);
+static int normalize_overflow32(int_fast32_t * tensptr,
int * unitsptr, int base);
static int normalize_overflow(int * tensptr, int * unitsptr,
int base);
static void settzname(void);
static time_t time1(struct tm * tmp,
struct tm * (*funcp)(const time_t *,
- long, struct tm *),
- long offset);
+ int_fast32_t, struct tm *),
+ int_fast32_t offset);
static time_t time2(struct tm *tmp,
struct tm * (*funcp)(const time_t *,
- long, struct tm*),
- long offset, int * okayp);
+ int_fast32_t, struct tm*),
+ int_fast32_t offset, int * okayp);
static time_t time2sub(struct tm *tmp,
struct tm * (*funcp)(const time_t *,
- long, struct tm*),
- long offset, int * okayp, int do_norm_secs);
-static struct tm * timesub(const time_t * timep, long offset,
+ int_fast32_t, struct tm*),
+ int_fast32_t offset, int * okayp, int do_norm_secs);
+static struct tm * timesub(const time_t * timep, int_fast32_t offset,
const struct state * sp, struct tm * tmp);
static int tmcomp(const struct tm * atmp,
const struct tm * btmp);
static time_t transtime(time_t janfirst, int year,
- const struct rule * rulep, long offset)
+ const struct rule * rulep, int_fast32_t offset)
ATTRIBUTE_PURE;
static int typesequiv(const struct state * sp, int a, int b);
static int tzload(const char * name, struct state * sp,
@@ -223,13 +224,13 @@ int daylight = 0;
time_t altzone = 0;
#endif /* defined ALTZONE */
-static long
+static int_fast32_t
detzcode(const char *const codep)
{
- register long result;
- register int i;
+ register int_fast32_t result;
+ register int i;
- result = (codep[0] & 0x80) ? ~0L : 0;
+ result = (codep[0] & 0x80) ? -1 : 0;
for (i = 0; i < 4; ++i)
result = (result << 8) | (codep[i] & 0xff);
return result;
@@ -275,7 +276,7 @@ settzname(void)
register const struct ttinfo * const ttisp = &sp->ttis[i];
tzname[ttisp->tt_isdst] = &sp->chars[ttisp->tt_abbrind];
- }
+ }
for (i = 0; i < sp->timecnt; ++i) {
register const struct ttinfo * const ttisp =
&sp->ttis[
@@ -582,6 +583,40 @@ tzload(register const char *name, register struct state *const sp,
break;
}
}
+ /*
+ ** If type 0 is is unused in transitions,
+ ** it's the type to use for early times.
+ */
+ for (i = 0; i < sp->typecnt; ++i)
+ if (sp->types[i] == 0)
+ break;
+ i = (i >= sp->typecnt) ? 0 : -1;
+ /*
+ ** Absent the above,
+ ** if there are transition times
+ ** and the first transition is to a daylight time
+ ** find the standard type less than and closest to
+ ** the type of the first transition.
+ */
+ if (i < 0 && sp->timecnt > 0 && sp->ttis[sp->types[0]].tt_isdst) {
+ i = sp->types[0];
+ while (--i >= 0)
+ if (!sp->ttis[i].tt_isdst)
+ break;
+ }
+ /*
+ ** If no result yet, find the first standard type.
+ ** If there is none, punt to type zero.
+ */
+ if (i < 0) {
+ i = 0;
+ while (sp->ttis[i].tt_isdst)
+ if (++i >= sp->typecnt) {
+ i = 0;
+ break;
+ }
+ }
+ sp->defaulttype = i;
#ifdef ALL_STATE
free(up);
#endif /* defined ALL_STATE */
@@ -697,7 +732,7 @@ getnum(register const char *strp, int *const nump, const int min, const int max)
*/
static const char *
-getsecs(register const char *strp, long *const secsp)
+getsecs(register const char *strp, int_fast32_t *const secsp)
{
int num;
@@ -710,7 +745,7 @@ getsecs(register const char *strp, long *const secsp)
strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
if (strp == NULL)
return NULL;
- *secsp = num * (long) SECSPERHOUR;
+ *secsp = num * (int_fast32_t) SECSPERHOUR;
if (*strp == ':') {
++strp;
strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
@@ -737,7 +772,7 @@ getsecs(register const char *strp, long *const secsp)
*/
static const char *
-getoffset(register const char *strp, long *const offsetp)
+getoffset(register const char *strp, int_fast32_t *const offsetp)
{
register int neg = 0;
@@ -815,7 +850,7 @@ getrule(const char *strp, register struct rule *const rulep)
static time_t
transtime(const time_t janfirst, const int year,
- register const struct rule *const rulep, const long offset)
+ register const struct rule *const rulep, const int_fast32_t offset)
{
register int leapyear;
register time_t value;
@@ -913,8 +948,8 @@ tzparse(const char *name, register struct state *const sp,
const char * dstname;
size_t stdlen;
size_t dstlen;
- long stdoffset;
- long dstoffset;
+ int_fast32_t stdoffset;
+ int_fast32_t dstoffset;
register time_t * atp;
register unsigned char * typep;
register char * cp;
@@ -1032,12 +1067,12 @@ tzparse(const char *name, register struct state *const sp,
janfirst = newfirst;
}
} else {
- register long theirstdoffset;
- register long theirdstoffset;
- register long theiroffset;
- register int isdst;
- register int i;
- register int j;
+ register int_fast32_t theirstdoffset;
+ register int_fast32_t theirdstoffset;
+ register int_fast32_t theiroffset;
+ register int isdst;
+ register int i;
+ register int j;
if (*name != '\0')
return -1;
@@ -1230,7 +1265,8 @@ tzset(void)
/*ARGSUSED*/
static struct tm *
-localsub(const time_t *const timep, const long offset, struct tm *const tmp)
+localsub(const time_t *const timep, const int_fast32_t offset,
+ struct tm *const tmp)
{
register struct state * sp;
register const struct ttinfo * ttisp;
@@ -1283,12 +1319,7 @@ localsub(const time_t *const timep, const long offset, struct tm *const tmp)
return result;
}
if (sp->timecnt == 0 || t < sp->ats[0]) {
- i = 0;
- while (sp->ttis[i].tt_isdst)
- if (++i >= sp->typecnt) {
- i = 0;
- break;
- }
+ i = sp->defaulttype;
} else {
register int lo = 1;
register int hi = sp->timecnt;
@@ -1340,7 +1371,8 @@ localtime_r(const time_t *const timep, struct tm *tmp)
*/
static struct tm *
-gmtsub(const time_t *const timep, const long offset, struct tm *const tmp)
+gmtsub(const time_t *const timep, const int_fast32_t offset,
+ struct tm *const tmp)
{
register struct tm * result;
@@ -1394,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 long offset)
+offtime(const time_t *const timep, const int_fast32_t offset)
{
return gmtsub(timep, offset, &tm);
}
@@ -1414,17 +1446,17 @@ leaps_thru_end_of(register const int y)
}
static struct tm *
-timesub(const time_t *const timep, const long offset,
+timesub(const time_t *const timep, const int_fast32_t offset,
register const struct state *const sp,
register struct tm *const tmp)
{
register const struct lsinfo * lp;
register time_t tdays;
register int idays; /* unsigned would be so 2003 */
- register long rem;
+ register int_fast64_t rem;
int y;
register const int * ip;
- register long corr;
+ register int_fast64_t corr;
register int hit;
register int i;
@@ -1481,9 +1513,10 @@ timesub(const time_t *const timep, const long offset,
y = newy;
}
{
- register long seconds;
+ register int_fast32_t seconds;
+ register time_t half_second = 0.5;
- seconds = tdays * SECSPERDAY + 0.5;
+ seconds = tdays * SECSPERDAY + half_second;
tdays = seconds / SECSPERDAY;
rem += seconds - tdays * SECSPERDAY;
}
@@ -1600,11 +1633,11 @@ increment_overflow(int *const ip, int j)
}
static int
-long_increment_overflow(long *const lp, int const m)
+increment_overflow32(int_fast32_t *const lp, int const m)
{
- register long const l = *lp;
+ register int_fast32_t const l = *lp;
- if ((l >= 0) ? (m > LONG_MAX - l) : (m < LONG_MIN - l))
+ if ((l >= 0) ? (m > INT_FAST32_MAX - l) : (m < INT_FAST32_MIN - l))
return TRUE;
*lp += m;
return FALSE;
@@ -1623,7 +1656,8 @@ normalize_overflow(int *const tensptr, int *const unitsptr, const int base)
}
static int
-long_normalize_overflow(long *const tensptr, int *const unitsptr, const int base)
+normalize_overflow32(int_fast32_t *const tensptr, int *const unitsptr,
+ const int base)
{
register int tensdelta;
@@ -1631,7 +1665,7 @@ long_normalize_overflow(long *const tensptr, int *const unitsptr, const int base
(*unitsptr / base) :
(-1 - (-1 - *unitsptr) / base);
*unitsptr -= tensdelta * base;
- return long_increment_overflow(tensptr, tensdelta);
+ return increment_overflow32(tensptr, tensdelta);
}
static int
@@ -1651,8 +1685,8 @@ tmcomp(register const struct tm *const atmp,
static time_t
time2sub(struct tm *const tmp,
- struct tm *(*const funcp)(const time_t *, long, struct tm *),
- const long offset,
+ struct tm *(*const funcp)(const time_t *, int_fast32_t, struct tm *),
+ const int_fast32_t offset,
int *const okayp,
const int do_norm_secs)
{
@@ -1660,10 +1694,10 @@ time2sub(struct tm *const tmp,
register int dir;
register int i, j;
register int saved_seconds;
- register long li;
+ register int_fast32_t li;
register time_t lo;
register time_t hi;
- long y;
+ int_fast32_t y;
time_t newt;
time_t t;
struct tm yourtm, mytm;
@@ -1680,16 +1714,16 @@ time2sub(struct tm *const tmp,
if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY))
return WRONG;
y = yourtm.tm_year;
- if (long_normalize_overflow(&y, &yourtm.tm_mon, MONSPERYEAR))
+ if (normalize_overflow32(&y, &yourtm.tm_mon, MONSPERYEAR))
return WRONG;
/*
** Turn y into an actual year number for now.
** It is converted back to an offset from TM_YEAR_BASE later.
*/
- if (long_increment_overflow(&y, TM_YEAR_BASE))
+ if (increment_overflow32(&y, TM_YEAR_BASE))
return WRONG;
while (yourtm.tm_mday <= 0) {
- if (long_increment_overflow(&y, -1))
+ if (increment_overflow32(&y, -1))
return WRONG;
li = y + (1 < yourtm.tm_mon);
yourtm.tm_mday += year_lengths[isleap(li)];
@@ -1697,7 +1731,7 @@ time2sub(struct tm *const tmp,
while (yourtm.tm_mday > DAYSPERLYEAR) {
li = y + (1 < yourtm.tm_mon);
yourtm.tm_mday -= year_lengths[isleap(li)];
- if (long_increment_overflow(&y, 1))
+ if (increment_overflow32(&y, 1))
return WRONG;
}
for ( ; ; ) {
@@ -1707,11 +1741,11 @@ time2sub(struct tm *const tmp,
yourtm.tm_mday -= i;
if (++yourtm.tm_mon >= MONSPERYEAR) {
yourtm.tm_mon = 0;
- if (long_increment_overflow(&y, 1))
+ if (increment_overflow32(&y, 1))
return WRONG;
}
}
- if (long_increment_overflow(&y, -TM_YEAR_BASE))
+ if (increment_overflow32(&y, -TM_YEAR_BASE))
return WRONG;
yourtm.tm_year = y;
if (yourtm.tm_year != y)
@@ -1834,8 +1868,8 @@ label:
static time_t
time2(struct tm * const tmp,
- struct tm * (*const funcp)(const time_t *, long, struct tm *),
- const long offset,
+ struct tm * (*const funcp)(const time_t *, int_fast32_t, struct tm *),
+ const int_fast32_t offset,
int *const okayp)
{
time_t t;
@@ -1851,8 +1885,8 @@ time2(struct tm * const tmp,
static time_t
time1(struct tm *const tmp,
- struct tm *(*const funcp) (const time_t *, long, struct tm *),
- const long offset)
+ struct tm *(*const funcp) (const time_t *, int_fast32_t, struct tm *),
+ const int_fast32_t offset)
{
register time_t t;
register const struct state * sp;
@@ -1951,7 +1985,7 @@ timegm(struct tm *const tmp)
}
time_t
-timeoff(struct tm *const tmp, const long offset)
+timeoff(struct tm *const tmp, const int_fast32_t offset)
{
if (tmp != NULL)
tmp->tm_isdst = 0;
@@ -1967,7 +2001,7 @@ timeoff(struct tm *const tmp, const long offset)
** previous versions of the CMUCS runtime library.
*/
-long
+int_fast32_t
gtime(struct tm *const tmp)
{
const time_t t = mktime(tmp);
@@ -1993,7 +2027,7 @@ gtime(struct tm *const tmp)
** when exchanging timestamps with POSIX conforming systems.
*/
-static long
+static int_fast64_t
leapcorr(time_t *timep)
{
register struct state * sp;
diff --git a/elsie.nci.nih.gov/src/newctime.3.txt b/elsie.nci.nih.gov/src/newctime.3.txt
index 62c3b3d..cd3ace7 100644
--- a/elsie.nci.nih.gov/src/newctime.3.txt
+++ b/elsie.nci.nih.gov/src/newctime.3.txt
@@ -1,4 +1,4 @@
-NEWCTIME(3) NEWCTIME(3)
+NEWCTIME(3) Library Functions Manual NEWCTIME(3)
NAME
asctime, ctime, difftime, gmtime, localtime, mktime - convert date and
diff --git a/elsie.nci.nih.gov/src/newstrftime.3.txt b/elsie.nci.nih.gov/src/newstrftime.3.txt
index ec69a9d..fdafa4d 100644
--- a/elsie.nci.nih.gov/src/newstrftime.3.txt
+++ b/elsie.nci.nih.gov/src/newstrftime.3.txt
@@ -1,4 +1,4 @@
-NEWSTRFTIME(3) NEWSTRFTIME(3)
+NEWSTRFTIME(3) Library Functions Manual NEWSTRFTIME(3)
NAME
strftime - format date and time
diff --git a/elsie.nci.nih.gov/src/newtzset.3.txt b/elsie.nci.nih.gov/src/newtzset.3.txt
index 1d4eedf..16dc464 100644
--- a/elsie.nci.nih.gov/src/newtzset.3.txt
+++ b/elsie.nci.nih.gov/src/newtzset.3.txt
@@ -1,4 +1,4 @@
-NEWTZSET(3) NEWTZSET(3)
+NEWTZSET(3) Library Functions Manual NEWTZSET(3)
NAME
tzset - initialize time conversion information
diff --git a/elsie.nci.nih.gov/src/private.h b/elsie.nci.nih.gov/src/private.h
index 1d1d391..a31a26e 100644
--- a/elsie.nci.nih.gov/src/private.h
+++ b/elsie.nci.nih.gov/src/private.h
@@ -124,19 +124,65 @@
#include "stdint.h"
#endif /* !HAVE_STDINT_H */
+#ifndef HAVE_INTTYPES_H
+# define HAVE_INTTYPES_H HAVE_STDINT_H
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
#ifndef INT_FAST64_MAX
/* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */
#if defined LLONG_MAX || defined __LONG_LONG_MAX__
typedef long long int_fast64_t;
+# ifdef LLONG_MAX
+# define INT_FAST64_MIN LLONG_MIN
+# define INT_FAST64_MAX LLONG_MAX
+# else
+# define INT_FAST64_MIN __LONG_LONG_MIN__
+# define INT_FAST64_MAX __LONG_LONG_MAX__
+# endif
+# define SCNdFAST64 "lld"
#else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
#if (LONG_MAX >> 31) < 0xffffffff
Please use a compiler that supports a 64-bit integer type (or wider);
you may need to compile with "-DHAVE_STDINT_H".
#endif /* (LONG_MAX >> 31) < 0xffffffff */
typedef long int_fast64_t;
+# define INT_FAST64_MIN LONG_MIN
+# define INT_FAST64_MAX LONG_MAX
+# define SCNdFAST64 "ld"
#endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
#endif /* !defined INT_FAST64_MAX */
+#ifndef INT_FAST32_MAX
+# if INT_MAX >> 31 == 0
+typedef long int_fast32_t;
+# else
+typedef int int_fast32_t;
+# endif
+#endif
+
+#ifndef INTMAX_MAX
+# if defined LLONG_MAX || defined __LONG_LONG_MAX__
+typedef long long intmax_t;
+# define PRIdMAX "lld"
+# else
+typedef long intmax_t;
+# define PRIdMAX "ld"
+# endif
+#endif
+
+#ifndef UINTMAX_MAX
+# if defined ULLONG_MAX || defined __LONG_LONG_MAX__
+typedef unsigned long long uintmax_t;
+# define PRIuMAX "llu"
+# else
+typedef unsigned long uintmax_t;
+# define PRIuMAX "lu"
+# endif
+#endif
+
#ifndef INT32_MAX
#define INT32_MAX 0x7fffffff
#endif /* !defined INT32_MAX */
@@ -144,12 +190,26 @@ typedef long int_fast64_t;
#define INT32_MIN (-1 - INT32_MAX)
#endif /* !defined INT32_MIN */
-#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
+#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define ATTRIBUTE_CONST __attribute__ ((const))
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
+# define ATTRIBUTE_CONST /* empty */
# define ATTRIBUTE_PURE /* empty */
#endif
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
+# if 2 < __GNUC__ + (8 <= __GNUC_MINOR__)
+# define _Noreturn __attribute__ ((__noreturn__))
+# else
+# define _Noreturn
+# endif
+#endif
+
+#if __STDC_VERSION__ < 199901 && !defined restrict
+# define restrict /* empty */
+#endif
+
/*
** Workarounds for compilers/systems.
*/
@@ -165,6 +225,58 @@ extern char * asctime_r(struct tm const *, char *);
#endif
/*
+** Compile with -Dtime_tz=T to build the tz package with a private
+** time_t type equivalent to T rather than the system-supplied time_t.
+** This debugging feature can test unusual design decisions
+** (e.g., time_t wider than 'long', or unsigned time_t) even on
+** typical platforms.
+*/
+#ifdef time_tz
+static time_t sys_time(time_t *x) { return time(x); }
+
+# undef ctime
+# define ctime tz_ctime
+# undef ctime_r
+# define ctime_r tz_ctime_r
+# undef difftime
+# define difftime tz_difftime
+# undef gmtime
+# define gmtime tz_gmtime
+# undef gmtime_r
+# define gmtime_r tz_gmtime_r
+# undef localtime
+# define localtime tz_localtime
+# undef localtime_r
+# define localtime_r tz_localtime_r
+# undef mktime
+# define mktime tz_mktime
+# undef time
+# define time tz_time
+# undef time_t
+# define time_t tz_time_t
+
+typedef time_tz time_t;
+
+char *ctime(time_t const *);
+char *ctime_r(time_t const *, char *);
+double difftime(time_t, time_t);
+struct tm *gmtime(time_t const *);
+struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
+struct tm *localtime(time_t const *);
+struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
+time_t mktime(struct tm *);
+
+static time_t
+time(time_t *p)
+{
+ time_t r = sys_time(0);
+ if (p)
+ *p = r;
+ return r;
+}
+#endif
+
+/*
** Private function declarations.
*/
diff --git a/elsie.nci.nih.gov/src/scheck.c b/elsie.nci.nih.gov/src/scheck.c
index ed60980..8bd01a8 100644
--- a/elsie.nci.nih.gov/src/scheck.c
+++ b/elsie.nci.nih.gov/src/scheck.c
@@ -25,26 +25,35 @@ scheck(const char *const string, const char *const format)
return result;
fp = format;
tp = fbuf;
+
+ /*
+ ** Copy directives, suppressing each conversion that is not
+ ** already suppressed. Scansets containing '%' are not
+ ** supported; e.g., the conversion specification "%[%]" is not
+ ** supported. Also, multibyte characters containing a
+ ** non-leading '%' byte are not supported.
+ */
while ((*tp++ = c = *fp++) != '\0') {
if (c != '%')
continue;
- if (*fp == '%') {
- *tp++ = *fp++;
- continue;
+ if (is_digit(*fp)) {
+ char const *f = fp;
+ char *t = tp;
+ do {
+ *t++ = c = *f++;
+ } while (is_digit(c));
+ if (c == '$') {
+ fp = f;
+ tp = t;
+ }
}
*tp++ = '*';
if (*fp == '*')
++fp;
- while (is_digit(*fp))
- *tp++ = *fp++;
- if (*fp == 'l' || *fp == 'h')
- *tp++ = *fp++;
- else if (*fp == '[')
- do *tp++ = *fp++;
- while (*fp != '\0' && *fp != ']');
if ((*tp++ = *fp++) == '\0')
break;
}
+
*(tp - 1) = '%';
*tp++ = 'c';
*tp = '\0';
diff --git a/elsie.nci.nih.gov/src/southamerica b/elsie.nci.nih.gov/src/southamerica
index 3c2f82a..0d8ed7a 100644
--- a/elsie.nci.nih.gov/src/southamerica
+++ b/elsie.nci.nih.gov/src/southamerica
@@ -971,7 +971,7 @@ Rule Brazil 2007 only - Feb 25 0:00 0 -
# adopted by the same states as before.
Rule Brazil 2007 only - Oct Sun>=8 0:00 1:00 S
# From Frederico A. C. Neves (2008-09-10):
-# Acording to this decree
+# According to this decree
# <a href="http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm">
# http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm
# </a>
@@ -1203,7 +1203,7 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651
# </a>
#
-# This is not yet reflected in the offical "cambio de hora" site, but
+# This is not yet reflected in the official "cambio de hora" site, but
# probably will be soon:
# <a href="http://www.horaoficial.cl/cambio.htm">
# http://www.horaoficial.cl/cambio.htm
diff --git a/elsie.nci.nih.gov/src/strftime.c b/elsie.nci.nih.gov/src/strftime.c
index 2c3cef8..821ce7f 100644
--- a/elsie.nci.nih.gov/src/strftime.c
+++ b/elsie.nci.nih.gov/src/strftime.c
@@ -317,10 +317,10 @@ label:
tm = *t;
mkt = mktime(&tm);
if (TYPE_SIGNED(time_t))
- (void) sprintf(buf, "%ld",
- (long) mkt);
- else (void) sprintf(buf, "%lu",
- (unsigned long) mkt);
+ (void) sprintf(buf, "%"PRIdMAX,
+ (intmax_t) mkt);
+ else (void) sprintf(buf, "%"PRIuMAX,
+ (uintmax_t) mkt);
pt = _add(buf, pt, ptlim);
}
continue;
diff --git a/elsie.nci.nih.gov/src/time2posix.3.txt b/elsie.nci.nih.gov/src/time2posix.3.txt
index 553548f..9c756f7 100644
--- a/elsie.nci.nih.gov/src/time2posix.3.txt
+++ b/elsie.nci.nih.gov/src/time2posix.3.txt
@@ -1,4 +1,4 @@
-TIME2POSIX(3) TIME2POSIX(3)
+TIME2POSIX(3) Library Functions Manual TIME2POSIX(3)
NAME
time2posix, posix2time - convert seconds since the Epoch
diff --git a/elsie.nci.nih.gov/src/tz-art.htm b/elsie.nci.nih.gov/src/tz-art.htm
index 046b6ee..4dc097a 100644
--- a/elsie.nci.nih.gov/src/tz-art.htm
+++ b/elsie.nci.nih.gov/src/tz-art.htm
@@ -235,7 +235,7 @@ Supernaw.</td></tr>
<tr><td><a href="http://www.allmusic.com/cg/amg.dll?p=amg&amp;sql=10:3bftxzw0ldhe">AMG Rating</a></td><td>3.5 stars</td></tr>
<tr><td>ADO Rating</td><td>2.5 stars</td></tr>
<tr><td>Notes<td>Includes the song "Fire and Wood" with the lyric
-"The clocks were turned back you remeber/Think it's still November."
+"The clocks were turned back you remember/Think it's still November."
</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Artist</td><td>Ken Nordine</td></tr>
@@ -431,10 +431,10 @@ hilarity ensues.
<hr>
<ul>
<li>
-"We're been using the five-cent nickle in this country since 1492.
-Now that's pretty near 100 years, daylight savings [sic]."
+"We've been using the five-cent nickel in this country since 1492.
+Now that's pretty near 100 years, daylight saving."
(Groucho Marx as Captain Spaulding in "Animal Crackers", 1930,
-as noted by Will Fitzerald)
+as noted by Will Fitzgerald)
</li>
<li>
Brady: "...[Bishop Usher] determined that the Lord began the Creation
diff --git a/elsie.nci.nih.gov/src/tz-link.htm b/elsie.nci.nih.gov/src/tz-link.htm
index 5e24fed..9eea060 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-03-11">
+<meta name="DC.Date" content="2013-07-03">
<meta name="DC.Description"
content="Sources of information about time zones and daylight saving time">
<meta name="DC.Identifier"
@@ -31,8 +31,7 @@ href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr
title="Coordinated Universal Time">UTC</abbr></a> offsets, and
<a href="http://en.wikipedia.org/wiki/Daylight_saving">daylight-saving</a>
rules.
-This database (often called <code>zoneinfo</code> or <a
-href="http://en.wikipedia.org/wiki/Tz_database"><code>tz</code></a>)
+This database (often called <code>zoneinfo</code> or <code>tz</code>)
is used by several implementations,
including
<a href="http://www.gnu.org/software/libc/">the
@@ -40,6 +39,8 @@ including
C Library</a> (used in
<a href="http://www.linux.org/"><abbr>GNU</abbr>/Linux</a>),
<a href="http://www.android.com/">Android</a>,
+<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS">Firefox
+OS</a>,
<a href="http://www.freebsd.org/">FreeBSD</a>,
<a href="http://netbsd.org/">NetBSD</a>,
<a href="http://openbsd.org/">OpenBSD</a>,
@@ -134,6 +135,17 @@ For Comments">RFC</abbr> 6557).</p>
The Web has several other sources for time zone and daylight saving time data.
Here are some links that may be of interest.
</p>
+<h2>Commentary on the <code>tz</code> database</h2>
+<ul>
+<li>The article
+<a href="http://en.wikipedia.org/wiki/Tz_database">tz database</a> is
+an encyclopedic summary.</li>
+<li><a href="http://www.cstdbill.com/tzdb/tz-how-to.html">How to Read the
+tz Database Source Files</a> explains the tz database format.</li>
+<li><a href="http://blog.jonudell.net/2009/10/23/a-literary-appreciation-of-the-olsonzoneinfotz-database/">A
+literary appreciation of the Olson/Zoneinfo/tz database</a> comments on the
+database's style.</li>
+</ul>
<h2>Web sites using recent versions of the <code>tz</code> database</h2>
<p>
These are listed roughly in ascending order of complexity and fanciness.
@@ -176,8 +188,8 @@ href="http://calconnect.org/publications/icalendartimezoneproblemsandrecommendat
TIMEZONE Problems and Recommendations</a> offers guidelines and
recommendations for the use of VTIMEZONE and <code>tz</code>.</li>
<li><a href="http://calconnect.org/dstlinks.shtml">Extended Daylight
-Saving Time Links, Advisories and Changes</a> lists vendor material on recent
-daylight saving time changes.</li>
+Saving Time Links, Advisories and Changes</a> lists vendor material on 2007
+U.S. daylight saving time changes.</li>
<li><a
href="http://calconnect.org/publications/timezoneregistryandservicerecommendationsv1.0.pdf">Timezone
Registry and Service Recommendations</a> discusses a
@@ -235,16 +247,16 @@ contains a class
<code>org.joda.time.tz.ZoneInfoCompiler</code> that compiles
<code>tz</code> source into a Joda-specific binary format. Joda Time
is freely available under a <abbr>BSD</abbr>-style license.</li>
-<li><a href="http://pytz.sourceforge.net">PyTZ - Python Time
-Zone Library</a> compiles <code>tz</code> source into
+<li><a href="http://pytz.sourceforge.net">pytz - World Timezone
+Definitions for Python</a> compiles <code>tz</code> source into
<a href="http://python.org/">Python</a>.
It is freely available under a <abbr>BSD</abbr>-style license.</li>
<li><a href="http://tzinfo.rubyforge.org/">TZInfo - Ruby Timezone Library</a>
compiles <code>tz</code> source into
-<a href="http://ruby-lang.org">Ruby</a>.
+<a href="http://www.ruby-lang.org/en/">Ruby</a>.
It is freely available under the <abbr
title="Massachusetts Institute of Technology">MIT</abbr> license.</li>
-<li>The <a href="http://chronos-st.org/">Chronos Date/Time
+<li>The <a href="http://www.squeaksource.com/Chronos/">Chronos Date/Time
Library</a> is
a <a href="http://en.wikipedia.org/wiki/Smalltalk">Smalltalk</a> class
library that compiles <code>tz</code> source into a time zone repository whose format
@@ -331,7 +343,7 @@ time zone history atlases published in both <a
href="http://astrocom.com/astrology-products/software/acs-atlas-software">computer</a>
and book form (<a
href="http://www.astrocom.com/astrology/books/american-atlas">one volume
-for the USA</a>, and <a
+for the U.S.</a>, and <a
href="http://www.astrocom.com/astrology/books/international-atlas">one for
other locations</a>) by <a
href="http://astrocom.com/">Astro Computing Services</a>.</li>
@@ -353,7 +365,7 @@ gives current time zone rules for airports served by commercial aviation.</li>
<li>Some Microsoft Windows versions contain time zone information in
an undocumented format, with IDs that can be mapped to <code>TZ</code>
values using the <a
-href="http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html">Zone
+href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html">Zone
&rarr; Tzid table</a> maintained by the <abbr
title="Common Locale Data Repository">CLDR</abbr> data mentioned
below.</li>
@@ -421,6 +433,9 @@ surveys the evolution of timekeeping.</li>
<li><a href="http://webexhibits.org/daylightsaving/">About Daylight
Saving Time - History, rationale, laws &amp; dates</a>
is an overall history of <abbr>DST</abbr>.</li>
+<li><a href="http://www.w3.org/TR/timezone/">Working with Time Zones</a>
+contains guidelines and best practices for software applications that
+deal with civil time.</li>
<li><a href="http://energy.ca.gov/daylightsaving.html">Saving Time,
Saving Energy</a> discusses a primary justification for <abbr>DST</abbr>.</li>
<li><a href="http://seizethedaylight.com/dst/">A Brief
@@ -499,7 +514,7 @@ href="http://www.polyomino.org.uk/british-time/">History of
legal time in Britain</a> discusses in detail the country
with perhaps the best-documented history of clock adjustments.
The National Physical Laboratory also maintains an <a
-href="http://www.npl.co.uk/educate-explore/what-is-the-time/archive-of-summer-time-dates-1916-2006">Archive
+href="http://www.npl.co.uk/educate-explore/what-is-time/archive-of-summer-time-dates-1916-2006">Archive
of Summer time dates</a>.</dd>
</dl>
<h2>Precision timekeeping</h2>
@@ -578,8 +593,8 @@ contentious issue.</li>
<h2>Time notation</h2>
<ul>
<li>
-<a href="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">A Summary of
-the International Standard Date and Time Notation</a> is a good
+<a href="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">A summary of
+the international standard date and time notation</a> is a good
summary of
<a
href="http://www.iso.org/iso/catalogue_detail?csnumber=40874"><abbr
diff --git a/elsie.nci.nih.gov/src/tzfile.5.txt b/elsie.nci.nih.gov/src/tzfile.5.txt
index 8217897..def7839 100644
--- a/elsie.nci.nih.gov/src/tzfile.5.txt
+++ b/elsie.nci.nih.gov/src/tzfile.5.txt
@@ -1,4 +1,4 @@
-TZFILE(5) TZFILE(5)
+TZFILE(5) File Formats Manual TZFILE(5)
NAME
tzfile - time zone information
diff --git a/elsie.nci.nih.gov/src/tzfile.h b/elsie.nci.nih.gov/src/tzfile.h
index 0f6c687..d04fe04 100644
--- a/elsie.nci.nih.gov/src/tzfile.h
+++ b/elsie.nci.nih.gov/src/tzfile.h
@@ -122,7 +122,7 @@ struct tzhead {
#define DAYSPERNYEAR 365
#define DAYSPERLYEAR 366
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
+#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
#define MONSPERYEAR 12
#define TM_SUNDAY 0
diff --git a/elsie.nci.nih.gov/src/tzselect.8.txt b/elsie.nci.nih.gov/src/tzselect.8.txt
index d323b14..e56ceae 100644
--- a/elsie.nci.nih.gov/src/tzselect.8.txt
+++ b/elsie.nci.nih.gov/src/tzselect.8.txt
@@ -1,4 +1,4 @@
-TZSELECT(8) TZSELECT(8)
+TZSELECT(8) System Manager's Manual TZSELECT(8)
NAME
tzselect - select a time zone
diff --git a/elsie.nci.nih.gov/src/usno1995 b/elsie.nci.nih.gov/src/usno1995
index e39aa52..a5ee0ae 100644
--- a/elsie.nci.nih.gov/src/usno1995
+++ b/elsie.nci.nih.gov/src/usno1995
@@ -25,7 +25,7 @@ Australia Lord Howe Island: +10.5 hours (Local summer +11 hours)
Australia New South Wales: +10 hours (Local summer +11 hours)
Australia Queensland: +10 hours
Australia Victoria: +10 hours (Local summer +11 hours)
-Australia Australian Captial Territory: +10 hours (Local summer +11 hours)
+Australia Australian Capital Territory: +10 hours (Local summer +11 hours)
Australia South: +9.5 hours (Local summer +10.5 hours)
Australia Tasmania: +10 hours (Local summer +11 hours)
Australia Western: +8 hours
@@ -97,7 +97,7 @@ Ecuador: -5 hours
Egypt: +2 hours (Local summer +3 hours)
El Salvador: -6 hours
England: 0 hours (Local summer +1 hours)
-Equitorial Guinea: +1 hours
+Equatorial Guinea: +1 hours
Eritrea: +3 hours
Estonia: +2 hours (Local summer +3 hours)
Ethiopia: +3 hours
diff --git a/elsie.nci.nih.gov/src/usno1997 b/elsie.nci.nih.gov/src/usno1997
index ac63df5..b90be86 100644
--- a/elsie.nci.nih.gov/src/usno1997
+++ b/elsie.nci.nih.gov/src/usno1997
@@ -25,7 +25,7 @@ Australia Lord Howe Island: +10.5 hours (Local summer +11 hours)
Australia New South Wales: +10 hours (Local summer +11 hours)
Australia Queensland: +10 hours
Australia Victoria: +10 hours (Local summer +11 hours)
-Australia Australian Captial Territory: +10 hours (Local summer +11 hours)
+Australia Australian Capital Territory: +10 hours (Local summer +11 hours)
Australia South: +9.5 hours (Local summer +10.5 hours)
Australia Tasmania: +10 hours (Local summer +11 hours)
Australia Western: +8 hours
@@ -97,7 +97,7 @@ Ecuador: -5 hours
Egypt: +2 hours (Local summer +3 hours)
El Salvador: -6 hours
England: 0 hours (Local summer +1 hours)
-Equitorial Guinea: +1 hours
+Equatorial Guinea: +1 hours
Eritrea: +3 hours
Estonia: +2 hours (Local summer +3 hours)
Ethiopia: +3 hours
diff --git a/elsie.nci.nih.gov/src/usno1998 b/elsie.nci.nih.gov/src/usno1998
index 62264a1..d77d255 100644
--- a/elsie.nci.nih.gov/src/usno1998
+++ b/elsie.nci.nih.gov/src/usno1998
@@ -25,7 +25,7 @@ Australia Lord Howe Island: +10.5 hours (Local summer +11 hours)
Australia New South Wales: +10 hours (Local summer +11 hours)
Australia Queensland: +10 hours
Australia Victoria: +10 hours (Local summer +11 hours)
-Australia Australian Captial Territory: +10 hours (Local summer +11 hours)
+Australia Australian Capital Territory: +10 hours (Local summer +11 hours)
Australia South: +9.5 hours (Local summer +10.5 hours)
Australia Tasmania: +10 hours (Local summer +11 hours)
Australia Western: +8 hours
@@ -97,7 +97,7 @@ Ecuador: -5 hours
Egypt: +2 hours (Local summer +3 hours)
El Salvador: -6 hours
England: 0 hours (Local summer +1 hours)
-Equitorial Guinea: +1 hours
+Equatorial Guinea: +1 hours
Eritrea: +3 hours
Estonia: +2 hours (Local summer +3 hours)
Ethiopia: +3 hours
diff --git a/elsie.nci.nih.gov/src/zdump.8 b/elsie.nci.nih.gov/src/zdump.8
index 63349e4..f253e81 100644
--- a/elsie.nci.nih.gov/src/zdump.8
+++ b/elsie.nci.nih.gov/src/zdump.8
@@ -5,12 +5,15 @@ zdump \- time zone dumper
.B zdump
[
.B \-\-version
-]
-[
+] [
.B \-v
] [
+.B \-V
+] [
.B \-c
-[loyear,]hiyear ] [ zonename ... ]
+[loyear,]hiyear ] [
+.B \-t
+[lotime,]hitime ] [ zonename ... ]
.SH DESCRIPTION
.I Zdump
prints the current time in each
@@ -38,14 +41,27 @@ if the given time is Daylight Saving Time or
.B isdst=0
otherwise.
.TP
+.B \-V
+Like
+.BR \-v ,
+except omit the times relative to the extreme time values.
+This generates output that is easier to compare to that of
+implementations with different time representations.
+.TP
.BI "\-c " [loyear,]hiyear
Cut off verbose output near the start of the given year(s).
By default,
-the program cuts off verbose output near the starts of the years -500 and 2500.
+the program cuts off verbose output near the starts of the years \-500 and 2500.
+.TP
+.BI "\-t " [lotime,]hitime
+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
-option may not be used on systems with floating-point time_t values
+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
diff --git a/elsie.nci.nih.gov/src/zdump.8.txt b/elsie.nci.nih.gov/src/zdump.8.txt
index a771ea8..bf961f9 100644
--- a/elsie.nci.nih.gov/src/zdump.8.txt
+++ b/elsie.nci.nih.gov/src/zdump.8.txt
@@ -1,10 +1,11 @@
-ZDUMP(8) ZDUMP(8)
+ZDUMP(8) System Manager's Manual ZDUMP(8)
NAME
zdump - time zone dumper
SYNOPSIS
- zdump [ --version ] [ -v ] [ -c [loyear,]hiyear ] [ zonename ... ]
+ zdump [ --version ] [ -v ] [ -V ] [ -c [loyear,]hiyear ] [ -t
+ [lotime,]hitime ] [ zonename ... ]
DESCRIPTION
Zdump prints the current time in each zonename named on the command
@@ -23,14 +24,22 @@ DESCRIPTION
highest possible time value, Each line ends with isdst=1 if the
given time is Daylight Saving Time or isdst=0 otherwise.
+ -V Like -v, except omit the times relative to the extreme time
+ values. This generates output that is easier to compare to that
+ of implementations with different time representations.
+
-c [loyear,]hiyear
Cut off verbose output near the start of the given year(s). By
default, the program cuts off verbose output near the starts of
the years -500 and 2500.
+ -t [lotime,]hitime
+ Cut off verbose output at the start of the given time(s), given
+ in decimal seconds since 1970-01-01 00:00:00 UTC.
+
LIMITATIONS
- The -v option may not be used on systems with floating-point time_t
- values that are neither float nor double.
+ 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
diff --git a/elsie.nci.nih.gov/src/zdump.c b/elsie.nci.nih.gov/src/zdump.c
index 9255aff..be0a496 100644
--- a/elsie.nci.nih.gov/src/zdump.c
+++ b/elsie.nci.nih.gov/src/zdump.c
@@ -9,8 +9,15 @@
** This code has been made independent of the rest of the time
** conversion package to increase confidence in the verification it provides.
** You can use this code to help in verifying other implementations.
+**
+** However, include private.h when debugging, so that it overrides
+** time_t consistently with the rest of the package.
*/
+#ifdef time_tz
+# include "private.h"
+#endif
+
#include "stdio.h" /* for stdout, stderr, perror */
#include "string.h" /* for strcpy */
#include "sys/types.h" /* for time_t */
@@ -23,6 +30,47 @@
#define isascii(x) 1
#endif /* !defined isascii */
+/*
+** Substitutes for pre-C99 compilers.
+** Much of this section of code is stolen from private.h.
+*/
+
+#ifndef HAVE_STDINT_H
+# define HAVE_STDINT_H \
+ (199901 <= __STDC_VERSION__ || 2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
+#endif
+#if HAVE_STDINT_H
+# include "stdint.h"
+#endif
+#ifndef HAVE_INTTYPES_H
+# define HAVE_INTTYPES_H HAVE_STDINT_H
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
+#ifndef INT_FAST32_MAX
+# if INT_MAX >> 31 == 0
+typedef long int_fast32_t;
+# else
+typedef int int_fast32_t;
+# endif
+#endif
+
+#ifndef INTMAX_MAX
+# if defined LLONG_MAX || defined __LONG_LONG_MAX__
+typedef long long intmax_t;
+# define PRIdMAX "lld"
+# else
+typedef long intmax_t;
+# define PRIdMAX "ld"
+# endif
+#endif
+#ifndef SCNdMAX
+# define SCNdMAX PRIdMAX
+#endif
+
+
#ifndef ZDUMP_LO_YEAR
#define ZDUMP_LO_YEAR (-500)
#endif /* !defined ZDUMP_LO_YEAR */
@@ -90,7 +138,7 @@
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#endif /* !defined isleap_sum */
-#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
+#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
#define SECSPERNYEAR (SECSPERDAY * DAYSPERNYEAR)
#define SECSPERLYEAR (SECSPERNYEAR + SECSPERDAY)
@@ -112,14 +160,6 @@
#endif /* !defined lint */
#endif /* !defined GNUC_or_lint */
-#ifndef INITIALIZE
-#ifdef GNUC_or_lint
-#define INITIALIZE(x) ((x) = 0)
-#else /* !defined GNUC_or_lint */
-#define INITIALIZE(x)
-#endif /* !defined GNUC_or_lint */
-#endif /* !defined INITIALIZE */
-
#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
@@ -151,20 +191,16 @@ extern char * optarg;
extern int optind;
extern char * tzname[2];
-/* The minimum and maximum finite time values. Shift 'long long' or
- 'long' instead of 'time_t'; this avoids compile-time errors when
- time_t is floating-point. In practice, 'long long' is wide enough. */
+/* 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
-#ifdef LLONG_MAX
- ? (time_t) ((long long) -1 << (CHAR_BIT * sizeof (time_t) - 1))
-#else
- ? (time_t) ((long) -1 << (CHAR_BIT * sizeof (time_t) - 1))
+ ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
#endif
: 0);
static time_t const absolute_max_time =
@@ -173,26 +209,24 @@ static time_t const absolute_max_time =
: 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
-#ifdef LLONG_MAX
- ? (time_t) (- (~ 0 < 0) - ((long long) -1 << (CHAR_BIT * sizeof (time_t) - 1)))
-#else
- ? (time_t) (- (~ 0 < 0) - ((long) -1 << (CHAR_BIT * sizeof (time_t) - 1)))
+ ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
#endif
- : (time_t) -1);
+ : -1);
static size_t longest;
static char * progname;
static int warned;
static char * abbr(struct tm * tmp);
static void abbrok(const char * abbrp, const char * zone);
-static long delta(struct tm * newp, struct tm * oldp) ATTRIBUTE_PURE;
+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(long y) ATTRIBUTE_PURE;
+static time_t yeartot(intmax_t y) ATTRIBUTE_PURE;
#ifndef TYPECHECK
#define my_localtime localtime
@@ -270,9 +304,9 @@ static void
usage(FILE * const stream, const int status)
{
(void) fprintf(stream,
-_("%s: usage is %s [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n\
-\n\
-Report bugs to %s.\n"),
+_("%s: usage: %s [--version] [--help] [-{vV}] [-{ct} [lo,]hi] zonename ...\n"
+ "\n"
+ "Report bugs to %s.\n"),
progname, progname, REPORT_BUGS_TO);
exit(status);
}
@@ -281,11 +315,10 @@ int
main(int argc, char *argv[])
{
register int i;
- register int c;
register int vflag;
+ register int Vflag;
register char * cutarg;
- register long cutloyear = ZDUMP_LO_YEAR;
- register long cuthiyear = ZDUMP_HI_YEAR;
+ register char * cuttimes;
register time_t cutlotime;
register time_t cuthitime;
register char ** fakeenv;
@@ -297,8 +330,8 @@ main(int argc, char *argv[])
register struct tm * tmp;
register struct tm * newtmp;
- INITIALIZE(cutlotime);
- INITIALIZE(cuthitime);
+ cutlotime = absolute_min_time;
+ cuthitime = absolute_max_time;
#if HAVE_GETTEXT
(void) setlocale(LC_ALL, "");
#ifdef TZ_DOMAINDIR
@@ -314,25 +347,33 @@ main(int argc, char *argv[])
} else if (strcmp(argv[i], "--help") == 0) {
usage(stdout, EXIT_SUCCESS);
}
- vflag = 0;
- cutarg = NULL;
- while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v')
- if (c == 'v')
- vflag = 1;
- else cutarg = optarg;
- if ((c != EOF && c != -1) ||
- (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
- usage(stderr, EXIT_FAILURE);
- }
- if (vflag) {
+ vflag = Vflag = 0;
+ cutarg = cuttimes = NULL;
+ for (;;)
+ switch (getopt(argc, argv, "c:t:vV")) {
+ case 'c': cutarg = optarg; break;
+ case 't': cuttimes = optarg; break;
+ case 'v': vflag = 1; break;
+ case 'V': Vflag = 1; break;
+ case -1:
+ if (! (optind == argc - 1 && strcmp(argv[optind], "=") == 0))
+ goto arg_processing_done;
+ /* Fall through. */
+ default:
+ usage(stderr, EXIT_FAILURE);
+ }
+ arg_processing_done:;
+
+ if (vflag | Vflag) {
+ intmax_t lo;
+ intmax_t hi;
+ char dummy;
+ register intmax_t cutloyear = ZDUMP_LO_YEAR;
+ register intmax_t cuthiyear = ZDUMP_HI_YEAR;
if (cutarg != NULL) {
- long lo;
- long hi;
- char dummy;
-
- if (sscanf(cutarg, "%ld%c", &hi, &dummy) == 1) {
+ if (sscanf(cutarg, "%"SCNdMAX"%c", &hi, &dummy) == 1) {
cuthiyear = hi;
- } else if (sscanf(cutarg, "%ld,%ld%c",
+ } else if (sscanf(cutarg, "%"SCNdMAX",%"SCNdMAX"%c",
&lo, &hi, &dummy) == 2) {
cutloyear = lo;
cuthiyear = hi;
@@ -343,8 +384,36 @@ main(int argc, char *argv[])
}
}
checkabsolutes();
- cutlotime = yeartot(cutloyear);
- cuthitime = yeartot(cuthiyear);
+ if (cutarg != NULL || cuttimes == NULL) {
+ cutlotime = yeartot(cutloyear);
+ cuthitime = yeartot(cuthiyear);
+ }
+ if (cuttimes != NULL) {
+ if (sscanf(cuttimes, "%"SCNdMAX"%c", &hi, &dummy) == 1) {
+ if (hi < cuthitime) {
+ if (hi < absolute_min_time)
+ hi = absolute_min_time;
+ cuthitime = hi;
+ }
+ } else if (sscanf(cuttimes, "%"SCNdMAX",%"SCNdMAX"%c",
+ &lo, &hi, &dummy) == 2) {
+ if (cutlotime < lo) {
+ if (absolute_max_time < lo)
+ lo = absolute_max_time;
+ cutlotime = lo;
+ }
+ if (hi < cuthitime) {
+ if (hi < absolute_min_time)
+ hi = absolute_min_time;
+ cuthitime = hi;
+ }
+ } else {
+ (void) fprintf(stderr,
+ _("%s: wild -t argument %s\n"),
+ progname, cuttimes);
+ exit(EXIT_FAILURE);
+ }
+ }
}
(void) time(&now);
longest = 0;
@@ -375,15 +444,17 @@ main(int argc, char *argv[])
static char buf[MAX_STRING_LENGTH];
(void) strcpy(&fakeenv[0][3], argv[i]);
- if (!vflag) {
+ if (! (vflag | Vflag)) {
show(argv[i], now, FALSE);
continue;
}
warned = FALSE;
t = absolute_min_time;
- show(argv[i], t, TRUE);
- t += SECSPERHOUR * HOURSPERDAY;
- show(argv[i], t, TRUE);
+ if (!Vflag) {
+ show(argv[i], t, TRUE);
+ t += SECSPERHOUR * HOURSPERDAY;
+ show(argv[i], t, TRUE);
+ }
if (t < cutlotime)
t = cutlotime;
tmp = my_localtime(&t);
@@ -415,11 +486,13 @@ main(int argc, char *argv[])
tm = newtm;
tmp = newtmp;
}
- t = absolute_max_time;
- t -= SECSPERHOUR * HOURSPERDAY;
- show(argv[i], t, TRUE);
- t += SECSPERHOUR * HOURSPERDAY;
- show(argv[i], t, TRUE);
+ if (!Vflag) {
+ t = absolute_max_time;
+ t -= SECSPERHOUR * HOURSPERDAY;
+ show(argv[i], t, TRUE);
+ t += SECSPERHOUR * HOURSPERDAY;
+ show(argv[i], t, TRUE);
+ }
}
if (fflush(stdout) || ferror(stdout)) {
(void) fprintf(stderr, "%s: ", progname);
@@ -443,11 +516,11 @@ _("%s: use of -v on system with floating time_t other than float or double\n"),
}
static time_t
-yeartot(const long y)
+yeartot(const intmax_t y)
{
- register long myy;
- register long seconds;
- register time_t t;
+ register intmax_t myy;
+ register int_fast32_t seconds;
+ register time_t t;
myy = EPOCH_YEAR;
t = 0;
@@ -477,7 +550,6 @@ static time_t
hunt(char *name, time_t lot, time_t hit)
{
time_t t;
- long diff;
struct tm lotm;
register struct tm * lotmp;
struct tm tm;
@@ -490,7 +562,7 @@ hunt(char *name, time_t lot, time_t hit)
(void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
}
for ( ; ; ) {
- diff = (long) (hit - lot);
+ time_t diff = hit - lot;
if (diff < 2)
break;
t = lot;
@@ -520,11 +592,11 @@ hunt(char *name, time_t lot, time_t hit)
** Thanks to Paul Eggert for logic used in delta.
*/
-static long
+static intmax_t
delta(struct tm * newp, struct tm *oldp)
{
- register long result;
- register int tmy;
+ register intmax_t result;
+ register int tmy;
if (newp->tm_year < oldp->tm_year)
return -delta(oldp, newp);
@@ -600,12 +672,18 @@ tformat(void)
return "%g";
}
if (0 > (time_t) -1) { /* signed */
+ if (sizeof (time_t) == sizeof (intmax_t))
+ return "%"PRIdMAX;
if (sizeof (time_t) > sizeof (long))
return "%lld";
if (sizeof (time_t) > sizeof (int))
return "%ld";
return "%d";
}
+#ifdef PRIuMAX
+ if (sizeof (time_t) == sizeof (uintmax_t))
+ return "%"PRIuMAX;
+#endif
if (sizeof (time_t) > sizeof (unsigned long))
return "%llu";
if (sizeof (time_t) > sizeof (unsigned int))
diff --git a/elsie.nci.nih.gov/src/zic.8.txt b/elsie.nci.nih.gov/src/zic.8.txt
index 6b9d06a..058185b 100644
--- a/elsie.nci.nih.gov/src/zic.8.txt
+++ b/elsie.nci.nih.gov/src/zic.8.txt
@@ -1,4 +1,4 @@
-ZIC(8) ZIC(8)
+ZIC(8) System Manager's Manual ZIC(8)
NAME
zic - time zone compiler
diff --git a/elsie.nci.nih.gov/src/zic.c b/elsie.nci.nih.gov/src/zic.c
index 91f0d20..1715c4a 100644
--- a/elsie.nci.nih.gov/src/zic.c
+++ b/elsie.nci.nih.gov/src/zic.c
@@ -11,6 +11,9 @@
#define ZIC_VERSION '2'
typedef int_fast64_t zic_t;
+#define ZIC_MIN INT_FAST64_MIN
+#define ZIC_MAX INT_FAST64_MAX
+#define SCNdZIC SCNdFAST64
#ifndef ZIC_MAX_ABBR_LEN_WO_WARN
#define ZIC_MAX_ABBR_LEN_WO_WARN 6
@@ -38,9 +41,6 @@ typedef int_fast64_t zic_t;
#define isascii(x) 1
#endif
-#define OFFSET_STRLEN_MAXIMUM (7 + INT_STRLEN_MAXIMUM(long))
-#define RULE_STRLEN_MAXIMUM 8 /* "Mdd.dd.d" */
-
#define end(cp) (strchr((cp), '\0'))
struct rule {
@@ -48,8 +48,8 @@ struct rule {
int r_linenum;
const char * r_name;
- int r_loyear; /* for example, 1986 */
- int r_hiyear; /* for example, 1986 */
+ zic_t r_loyear; /* for example, 1986 */
+ zic_t r_hiyear; /* for example, 1986 */
const char * r_yrtype;
int r_lowasnum;
int r_hiwasnum;
@@ -60,12 +60,12 @@ struct rule {
int r_dayofmonth;
int r_wday;
- long r_tod; /* time from midnight */
+ zic_t r_tod; /* time from midnight */
int r_todisstd; /* above is standard time if TRUE */
/* or wall clock time if FALSE */
int r_todisgmt; /* above is GMT if TRUE */
/* or local time if FALSE */
- long r_stdoff; /* offset from standard time */
+ zic_t r_stdoff; /* offset from standard time */
const char * r_abbrvar; /* variable part of abbreviation */
int r_todo; /* a rule to do (used in outzone) */
@@ -85,11 +85,11 @@ struct zone {
int z_linenum;
const char * z_name;
- long z_gmtoff;
+ zic_t z_gmtoff;
const char * z_rule;
const char * z_format;
- long z_stdoff;
+ zic_t z_stdoff;
struct rule * z_rules;
int z_nrules;
@@ -105,16 +105,15 @@ extern char * optarg;
extern int optind;
static void addtt(zic_t starttime, int type);
-static int addtype(long gmtoff, const char * abbr, int isdst,
+static int addtype(zic_t gmtoff, const char * abbr, int isdst,
int ttisstd, int ttisgmt);
static void leapadd(zic_t t, int positive, int rolling, int count);
static void adjleap(void);
static void associate(void);
static void dolink(const char * fromfield, const char * tofield);
-static long eitol(int i);
static char ** getfields(char * buf);
-static long gethms(const char * string, const char * errstrng,
- int signable);
+static zic_t gethms(const char * string, const char * errstrng,
+ int signable);
static void infile(const char * filename);
static void inleap(char ** fields, int nfields);
static void inlink(char ** fields, int nfields);
@@ -126,14 +125,14 @@ static int itsdir(const char * name);
static int lowerit(int c);
static int mkdirs(char * filename);
static void newabbr(const char * abbr);
-static long oadd(long t1, long t2);
+static zic_t oadd(zic_t t1, zic_t t2);
static void outzone(const struct zone * zp, int ntzones);
-static zic_t rpytime(const struct rule * rp, int wantedy);
+static zic_t rpytime(const struct rule * rp, zic_t wantedy);
static void rulesub(struct rule * rp,
const char * loyearp, const char * hiyearp,
const char * typep, const char * monthp,
const char * dayp, const char * timep);
-static zic_t tadd(zic_t t1, long t2);
+static zic_t tadd(zic_t t1, zic_t t2);
static int yearistype(int year, const char * type);
static int charcnt;
@@ -141,13 +140,13 @@ static int errors;
static const char * filename;
static int leapcnt;
static int leapseen;
-static int leapminyear;
-static int leapmaxyear;
+static zic_t leapminyear;
+static zic_t leapmaxyear;
static int linenum;
static int max_abbrvar_len;
static int max_format_len;
-static int max_year;
-static int min_year;
+static zic_t max_year;
+static zic_t min_year;
static int noise;
static const char * rfilename;
static int rlinenum;
@@ -338,14 +337,14 @@ static struct attype {
zic_t at;
unsigned char type;
} attypes[TZ_MAX_TIMES];
-static long gmtoffs[TZ_MAX_TYPES];
+static zic_t gmtoffs[TZ_MAX_TYPES];
static char isdsts[TZ_MAX_TYPES];
static unsigned char abbrinds[TZ_MAX_TYPES];
static char ttisstds[TZ_MAX_TYPES];
static char ttisgmts[TZ_MAX_TYPES];
static char chars[TZ_MAX_CHARS];
static zic_t trans[TZ_MAX_LEAPS];
-static long corr[TZ_MAX_LEAPS];
+static zic_t corr[TZ_MAX_LEAPS];
static char roll[TZ_MAX_LEAPS];
/*
@@ -419,7 +418,7 @@ warning(const char *const string)
--errors;
}
-static void
+static _Noreturn void
usage(FILE *stream, int status)
{
(void) fprintf(stream, _("%s: usage is %s \
@@ -444,9 +443,9 @@ main(int argc, char **argv)
register int j;
register int c;
-#ifdef unix
+#ifdef S_IWGRP
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
-#endif /* defined unix */
+#endif
#if HAVE_GETTEXT
(void) setlocale(LC_ALL, "");
#ifdef TZ_DOMAINDIR
@@ -854,10 +853,10 @@ _("%s: panic: Invalid l_value %d\n"),
** Call error with errstring and return zero on errors.
*/
-static long
+static zic_t
gethms(const char *string, const char *const errstring, const int signable)
{
- long hh;
+ zic_t hh;
int mm, ss, sign;
if (string == NULL || *string == '\0')
@@ -868,11 +867,11 @@ gethms(const char *string, const char *const errstring, const int signable)
sign = -1;
++string;
} else sign = 1;
- if (sscanf(string, scheck(string, "%ld"), &hh) == 1)
+ if (sscanf(string, scheck(string, "%"SCNdZIC), &hh) == 1)
mm = ss = 0;
- else if (sscanf(string, scheck(string, "%ld:%d"), &hh, &mm) == 2)
+ else if (sscanf(string, scheck(string, "%"SCNdZIC":%d"), &hh, &mm) == 2)
ss = 0;
- else if (sscanf(string, scheck(string, "%ld:%d:%d"),
+ else if (sscanf(string, scheck(string, "%"SCNdZIC":%d:%d"),
&hh, &mm, &ss) != 3) {
error(errstring);
return 0;
@@ -883,7 +882,7 @@ gethms(const char *string, const char *const errstring, const int signable)
error(errstring);
return 0;
}
- if (LONG_MAX / SECSPERHOUR < hh) {
+ if (ZIC_MAX / SECSPERHOUR < hh) {
error(_("time overflow"));
return 0;
}
@@ -892,8 +891,8 @@ gethms(const char *string, const char *const errstring, const int signable)
if (noise && (hh > HOURSPERDAY ||
(hh == HOURSPERDAY && (mm != 0 || ss != 0))))
warning(_("values over 24 hours not handled by pre-2007 versions of zic"));
- return oadd(eitol(sign) * hh * eitol(SECSPERHOUR),
- eitol(sign) * (eitol(mm) * eitol(SECSPERMIN) + eitol(ss)));
+ return oadd(sign * hh * SECSPERHOUR,
+ sign * (mm * SECSPERMIN + ss));
}
static void
@@ -1058,8 +1057,9 @@ inleap(register char ** const fields, const int nfields)
register const char * cp;
register const struct lookup * lp;
register int i, j;
- int year, month, day;
- long dayoff, tod;
+ zic_t year;
+ int month, day;
+ zic_t dayoff, tod;
zic_t t;
if (nfields != LEAP_FIELDS) {
@@ -1068,7 +1068,7 @@ inleap(register char ** const fields, const int nfields)
}
dayoff = 0;
cp = fields[LP_YEAR];
- if (sscanf(cp, scheck(cp, "%d"), &year) != 1) {
+ if (sscanf(cp, scheck(cp, "%"SCNdZIC), &year) != 1) {
/*
** Leapin' Lizards!
*/
@@ -1089,7 +1089,7 @@ inleap(register char ** const fields, const int nfields)
--j;
i = -len_years[isleap(j)];
}
- dayoff = oadd(dayoff, eitol(i));
+ dayoff = oadd(dayoff, i);
}
if ((lp = byword(fields[LP_MONTH], mon_names)) == NULL) {
error(_("invalid month name"));
@@ -1099,7 +1099,7 @@ inleap(register char ** const fields, const int nfields)
j = TM_JANUARY;
while (j != month) {
i = len_months[isleap(year)][j];
- dayoff = oadd(dayoff, eitol(i));
+ dayoff = oadd(dayoff, i);
++j;
}
cp = fields[LP_DAY];
@@ -1108,7 +1108,7 @@ inleap(register char ** const fields, const int nfields)
error(_("invalid day of month"));
return;
}
- dayoff = oadd(dayoff, eitol(day - 1));
+ dayoff = oadd(dayoff, day - 1);
if (dayoff < 0 && !TYPE_SIGNED(zic_t)) {
error(_("time before zero"));
return;
@@ -1233,17 +1233,17 @@ rulesub(register struct rule *const rp,
rp->r_lowasnum = lp == NULL;
if (!rp->r_lowasnum) switch ((int) lp->l_value) {
case YR_MINIMUM:
- rp->r_loyear = INT_MIN;
+ rp->r_loyear = ZIC_MIN;
break;
case YR_MAXIMUM:
- rp->r_loyear = INT_MAX;
+ rp->r_loyear = ZIC_MAX;
break;
default: /* "cannot happen" */
(void) fprintf(stderr,
_("%s: panic: Invalid l_value %d\n"),
progname, lp->l_value);
exit(EXIT_FAILURE);
- } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1) {
+ } else if (sscanf(cp, scheck(cp, "%"SCNdZIC), &rp->r_loyear) != 1) {
error(_("invalid starting year"));
return;
}
@@ -1252,10 +1252,10 @@ rulesub(register struct rule *const rp,
rp->r_hiwasnum = lp == NULL;
if (!rp->r_hiwasnum) switch ((int) lp->l_value) {
case YR_MINIMUM:
- rp->r_hiyear = INT_MIN;
+ rp->r_hiyear = ZIC_MIN;
break;
case YR_MAXIMUM:
- rp->r_hiyear = INT_MAX;
+ rp->r_hiyear = ZIC_MAX;
break;
case YR_ONLY:
rp->r_hiyear = rp->r_loyear;
@@ -1265,7 +1265,7 @@ rulesub(register struct rule *const rp,
_("%s: panic: Invalid l_value %d\n"),
progname, lp->l_value);
exit(EXIT_FAILURE);
- } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1) {
+ } else if (sscanf(cp, scheck(cp, "%"SCNdZIC), &rp->r_hiyear) != 1) {
error(_("invalid ending year"));
return;
}
@@ -1330,7 +1330,7 @@ rulesub(register struct rule *const rp,
}
static void
-convert(const long val, char *const buf)
+convert(const int_fast32_t val, char *const buf)
{
register int i;
register int shift;
@@ -1352,7 +1352,7 @@ convert64(const zic_t val, char *const buf)
}
static void
-puttzcode(const long val, FILE *const fp)
+puttzcode(const int_fast32_t val, FILE *const fp)
{
char buf[4];
@@ -1414,8 +1414,11 @@ writezone(const char *const name, const char *const string)
fromi = 0;
while (fromi < timecnt && attypes[fromi].at < min_time)
++fromi;
- if (isdsts[0] == 0)
- while (fromi < timecnt && attypes[fromi].type == 0)
+ /*
+ ** Remember that type 0 is reserved.
+ */
+ if (isdsts[1] == 0)
+ while (fromi < timecnt && attypes[fromi].type == 1)
++fromi; /* handled by default rule */
for ( ; fromi < timecnt; ++fromi) {
if (toi != 0 && ((attypes[fromi].at +
@@ -1517,7 +1520,11 @@ writezone(const char *const name, const char *const string)
}
thistimelim = thistimei + thistimecnt;
thisleaplim = thisleapi + thisleapcnt;
- for (i = 0; i < typecnt; ++i)
+ /*
+ ** Remember that type 0 is reserved.
+ */
+ writetype[0] = FALSE;
+ for (i = 1; i < typecnt; ++i)
writetype[i] = thistimecnt == timecnt;
if (thistimecnt == 0) {
/*
@@ -1533,8 +1540,11 @@ writezone(const char *const name, const char *const string)
/*
** For America/Godthab and Antarctica/Palmer
*/
+ /*
+ ** Remember that type 0 is reserved.
+ */
if (thistimei == 0)
- writetype[0] = TRUE;
+ writetype[1] = TRUE;
}
#ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
/*
@@ -1584,8 +1594,26 @@ writezone(const char *const name, const char *const string)
}
#endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */
thistypecnt = 0;
+ /*
+ ** Potentially, set type 0 to that of lowest-valued time.
+ */
+ if (thistimei > 0) {
+ for (i = 1; i < typecnt; ++i)
+ if (writetype[i] && !isdsts[i])
+ break;
+ if (i != types[thistimei - 1]) {
+ i = types[thistimei - 1];
+ gmtoffs[0] = gmtoffs[i];
+ isdsts[0] = isdsts[i];
+ ttisstds[0] = ttisstds[i];
+ ttisgmts[0] = ttisgmts[i];
+ abbrinds[0] = abbrinds[i];
+ writetype[0] = TRUE;
+ writetype[i] = FALSE;
+ }
+ }
for (i = 0; i < typecnt; ++i)
- typemap[i] = writetype[i] ? thistypecnt++ : -1;
+ typemap[i] = writetype[i] ? thistypecnt++ : 0;
for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i)
indmap[i] = -1;
thischarcnt = 0;
@@ -1611,12 +1639,12 @@ writezone(const char *const name, const char *const string)
tzh = tzh0;
(void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
tzh.tzh_version[0] = ZIC_VERSION;
- convert(eitol(thistypecnt), tzh.tzh_ttisgmtcnt);
- convert(eitol(thistypecnt), tzh.tzh_ttisstdcnt);
- convert(eitol(thisleapcnt), tzh.tzh_leapcnt);
- convert(eitol(thistimecnt), tzh.tzh_timecnt);
- convert(eitol(thistypecnt), tzh.tzh_typecnt);
- convert(eitol(thischarcnt), tzh.tzh_charcnt);
+ convert(thistypecnt, tzh.tzh_ttisgmtcnt);
+ convert(thistypecnt, tzh.tzh_ttisstdcnt);
+ convert(thisleapcnt, tzh.tzh_leapcnt);
+ convert(thistimecnt, tzh.tzh_timecnt);
+ convert(thistypecnt, tzh.tzh_typecnt);
+ convert(thischarcnt, tzh.tzh_charcnt);
DO(tzh_magic);
DO(tzh_version);
DO(tzh_reserved);
@@ -1629,7 +1657,7 @@ writezone(const char *const name, const char *const string)
#undef DO
for (i = thistimei; i < thistimelim; ++i)
if (pass == 1)
- puttzcode((long) ats[i], fp);
+ puttzcode(ats[i], fp);
else puttzcode64(ats[i], fp);
for (i = thistimei; i < thistimelim; ++i) {
unsigned char uc;
@@ -1723,7 +1751,7 @@ doabbr(char *const abbr, const char *const format, const char *const letters,
}
static void
-updateminmax(const int x)
+updateminmax(const zic_t x)
{
if (min_year > x)
min_year = x;
@@ -1732,7 +1760,7 @@ updateminmax(const int x)
}
static int
-stringoffset(char *result, long offset)
+stringoffset(char *result, zic_t offset)
{
register int hours;
register int minutes;
@@ -1762,10 +1790,10 @@ stringoffset(char *result, long offset)
}
static int
-stringrule(char *result, const struct rule *const rp, const long dstoff,
- const long gmtoff)
+stringrule(char *result, const struct rule *const rp, const zic_t dstoff,
+ const zic_t gmtoff)
{
- register long tod;
+ register zic_t tod;
result = end(result);
if (rp->r_dycode == DC_DOM) {
@@ -1828,7 +1856,7 @@ stringzone(char *result, const struct zone *const zpfirst, const int zonecount)
stdrp = dstrp = NULL;
for (i = 0; i < zp->z_nrules; ++i) {
rp = &zp->z_rules[i];
- if (rp->r_hiwasnum || rp->r_hiyear != INT_MAX)
+ if (rp->r_hiwasnum || rp->r_hiyear != ZIC_MAX)
continue;
if (rp->r_yrtype != NULL)
continue;
@@ -1903,10 +1931,10 @@ outzone(const struct zone * const zpfirst, const int zonecount)
register int i, j;
register int usestart, useuntil;
register zic_t starttime, untiltime;
- register long gmtoff;
- register long stdoff;
- register int year;
- register long startoff;
+ register zic_t gmtoff;
+ register zic_t stdoff;
+ register zic_t year;
+ register zic_t startoff;
register int startttisstd;
register int startttisgmt;
register int type;
@@ -1940,8 +1968,13 @@ outzone(const struct zone * const zpfirst, const int zonecount)
min_year = max_year = EPOCH_YEAR;
if (leapseen) {
updateminmax(leapminyear);
- updateminmax(leapmaxyear + (leapmaxyear < INT_MAX));
+ updateminmax(leapmaxyear + (leapmaxyear < ZIC_MAX));
}
+ /*
+ ** Reserve type 0.
+ */
+ gmtoffs[0] = isdsts[0] = ttisstds[0] = ttisgmts[0] = abbrinds[0] = -1;
+ typecnt = 1;
for (i = 0; i < zonecount; ++i) {
zp = &zpfirst[i];
if (i < zonecount - 1)
@@ -1970,12 +2003,12 @@ wp = ecpyalloc(_("no POSIX environment variable for zone"));
free(wp);
}
if (envvar[0] == '\0') {
- if (min_year >= INT_MIN + YEARSPERREPEAT)
+ if (min_year >= ZIC_MIN + YEARSPERREPEAT)
min_year -= YEARSPERREPEAT;
- else min_year = INT_MIN;
- if (max_year <= INT_MAX - YEARSPERREPEAT)
+ else min_year = ZIC_MIN;
+ if (max_year <= ZIC_MAX - YEARSPERREPEAT)
max_year += YEARSPERREPEAT;
- else max_year = INT_MAX;
+ else max_year = ZIC_MAX;
/*
** Regardless of any of the above,
** for a "proDSTic" zone which specifies that its rules
@@ -2041,7 +2074,7 @@ wp = ecpyalloc(_("no POSIX environment variable for zone"));
for ( ; ; ) {
register int k;
register zic_t jtime, ktime;
- register long offset;
+ register zic_t offset;
INITIALIZE(ktime);
if (useuntil) {
@@ -2183,7 +2216,7 @@ addtt(const zic_t starttime, int type)
}
static int
-addtype(const long gmtoff, const char *const abbr, const int isdst,
+addtype(const zic_t gmtoff, const char *const abbr, const int isdst,
const int ttisstd, const int ttisgmt)
{
register int i, j;
@@ -2262,7 +2295,7 @@ leapadd(const zic_t t, const int positive, const int rolling, int count)
roll[j] = roll[j - 1];
}
trans[i] = t;
- corr[i] = positive ? 1L : eitol(-count);
+ corr[i] = positive ? 1 : -count;
roll[i] = rolling;
++leapcnt;
} while (positive && --count != 0);
@@ -2272,7 +2305,7 @@ static void
adjleap(void)
{
register int i;
- register long last = 0;
+ register zic_t last = 0;
/*
** propagate leap seconds forward
@@ -2406,10 +2439,10 @@ getfields(register char *cp)
return array;
}
-static ATTRIBUTE_PURE long
-oadd(const long t1, const long t2)
+static ATTRIBUTE_PURE zic_t
+oadd(const zic_t t1, const zic_t t2)
{
- if (t1 < 0 ? t2 < LONG_MIN - t1 : LONG_MAX - t1 < t2) {
+ if (t1 < 0 ? t2 < ZIC_MIN - t1 : ZIC_MAX - t1 < t2) {
error(_("time overflow"));
exit(EXIT_FAILURE);
}
@@ -2417,7 +2450,7 @@ oadd(const long t1, const long t2)
}
static ATTRIBUTE_PURE zic_t
-tadd(const zic_t t1, const long t2)
+tadd(const zic_t t1, const zic_t t2)
{
if (t1 == max_time && t2 > 0)
return max_time;
@@ -2436,15 +2469,15 @@ tadd(const zic_t t1, const long t2)
*/
static zic_t
-rpytime(register const struct rule *const rp, register const int wantedy)
+rpytime(register const struct rule *const rp, register const zic_t wantedy)
{
- register int y, m, i;
- register long dayoff; /* with a nod to Margaret O. */
- register zic_t t;
+ register int m, i;
+ register zic_t dayoff; /* with a nod to Margaret O. */
+ register zic_t t, y;
- if (wantedy == INT_MIN)
+ if (wantedy == ZIC_MIN)
return min_time;
- if (wantedy == INT_MAX)
+ if (wantedy == ZIC_MAX)
return max_time;
dayoff = 0;
m = TM_JANUARY;
@@ -2457,11 +2490,11 @@ rpytime(register const struct rule *const rp, register const int wantedy)
--y;
i = -len_years[isleap(y)];
}
- dayoff = oadd(dayoff, eitol(i));
+ dayoff = oadd(dayoff, i);
}
while (m != rp->r_month) {
i = len_months[isleap(y)][m];
- dayoff = oadd(dayoff, eitol(i));
+ dayoff = oadd(dayoff, i);
++m;
}
i = rp->r_dayofmonth;
@@ -2474,12 +2507,12 @@ rpytime(register const struct rule *const rp, register const int wantedy)
}
}
--i;
- dayoff = oadd(dayoff, eitol(i));
+ dayoff = oadd(dayoff, i);
if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) {
- register long wday;
+ register zic_t wday;
-#define LDAYSPERWEEK ((long) DAYSPERWEEK)
- wday = eitol(EPOCH_WDAY);
+#define LDAYSPERWEEK ((zic_t) DAYSPERWEEK)
+ wday = EPOCH_WDAY;
/*
** Don't trust mod of negative numbers.
*/
@@ -2490,7 +2523,7 @@ rpytime(register const struct rule *const rp, register const int wantedy)
if (wday < 0)
wday += LDAYSPERWEEK;
}
- while (wday != eitol(rp->r_wday))
+ while (wday != rp->r_wday)
if (rp->r_dycode == DC_DOWGEQ) {
dayoff = oadd(dayoff, 1);
if (++wday >= LDAYSPERWEEK)
@@ -2565,7 +2598,7 @@ mp = _("time zone abbreviation differs from POSIX standard");
exit(EXIT_FAILURE);
}
(void) strcpy(&chars[charcnt], string);
- charcnt += eitol(i);
+ charcnt += i;
}
static int
@@ -2579,7 +2612,7 @@ mkdirs(char *argname)
cp = name = ecpyalloc(argname);
while ((cp = strchr(cp + 1, '/')) != 0) {
*cp = '\0';
-#ifndef unix
+#ifdef HAVE_DOS_FILE_NAMES
/*
** DOS drive specifier?
*/
@@ -2588,7 +2621,7 @@ mkdirs(char *argname)
*cp = '/';
continue;
}
-#endif /* !defined unix */
+#endif
if (!itsdir(name)) {
/*
** It doesn't seem to exist, so we try to create it.
@@ -2614,21 +2647,6 @@ _("%s: Can't create directory %s: %s\n"),
return 0;
}
-static ATTRIBUTE_PURE long
-eitol(const int i)
-{
- long l;
-
- l = i;
- if ((i < 0 && l >= 0) || (i == 0 && l != 0) || (i > 0 && l <= 0)) {
- (void) fprintf(stderr,
- _("%s: %d did not sign extend correctly\n"),
- progname, i);
- exit(EXIT_FAILURE);
- }
- return l;
-}
-
/*
** UNIX was a registered trademark of The Open Group in 2003.
*/
diff --git a/elsie.nci.nih.gov/src/zone.tab b/elsie.nci.nih.gov/src/zone.tab
index 6b98520..3ec24a7 100644
--- a/elsie.nci.nih.gov/src/zone.tab
+++ b/elsie.nci.nih.gov/src/zone.tab
@@ -1,18 +1,21 @@
-# <pre>
+# TZ zone descriptions
+#
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
-# TZ zone descriptions
-#
-# From Paul Eggert (1996-08-05):
+# From Paul Eggert (2013-05-27):
#
# 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
# 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.
# 4. Comments; present if and only if the country has multiple rows.
#
# Columns are separated by a single tab.
@@ -22,6 +25,10 @@
#
# 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
+# to take or endorse any position on legal or territorial claims.
+#
#country-
#code coordinates TZ comments
AD +4230+00131 Europe/Andorra
@@ -216,7 +223,7 @@ ID -0002+10920 Asia/Pontianak west & central Borneo
ID -0507+11924 Asia/Makassar east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
ID -0232+14042 Asia/Jayapura west New Guinea (Irian Jaya) & Malukus (Moluccas)
IE +5320-00615 Europe/Dublin
-IL +3146+03514 Asia/Jerusalem
+IL +314650+0351326 Asia/Jerusalem
IM +5409-00428 Europe/Isle_of_Man
IN +2232+08822 Asia/Kolkata
IO -0720+07225 Indian/Chagos