Module Name: src
Committed By: christos
Date: Tue May 13 16:33:56 UTC 2014
Modified Files:
src/lib/libc/time: Makefile NEWS checktab.awk localtime.c private.h
tz-link.htm tzfile.h tzset.3 zdump.c zic.c
Log Message:
Welcome to 2014c
Changes affecting code
zic now generates transitions for minimum time values, eliminating
guesswork when handling low-valued time stamps. (Thanks to Arthur
David Olson.)
Port to Cygwin sans glibc. (Thanks to Arthur David Olson.)
Changes affecting commentary and documentation
Remove now-confusing comment about Jordan. (Thanks to Oleksii
Nochovnyi.)
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/time/Makefile
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/NEWS
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/time/checktab.awk
cvs rdiff -u -r1.81 -r1.82 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/private.h \
src/lib/libc/time/zdump.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/tz-link.htm \
src/lib/libc/time/tzfile.h
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/tzset.3
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/zic.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/time/Makefile
diff -u src/lib/libc/time/Makefile:1.17 src/lib/libc/time/Makefile:1.18
--- src/lib/libc/time/Makefile:1.17 Mon Jan 27 03:18:08 2014
+++ src/lib/libc/time/Makefile Tue May 13 12:33:56 2014
@@ -6,7 +6,7 @@
PACKAGE= tzcode
# Version numbers of the code and data distributions.
-VERSION= 2013i
+VERSION= 2014c
# Email address for bug reports.
BUGEMAIL= [email protected]
@@ -137,7 +137,7 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-co
-Wbad-function-cast -Wcast-align -Wcast-qual \
-Wformat=2 -Winit-self \
-Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
- -Wnested-externs \
+ -Wnested-externs -Wno-address -Wno-cast-qual \
-Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
-Wno-type-limits \
-Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
@@ -247,14 +247,13 @@ AWK= awk
# is typically nicer if it works.
KSHELL= /bin/bash
-# The path where SGML DTDs are kept.
-# The default is appropriate for Ubuntu 12.10.
+# The path where SGML DTDs are kept and the catalog file(s) to use when
+# validating. The default is appropriate for Ubuntu 13.10.
SGML_TOPDIR= /usr
SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
-
-# The catalog file(s) to use when validating.
-SGML_CATALOG_FILES= HTML4.cat
+SGML_CATALOG_FILES= \
+ $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat
# The name, arguments and environment of a program to validate your web pages.
# See <http://www.jclark.com/sp/> for a validator, and
@@ -445,7 +444,7 @@ check_web: $(WEB_PAGES)
clean_misc:
rm -f core *.o *.out \
- date tzselect version.h zdump zic yearistype
+ date tzselect version.h zdump zic yearistype libtz.a
clean: clean_misc
rm -fr tzpublic
Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.1 src/lib/libc/time/NEWS:1.2
--- src/lib/libc/time/NEWS:1.1 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/NEWS Tue May 13 12:33:56 2014
@@ -1,5 +1,138 @@
News for the tz database
+
+Release 2014c - 2014-05-13 07:44:13 -0700
+
+ Changes affecting near-future time stamps
+
+ Egypt observes DST starting May 15. (Thanks to Ahmad El-Dardiry.)
+ Details have not been announced, except that DST will not be observed
+ during Ramadan. Guess that DST will stop during the same Ramadan dates as
+ Morocco, and that Egypt's future spring and fall transitions will be the
+ same as 2010 when it last observed DST, namely April's last Friday at
+ 00:00 to September's last Thursday at 23:00 standard time. Also, guess
+ that Ramadan transitions will be at 00:00 standard time.
+
+ Changes affecting code
+
+ zic now generates transitions for minimum time values, eliminating guesswork
+ when handling low-valued time stamps. (Thanks to Arthur David Olson.)
+
+ Port to Cygwin sans glibc. (Thanks to Arthur David Olson.)
+
+ Changes affecting commentary and documentation
+
+ Remove now-confusing comment about Jordan. (Thanks to Oleksii Nochovnyi.)
+
+
+Release 2014b - 2014-03-24 21:28:50 -0700
+
+ Changes affecting near-future time stamps
+
+ Crimea switches to Moscow time on 2014-03-30 at 02:00 local time.
+ (Thanks to Alexander Krivenyshev.) Move its zone.tab entry from UA to RU.
+
+ New entry for Troll station, Antarctica. (Thanks to Paul-Inge Flakstad and
+ Bengt-Inge Larsson.) This is currently an approximation; a better version
+ will require the zic and localtime fixes mentioned below, and the plan is
+ to wait for a while until at least the zic fixes propagate.
+
+ Changes affecting code
+
+ 'zic' and 'localtime' no longer reject locations needing four transitions
+ per year for the forseeable future. (Thanks to Andrew Main (Zefram).)
+ Also, 'zic' avoids some unlikely failures due to integer overflow.
+
+ Changes affecting build procedure
+
+ 'make check' now detects Rule lines defined but never used.
+ The NZAQ rules, an instance of this problem, have been removed.
+
+ Changes affecting commentary and documentation
+
+ Fix Tuesday/Thursday typo in description of time in Israel.
+ (Thanks to Bert Katz via Pavel Kharitonov and Mike Frysinger.)
+
+ Microsoft Windows 8.1 doesn't support tz database names. (Thanks
+ to Donald MacQueen.) Instead, the Microsoft Windows Store app
+ library supports them.
+
+ Add comments about Johnston Island time in the 1960s.
+ (Thanks to Lyle McElhaney.)
+
+ Morocco's 2014 DST start will be as predicted.
+ (Thanks to Sebastien Willemijns.)
+
+
+Release 2014a - 2014-03-07 23:30:29 -0800
+
+ Changes affecting near-future time stamps
+
+ Turkey begins DST on 2014-03-31, not 03-30. (Thanks to Faruk Pasin for
+ the heads-up, and to Tim Parenti for simplifying the update.)
+
+ Changes affecting past time stamps
+
+ Fiji ended DST on 2014-01-19 at 02:00, not the previously-scheduled 03:00.
+ (Thanks to Steffen Thorsen.)
+
+ Ukraine switched from Moscow to Eastern European time on 1990-07-01
+ (not 1992-01-01), and observed DST during the entire next winter.
+ (Thanks to Vladimir in Moscow via Alois Treindl.)
+
+ In 1988 Israel observed DST from 04-10 to 09-04, not 04-09 to 09-03.
+ (Thanks to Avigdor Finkelstein.)
+
+ Changes affecting code
+
+ A uninitialized-storage bug in 'localtime' has been fixed.
+ (Thanks to Logan Chien.)
+
+ Changes affecting the build procedure
+
+ The settings for 'make check_web' now default to Ubuntu 13.10.
+
+ Changes affecting commentary and documentation
+
+ The boundary of the US Pacific time zone is given more accurately.
+ (Thanks to Alan Mintz.)
+
+ Chile's 2014 DST will be as predicted. (Thanks to Jose Miguel Garrido.)
+
+ Paraguay's 2014 DST will be as predicted. (Thanks to Carlos Raul Perasso.)
+
+ Better descriptions of countries with same time zone history as
+ Trinidad and Tobago since 1970. (Thanks to Alan Barrett for suggestion.)
+
+ Several changes affect tz-link.htm, the main web page.
+
+ Mention Time.is (thanks to Even Scharning) and WX-now (thanks to
+ David Braverman).
+
+ Mention xCal (Internet RFC 6321) and jCal.
+
+ Microsoft has some support for tz database names.
+
+ CLDR data is available in both XML and JSON form.
+
+ Mention Maggiolo's map of solar vs standard time.
+ (Thanks to Arthur David Olson.)
+
+ Mention TZ4Net. (Thanks to Matt Johnson.)
+
+ Mention the timezone-olson Haskell package.
+
+ Mention zeitverschiebung.net. (Thanks to Martin Jaeger.)
+
+ Remove moribund links to daylight-savings-time.info and to
+ Simple Timer + Clocks.
+
+ Update two links. (Thanks to Oscar van Vlijmen.)
+
+ Fix some formatting glitches, e.g., remove random newlines from
+ abbr elements' title attributes.
+
+
Release 2013i - 2013-12-17 07:25:23 -0800
Changes affecting near-future time stamps:
@@ -29,6 +162,7 @@ Release 2013i - 2013-12-17 07:25:23 -080
tz-link.htm now mentions Noda Time. (Thanks to Matt Johnson.)
+
Release 2013h - 2013-10-25 15:32:32 -0700
Changes affecting current and future time stamps:
Index: src/lib/libc/time/checktab.awk
diff -u src/lib/libc/time/checktab.awk:1.6 src/lib/libc/time/checktab.awk:1.7
--- src/lib/libc/time/checktab.awk:1.6 Fri Sep 20 15:06:54 2013
+++ src/lib/libc/time/checktab.awk Tue May 13 12:33:56 2014
@@ -1,4 +1,4 @@
-# $NetBSD: checktab.awk,v 1.6 2013/09/20 19:06:54 christos Exp $
+# $NetBSD: checktab.awk,v 1.7 2014/05/13 16:33:56 christos Exp $
# Check tz tables for consistency.
@@ -117,10 +117,14 @@ BEGIN {
FS = " "
}
+$1 ~ /^#/ { next }
+
{
- tz = ""
- if ($1 == "Zone") tz = $2
- if ($1 == "Link") {
+ tz = rules = ""
+ if ($1 == "Zone") {
+ tz = $2
+ ruleUsed[$4] = 1
+ } else if ($1 == "Link") {
# Ignore Link commands if source and destination basenames
# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
src = $2
@@ -128,6 +132,10 @@ BEGIN {
while ((i = index(src, "/"))) src = substr(src, i+1)
while ((i = index(dst, "/"))) dst = substr(dst, i+1)
if (src != dst) tz = $3
+ } else if ($1 == "Rule") {
+ ruleDefined[$2] = 1
+ } else {
+ ruleUsed[$2] = 1
}
if (tz && tz ~ /\//) {
if (!tztab[tz]) {
@@ -140,6 +148,12 @@ BEGIN {
}
END {
+ for (tz in ruleDefined) {
+ if (!ruleUsed[tz]) {
+ printf "%s: Rule never used\n", tz
+ status = 1
+ }
+ }
for (tz in tz2cc) {
if (!zoneSeen[tz]) {
printf "%s:%d: no Zone table for `%s'\n", \
Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.81 src/lib/libc/time/localtime.c:1.82
--- src/lib/libc/time/localtime.c:1.81 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/localtime.c Tue May 13 12:33:56 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: localtime.c,v 1.81 2013/12/26 18:34:28 christos Exp $ */
+/* $NetBSD: localtime.c,v 1.82 2014/05/13 16:33:56 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
#if 0
static char elsieid[] = "@(#)localtime.c 8.17";
#else
-__RCSID("$NetBSD: localtime.c,v 1.81 2013/12/26 18:34:28 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.82 2014/05/13 16:33:56 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -388,7 +388,7 @@ tzload(timezone_t sp, const char *name,
} u_t;
u_t * up;
- up = calloc(1, sizeof *up);
+ up = malloc(sizeof *up);
if (up == NULL)
return -1;
@@ -1062,6 +1062,7 @@ tzparse(timezone_t sp, const char *name,
sp->ttis[1].tt_gmtoff = -stdoffset;
sp->ttis[1].tt_isdst = 0;
sp->ttis[1].tt_abbrind = 0;
+ sp->defaulttype = 0;
timecnt = 0;
janfirst = 0;
sp->timecnt = 0;
@@ -1189,6 +1190,7 @@ tzparse(timezone_t sp, const char *name,
sp->ttis[1].tt_isdst = TRUE;
sp->ttis[1].tt_abbrind = (int)(stdlen + 1);
sp->typecnt = 2;
+ sp->defaulttype = 0;
}
} else {
dstlen = 0;
@@ -1198,6 +1200,7 @@ tzparse(timezone_t sp, const char *name,
sp->ttis[0].tt_gmtoff = -stdoffset;
sp->ttis[0].tt_isdst = 0;
sp->ttis[0].tt_abbrind = 0;
+ sp->defaulttype = 0;
}
sp->charcnt = (int)(stdlen + 1);
if (dstlen != 0)
@@ -1225,7 +1228,7 @@ gmtload(timezone_t sp)
timezone_t
tzalloc(const char *name)
{
- timezone_t sp = calloc(1, sizeof *sp);
+ timezone_t sp = malloc(sizeof *sp);
if (sp == NULL)
return NULL;
if (tzload(sp, name, TRUE) != 0) {
@@ -1251,7 +1254,7 @@ tzsetwall_unlocked(void)
if (lclptr == NULL) {
int saveerrno = errno;
- lclptr = calloc(1, sizeof *lclptr);
+ lclptr = malloc(sizeof *lclptr);
errno = saveerrno;
if (lclptr == NULL) {
settzname(); /* all we can do */
@@ -1304,7 +1307,7 @@ tzset_unlocked(void)
if (lclptr == NULL) {
int saveerrno = errno;
- lclptr = calloc(1, sizeof *lclptr);
+ lclptr = malloc(sizeof *lclptr);
errno = saveerrno;
if (lclptr == NULL) {
settzname(); /* all we can do */
@@ -1469,7 +1472,7 @@ gmtsub(const timezone_t sp, const time_t
int saveerrno;
gmt_is_set = TRUE;
saveerrno = errno;
- gmtptr = calloc(1, sizeof *gmtptr);
+ gmtptr = malloc(sizeof *gmtptr);
errno = saveerrno;
if (gmtptr != NULL)
gmtload(gmtptr);
@@ -1482,13 +1485,8 @@ gmtsub(const timezone_t sp, const time_t
** "UT+xxxx" or "UT-xxxx" if offset is non-zero,
** but this is no time for a treasure hunt.
*/
- if (offset != 0)
- tmp->TM_ZONE = (__aconst char *)__UNCONST(wildabbr);
- else {
- if (gmtptr == NULL)
- tmp->TM_ZONE = (__aconst char *)__UNCONST(gmt);
- else tmp->TM_ZONE = gmtptr->chars;
- }
+ tmp->TM_ZONE = offset ? __UNCONST(wildabbr) : gmtptr ? gmtptr->chars :
+ __UNCONST(gmt);
#endif /* defined TM_ZONE */
return result;
}
@@ -2075,17 +2073,15 @@ time1(const timezone_t sp, struct tm *co
if (tmp->tm_isdst > 1)
tmp->tm_isdst = 1;
t = time2(sp, tmp, funcp, offset, &okay);
-#ifdef PCTS
- /*
- ** PCTS code courtesy Grant Sullivan.
- */
if (okay)
return t;
if (tmp->tm_isdst < 0)
+#ifdef PCTS
+ /*
+ ** POSIX Conformance Test Suite code courtesy Grant Sullivan.
+ */
tmp->tm_isdst = 0; /* reset to std and try again */
-#endif /* defined PCTS */
-#ifndef PCTS
- if (okay || tmp->tm_isdst < 0)
+#else
return t;
#endif /* !defined PCTS */
/*
Index: src/lib/libc/time/private.h
diff -u src/lib/libc/time/private.h:1.32 src/lib/libc/time/private.h:1.33
--- src/lib/libc/time/private.h:1.32 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/private.h Tue May 13 12:33:56 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: private.h,v 1.32 2013/12/26 18:34:28 christos Exp $ */
+/* $NetBSD: private.h,v 1.33 2014/05/13 16:33:56 christos Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
@@ -132,8 +132,9 @@
*/
#ifndef HAVE_STDINT_H
#define HAVE_STDINT_H \
- (199901 <= __STDC_VERSION__ || \
- 2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
+ (199901 <= __STDC_VERSION__ \
+ || 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__) \
+ || __CYGWIN__)
#endif /* !defined HAVE_STDINT_H */
#if HAVE_STDINT_H
@@ -217,6 +218,10 @@ typedef unsigned long uintmax_t;
#define INT32_MIN (-1 - INT32_MAX)
#endif /* !defined INT32_MIN */
+#ifndef SIZE_MAX
+#define SIZE_MAX ((size_t) -1)
+#endif
+
#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
# define ATTRIBUTE_CONST __attribute__ ((__const__))
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
Index: src/lib/libc/time/zdump.c
diff -u src/lib/libc/time/zdump.c:1.32 src/lib/libc/time/zdump.c:1.33
--- src/lib/libc/time/zdump.c:1.32 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/zdump.c Tue May 13 12:33:56 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: zdump.c,v 1.32 2013/12/26 18:34:28 christos Exp $ */
+/* $NetBSD: zdump.c,v 1.33 2014/05/13 16:33:56 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2009-05-17 by Arthur David Olson.
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: zdump.c,v 1.32 2013/12/26 18:34:28 christos Exp $");
+__RCSID("$NetBSD: zdump.c,v 1.33 2014/05/13 16:33:56 christos Exp $");
#endif /* !defined lint */
#include "version.h"
@@ -39,7 +39,9 @@ __RCSID("$NetBSD: zdump.c,v 1.32 2013/12
#ifndef HAVE_STDINT_H
# define HAVE_STDINT_H \
- (199901 <= __STDC_VERSION__ || 2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
+ (199901 <= __STDC_VERSION__ \
+ || 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__) \
+ || __CYGWIN__)
#endif
#if HAVE_STDINT_H
# include "stdint.h"
Index: src/lib/libc/time/tz-link.htm
diff -u src/lib/libc/time/tz-link.htm:1.13 src/lib/libc/time/tz-link.htm:1.14
--- src/lib/libc/time/tz-link.htm:1.13 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/tz-link.htm Tue May 13 12:33:56 2014
@@ -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-10-21">
+<meta name="DC.Date" content="2014-03-10">
<meta name="DC.Description"
content="Sources of information about time zones and daylight saving time">
<meta name="DC.Identifier"
@@ -49,6 +49,7 @@ title="Berkeley Software Distribution">B
<a href="http://cygwin.com/">Cygwin</a>,
<a href="http://www.delorie.com/djgpp/"><abbr
title="DJ's GNU Programming Platform">DJGPP</abbr></a>,
+<a href="http://en.wikipedia.org/wiki/Symbian">Symbian</a>,
<a href="http://en.wikipedia.org/wiki/WebOS"><abbr
title="Web Operating System">webOS</abbr></a>,
<a href="http://ibm.com/aix"><abbr
@@ -56,7 +57,6 @@ title="Advanced Interactive eXecutive">A
<a href="http://en.wikipedia.org/wiki/BlackBerry_10">BlackBerry 10</a>,
<a href="http://www.apple.com/ios/"><abbr
title="iPhone OS">iOS</abbr></a>,
-<a href="http://windows.microsoft.com/">Microsoft Windows</a>,
<a href="http://h71000.www7.hp.com/">Open<abbr
title="Virtual Memory System">VMS</abbr></a>,
<a href="http://oracle.com/database">Oracle Database</a>,
@@ -92,8 +92,10 @@ the code is in the file <code>tzcode<var
where <code><var>C</var></code> is the code's version;
similarly, the data are in <code>tzdata<var>D</var>.tar.gz</code>,
where <code><var>D</var></code> is the data's version.
-Each version is a four-digit year followed by lower-case letters
-(a through z, then za through zz, then zza through zzz, and so on).
+Since 1996, each version has been a four-digit year followed by
+lower-case letter (<samp>a</samp> through <samp>z</samp>,
+then <samp>za</samp> through <samp>zz</samp>, then <samp>zza</samp>
+through <samp>zzz</samp>, and so on).
Convenience links to
the <a href="ftp://ftp.iana.org/tz/tzcode-latest.tar.gz">latest
code</a> and
@@ -106,10 +108,8 @@ see the downloaded
<code>README</code> file for what to do next.</p>
<pre style="margin-left: 2em"><code>mkdir tz
cd tz
-<a href="http://www.gnu.org/software/wget/">wget</a> --retr-symlinks
-'ftp://ftp.iana.org/tz/tz*-latest.tar.gz'
-<a href="http://www.gnu.org/software/gzip/">gzip</a> -dc tzcode-latest.tar.gz |
-<a href="http://www.gnu.org/software/tar/">tar</a> -xf -
+<a href="http://www.gnu.org/software/wget/">wget</a> --retr-symlinks 'ftp://ftp.iana.org/tz/tz*-latest.tar.gz'
+<a href="http://www.gnu.org/software/gzip/">gzip</a> -dc tzcode-latest.tar.gz | <a href="http://www.gnu.org/software/tar/">tar</a> -xf -
gzip -dc tzdata-latest.tar.gz | tar -xf -
</code></pre>
<p>
@@ -138,8 +138,8 @@ and browse the <a
href="http://mm.icann.org/pipermail/tz/">archive of old
messages</a>. For further information about updates, please see
<a href="http://tools.ietf.org/html/rfc6557">Procedures for
-Maintaining the Time Zone Database</a> (Internet <abbr title="Request
-For Comments">RFC</abbr> 6557).</p>
+Maintaining the Time Zone Database</a> (Internet <abbr
+title="Request For Comments">RFC</abbr> 6557).</p>
<p>
The Web has several other sources for time zone and daylight saving time data.
Here are some links that may be of interest.
@@ -150,7 +150,8 @@ Here are some links that may be of inter
<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>
+tz Database Source Files</a> explains the <code><abbr>tz</abbr></code>
+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
@@ -161,6 +162,8 @@ database's style.</li>
These are listed roughly in ascending order of complexity and fanciness.
</p>
<ul>
+<li><a href="http://time.is/">Time.is</a> shows locations'
+time and zones in a simple format.</li>
<li><a
href="http://twiki.org/cgi-bin/xtra/tzdatepick.html">Date and Time Gateway</a>
lets you see the <code><abbr>TZ</abbr></code> values directly.</li>
@@ -170,30 +173,35 @@ Time in 1000 Places</a> uses description
<li><a href="http://www.timezoneconverter.com/cgi-bin/tzc.tzc">Time Zone
Converter</a>
uses a pulldown menu.</li>
-<li><a href="http://home.telfort.nl/~t876506/TZworld.html">Complete
+<li><a href="http://home.kpn.nl/vanadovv/time/TZworld.html">Complete
timezone information for all countries</a> displays tables of DST rules.
<li><a href="http://timeanddate.com/worldclock/">The World Clock –
Time Zones</a> lets you sort zone names and convert times.</li>
<li><a href="http://permatime.com/">Permatime</a> generates and views
links that refer to a particular point in time and can be displayed in
multiple timezones.</li>
-<li><a href="http://daylight-savings-time.info/">Daylight Saving Time info</a>
-shows a graph of time
-difference versus time for any pair of locations.</li>
+<li><a href="http://www.zeitverschiebung.net/en/">Time Difference</a>
+calculates the current time difference between locations.</li>
+<li><a href="http://www.wx-now.com/">Weather Now</a> lists the weather too.</li>
<li><a href="http://worldtime.io/">worldtime.io</a>
also contains data about time zone boundaries; it supports queries via place
names and shows location maps.</li>
-<li><a href="http://simpletimerclocks.mozdev.org/">Simple Timer + Clocks</a>
-is a Firefox add-on which uses a timezone data file generated from the
-tz data files.</li>
</ul>
<h2>Other time zone database formats</h2>
<ul>
<li>The <a href="http://tools.ietf.org/html/rfc5545">
Internet Calendaring and Scheduling Core Object Specification
-(iCalendar)</a>, Internet <abbr>RFC</abbr> 5445
+(iCalendar)</a> (Internet <abbr>RFC</abbr> 5445)
covers time zone
data; see its VTIMEZONE calendar component.
+The iCalendar format requires specialized parsers and generators; a
+variant <a href="http://tools.ietf.org/html/rfc6321">xCal</a>
+(Internet RFC 6321) uses
+<a href="http://www.w3.org/XML/"><abbr
+title="Extensible Markup Language">XML</abbr></a> format, and a draft variant
+<a href="http://datatracker.ietf.org/doc/draft-ietf-jcardcal-jcal/">jCal</a>
+uses <a href="http://www.json.org/"><abbr
+title="JavaScript Object Notation">JSON</abbr></a> format.
<a href="http://calconnect.org/">CalConnect, The Calendaring and Scheduling
Consortium</a> is promoting further work in this area. <a
href="http://calconnect.org/publications/icalendartimezoneproblemsandrecommendationsv1.0.pdf">iCalendar
@@ -250,6 +258,8 @@ Unicode (<abbr>ICU</abbr>)</a> contains
href="http://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a>
libraries for internationalization that
has a compiler from <code><abbr>tz</abbr></code> source
+and from <abbr title="Common Locale Data Repository">CLDR</abbr> data
+(mentioned below)
into an <abbr>ICU</abbr>-specific format.
<abbr>ICU</abbr> is freely available under a
<abbr>BSD</abbr>-style license.</li>
@@ -259,10 +269,12 @@ contains a class
<code>org.joda.time.tz.ZoneInfoCompiler</code> that compiles
<code><abbr>tz</abbr></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://nodatime.org/">Noda Time – Date and time API
-for .NET</a> is similar to Joda Time, but for the .NET framework
-instead of Java. It is freely available under the
-<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License</a>.</li>
+<li><a href="http://nodatime.org/">Noda Time – Date and time API for
+.NET</a> and <a href="http://www.babiej.demon.nl/Tz4Net/main.htm">TZ4Net</a>
+are similar to Joda Time, but for the .NET framework instead of
+Java. They are freely available under the
+<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License</a>
+and a <abbr>BSD</abbr>-style license, respectively.</li>
<li><a href="https://github.com/mde/timezone-js">TimezoneJS.Date</a>
is a <a href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a>
library that parses <code><abbr>tz</abbr></code> source files and interprets time
@@ -283,8 +295,7 @@ Library</a> is
a <a href="http://en.wikipedia.org/wiki/Smalltalk">Smalltalk</a> class
library that compiles <code><abbr>tz</abbr></code> source into a time
zone repository whose format
-is either proprietary or an <a href="http://www.w3.org/XML/"><abbr
-title="Extensible Markup Language">XML</abbr></a>-encoded
+is either proprietary or an <abbr>XML</abbr>-encoded
representation.</li>
<li>Starting with version 8.5, <a href="http://tcl.tk/">Tcl</a>
contains a developer-oriented parser that compiles <code><abbr>tz</abbr></code>
@@ -318,10 +329,13 @@ It is freely available under the same te
public-domain <a href="https://github.com/dbaron/tz.js">tz.js</a>
library contains a Python tool that
converts <code><abbr>tz</abbr></code> binary data into
-<a href="http://www.json.org/"><abbr title="JavaScript Object
-Notation">JSON</abbr></a>-format data suitable for use
+<abbr>JSON</abbr>-format data suitable for use
in its JavaScript library for time zone conversion. Dates before 1970
are not supported.</li>
+<li>The <a
+href="http://hackage.haskell.org/package/timezone-olson">timezone-olson</a>
+package contains <a href="http://haskell.org">Haskell</a> code that
+parses and uses <code><abbr>tz</abbr></code> binary data.</li>
</ul>
<h2>Other <code><abbr>tz</abbr></code>-based time zone software</h2>
<ul>
@@ -393,9 +407,10 @@ gives current time zone rules for airpor
an undocumented format, with <abbr>ID</abbr>s that can be mapped to
<code><abbr>TZ</abbr></code> values using the <a
href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html">Zone
-→ Tzid table</a> maintained by the <abbr
-title="Common Locale Data Repository">CLDR</abbr> data mentioned
-below.</li>
+→ Tzid table</a> in the <abbr>CLDR</abbr> data mentioned
+below, or via <a href="http://msdn.microsoft.com/en-us/windows/apps">Windows
+Store apps</a> classes such as <a
+href="http://msdn.microsoft.com/en-us/library/windows/apps/dn264145.aspx">DateTimeFormatter</a>.</li>
</ul>
<h2>Maps</h2>
<ul>
@@ -418,6 +433,10 @@ has several fancy time zone maps; it cov
The maps' pictorial quality is not quite as good as the
<abbr>CIA</abbr>'s
but the maps are more up to date.</li>
+<li><a href="http://poisson.phc.unipi.it/~maggiolo/index.php/2014/01/how-much-is-time-wrong-around-the-world/">How
+much is time wrong around the world?</a> maps the difference between
+mean solar and standard time, highlighting areas such as western China
+where the two differ greatly.</li>
</ul>
<h2>Time zone boundaries</h2>
<ul>
@@ -431,7 +450,7 @@ geospatial query operators to shapefiles
<li><a href="http://statoids.com/statoids.html">Administrative
Divisions of Countries ("Statoids")</a> contains lists of
political subdivision data related to time zones.</li>
-<li><a href="http://home.telfort.nl/~t876506/Multizones.html">Time
+<li><a href="http://home.kpn.nl/vanadovv/time/Multizones.html">Time
zone boundaries for multizone countries</a> summarizes legal
boundaries between time zones within countries.</li>
<li>Manifold.net's <a
@@ -627,6 +646,16 @@ contentious issue.</li>
</ul>
<h2>Time notation</h2>
<ul>
+<li>The <a href="http://unicode.org/cldr/">Unicode Common Locale Data
+Repository (<abbr>CLDR</abbr>) Project</a> has localizations for time
+zone names, abbreviations, identifiers, and formats. For example, it
+contains French translations for "Eastern European Summer Time",
+"<abbr title="Eastern European Summer Time">EEST</abbr>", and
+"Bucharest". Its
+<a href="http://unicode.org/cldr/charts/by_type/index.html">by-type
+charts</a> show these values for many locales. Data are available in
+both <abbr title="Locale Data Markup Language">LDML</abbr>
+(an <abbr>XML</abbr> format) and <abbr>JSON</abbr>.
<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
@@ -660,16 +689,6 @@ formats.</li>
<a href="http://exit109.com/~ghealton/y2k/yrexamples.html">The
Best of Dates, the Worst of Dates</a> covers many problems encountered
by software developers when handling dates and time stamps.</li>
-<li>The <a
-href="http://unicode.org/cldr/">Unicode Common Locale Data Repository
-(<abbr>CLDR</abbr>) Project</a> has localizations for time zone names,
-abbreviations, identifiers, and formats. For example, it contains
-French translations for "Eastern European Summer Time", "<abbr
-title="Eastern European Summer Time">EEST</abbr>", and
-"Bucharest". <a
-href="http://unicode.org/cldr/charts/by_type/index.html">By-Type
-Chart</a> shows these values for many locales.
-<abbr>ICU</abbr> contains a mechanism for using this data.</li>
<li>Alphabetic time zone abbreviations should not be used as unique
identifiers for <abbr>UTC</abbr> offsets as they are ambiguous in
practice. For example, "<abbr>EST</abbr>" denotes 5 hours behind
@@ -687,8 +706,8 @@ maintainers.</li>
<code><abbr>TZ</abbr></code> environment variable uses the opposite convention.
For example, one might use <code><abbr>TZ</abbr>="<abbr
title="Japan Standard Time">JST</abbr>-9"</code> and
-<code><abbr>TZ</abbr>="<abbr title="Hawaii Standard
-Time">HST</abbr>10"</code> for Japan and Hawaii, respectively. If the
+<code><abbr>TZ</abbr>="<abbr title="Hawaii Standard Time">HST</abbr>10"</code>
+for Japan and Hawaii, respectively. If the
<code><abbr>tz</abbr></code> database is available, it is usually better to use
settings like <code><abbr>TZ</abbr>="Asia/Tokyo"</code> and
<code><abbr>TZ</abbr>="Pacific/Honolulu"</code> instead, as this should avoid
Index: src/lib/libc/time/tzfile.h
diff -u src/lib/libc/time/tzfile.h:1.13 src/lib/libc/time/tzfile.h:1.14
--- src/lib/libc/time/tzfile.h:1.13 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/tzfile.h Tue May 13 12:33:56 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: tzfile.h,v 1.13 2013/12/26 18:34:28 christos Exp $ */
+/* $NetBSD: tzfile.h,v 1.14 2014/05/13 16:33:56 christos Exp $ */
#ifndef TZFILE_H
#define TZFILE_H
@@ -98,7 +98,7 @@ struct tzhead {
*/
#ifndef TZ_MAX_TIMES
-#define TZ_MAX_TIMES 1200
+#define TZ_MAX_TIMES 2000
#endif /* !defined TZ_MAX_TIMES */
#ifndef TZ_MAX_TYPES
Index: src/lib/libc/time/tzset.3
diff -u src/lib/libc/time/tzset.3:1.27 src/lib/libc/time/tzset.3:1.28
--- src/lib/libc/time/tzset.3:1.27 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/tzset.3 Tue May 13 12:33:56 2014
@@ -1,5 +1,5 @@
-.\" $NetBSD: tzset.3,v 1.27 2013/12/26 18:34:28 christos Exp $
-.Dd December 26, 2013
+.\" $NetBSD: tzset.3,v 1.28 2014/05/13 16:33:56 christos Exp $
+.Dd May 13, 2014
.Dt TZSET 3
.Os
.Sh NAME
@@ -237,7 +237,7 @@ first Sunday on or after January 18).
.It IST\(mi2IDT,M3.4.4/26,M10.5.0
stands for Israel Standard Time (IST) and Israel Daylight Time (IDT),
2 hours ahead of UTC, springing forward on March's fourth
-Tuesday at 26:00 (i.e., 02:00 on the first Friday on or after March
+Thursday at 26:00 (i.e., 02:00 on the first Friday on or after March
23), and falling back on October's last Sunday at 02:00.
.It WART4WARST,J1/0,J365/25
stands for Western Argentina Summer Time (WARST), 3 hours behind UTC.
Index: src/lib/libc/time/zic.c
diff -u src/lib/libc/time/zic.c:1.44 src/lib/libc/time/zic.c:1.45
--- src/lib/libc/time/zic.c:1.44 Thu Dec 26 13:34:28 2013
+++ src/lib/libc/time/zic.c Tue May 13 12:33:56 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: zic.c,v 1.44 2013/12/26 18:34:28 christos Exp $ */
+/* $NetBSD: zic.c,v 1.45 2014/05/13 16:33:56 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.44 2013/12/26 18:34:28 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.45 2014/05/13 16:33:56 christos Exp $");
#endif /* !defined lint */
#include "version.h"
@@ -176,6 +176,7 @@ static const char * rfilename;
static int rlinenum;
static const char * progname;
static int timecnt;
+static int timecnt_alloc;
static int typecnt;
/*
@@ -261,9 +262,11 @@ static int typecnt;
static struct rule * rules;
static int nrules; /* number of rules */
+static int nrules_alloc;
static struct zone * zones;
static int nzones; /* number of zones */
+static int nzones_alloc;
struct link {
const char * l_filename;
@@ -274,6 +277,7 @@ struct link {
static struct link * links;
static int nlinks;
+static int nlinks_alloc;
struct lookup {
const char * l_word;
@@ -360,7 +364,7 @@ static const int len_years[2] = {
static struct attype {
zic_t at;
unsigned char type;
-} attypes[TZ_MAX_TIMES];
+} * attypes;
static zic_t gmtoffs[TZ_MAX_TYPES];
static char isdsts[TZ_MAX_TYPES];
static unsigned char abbrinds[TZ_MAX_TYPES];
@@ -375,16 +379,26 @@ static char roll[TZ_MAX_LEAPS];
** Memory allocation.
*/
+static _Noreturn void
+memory_exhausted(const char *msg)
+{
+ fprintf(stderr, _("%s: Memory exhausted: %s\n"), progname, msg);
+ exit(EXIT_FAILURE);
+}
+
+static ATTRIBUTE_PURE size_t
+size_product(size_t nitems, size_t itemsize)
+{
+ if (SIZE_MAX / itemsize < nitems)
+ memory_exhausted("size overflow");
+ return nitems * itemsize;
+}
+
static ATTRIBUTE_PURE void *
memcheck(void *const ptr)
{
- if (ptr == NULL) {
- const char *e = strerror(errno);
-
- (void) fprintf(stderr, _("%s: Memory exhausted: %s\n"),
- progname, e);
- exit(EXIT_FAILURE);
- }
+ if (ptr == NULL)
+ memory_exhausted(strerror(errno));
return ptr;
}
@@ -393,6 +407,20 @@ memcheck(void *const ptr)
#define ecpyalloc(ptr) memcheck(icpyalloc(ptr))
#define ecatalloc(oldp, newp) memcheck(icatalloc((oldp), (newp)))
+static void *
+growalloc(void *ptr, size_t itemsize, int nitems, int *nitems_alloc)
+{
+ if (nitems < *nitems_alloc)
+ return ptr;
+ else {
+ int amax = INT_MAX < SIZE_MAX ? INT_MAX : SIZE_MAX;
+ if ((amax - 1) / 3 * 2 < *nitems_alloc)
+ memory_exhausted("int overflow");
+ *nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;
+ return erealloc(ptr, size_product(*nitems_alloc, itemsize));
+ }
+}
+
/*
** Error handling.
*/
@@ -948,8 +976,6 @@ gethms(const char *string, const char *c
error(_("time overflow"));
return 0;
}
- if (noise && hh == HOURSPERDAY && mm == 0 && ss == 0)
- warning(_("24:00 not handled by pre-1998 versions of zic"));
if (noise && (hh > HOURSPERDAY ||
(hh == HOURSPERDAY && (mm != 0 || ss != 0))))
warning(_("values over 24 hours not handled by pre-2007 versions of zic"));
@@ -979,7 +1005,7 @@ inrule(char **const fields, const int nf
r.r_abbrvar = ecpyalloc(fields[RF_ABBRVAR]);
if (max_abbrvar_len < strlen(r.r_abbrvar))
max_abbrvar_len = strlen(r.r_abbrvar);
- rules = erealloc(rules, (nrules + 1) * sizeof *rules);
+ rules = growalloc(rules, sizeof *rules, nrules, &nrules_alloc);
rules[nrules++] = r;
}
@@ -1095,7 +1121,7 @@ inzsub(char **const fields, const int nf
return FALSE;
}
}
- zones = erealloc(zones, (nzones + 1) * sizeof *zones);
+ zones = growalloc(zones, sizeof *zones, nzones, &nzones_alloc);
zones[nzones++] = z;
/*
** If there was an UNTIL field on this line,
@@ -1228,7 +1254,7 @@ inlink(char **const fields, const int nf
l.l_linenum = linenum;
l.l_from = ecpyalloc(fields[LF_FROM]);
l.l_to = ecpyalloc(fields[LF_TO]);
- links = erealloc(links, (nlinks + 1) * sizeof *links);
+ links = growalloc(links, sizeof *links, nlinks, &nlinks_alloc);
links[nlinks++] = l;
}
@@ -1444,8 +1470,9 @@ writezone(const char *const name, const
static char * fullname;
static const struct tzhead tzh0;
static struct tzhead tzh;
- zic_t ats[TZ_MAX_TIMES];
- unsigned char types[TZ_MAX_TIMES];
+ zic_t *ats = emalloc(size_product(timecnt, sizeof *ats + 1));
+ void *typesptr = ats + timecnt;
+ unsigned char *types = typesptr;
/*
** Sort.
@@ -1464,17 +1491,11 @@ writezone(const char *const name, const
fromi = 0;
while (fromi < timecnt && attypes[fromi].at < min_time)
++fromi;
- /*
- ** 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 +
+ if (toi > 1 && ((attypes[fromi].at +
gmtoffs[attypes[toi - 1].type]) <=
- (attypes[toi - 1].at + gmtoffs[toi == 1 ? 0
- : attypes[toi - 2].type]))) {
+ (attypes[toi - 1].at +
+ gmtoffs[attypes[toi - 2].type]))) {
attypes[toi - 1].type =
attypes[fromi].type;
continue;
@@ -1485,6 +1506,9 @@ writezone(const char *const name, const
}
timecnt = toi;
}
+ if (noise && timecnt > 1200)
+ warning(_("pre-2014 clients may mishandle"
+ " more than 1200 transition times"));
/*
** Transfer.
*/
@@ -1516,6 +1540,13 @@ writezone(const char *const name, const
--timecnt32;
++timei32;
}
+ /*
+ ** Output an INT32_MIN "transition" if appropriate--see below.
+ */
+ if (timei32 > 0 && ats[timei32] > INT32_MIN) {
+ --timei32;
+ ++timecnt32;
+ }
while (leapcnt32 > 0 && !is32(trans[leapcnt32 - 1]))
--leapcnt32;
while (leapcnt32 > 0 && !is32(trans[leapi32])) {
@@ -1550,7 +1581,7 @@ writezone(const char *const name, const
int thistimei, thistimecnt;
int thisleapi, thisleapcnt;
int thistimelim, thisleaplim;
- int writetype[TZ_MAX_TIMES];
+ int writetype[TZ_MAX_TYPES];
int typemap[TZ_MAX_TYPES];
int thistypecnt;
char thischars[TZ_MAX_CHARS];
@@ -1570,11 +1601,7 @@ writezone(const char *const name, const
}
thistimelim = thistimei + thistimecnt;
thisleaplim = thisleapi + thisleapcnt;
- /*
- ** Remember that type 0 is reserved.
- */
- writetype[0] = FALSE;
- for (i = 1; i < typecnt; ++i)
+ for (i = 0; i < typecnt; ++i)
writetype[i] = thistimecnt == timecnt;
if (thistimecnt == 0) {
/*
@@ -1590,11 +1617,8 @@ writezone(const char *const name, const
/*
** For America/Godthab and Antarctica/Palmer
*/
- /*
- ** Remember that type 0 is reserved.
- */
if (thistimei == 0)
- writetype[1] = TRUE;
+ writetype[0] = TRUE;
}
#ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
/*
@@ -1647,26 +1671,8 @@ writezone(const char *const name, const
}
#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++ : 0;
+ typemap[i] = writetype[i] ? thistypecnt++ : -1;
for (i = 0; i < (int)(sizeof indmap / sizeof indmap[0]); ++i)
indmap[i] = -1;
thischarcnt = 0;
@@ -1711,7 +1717,12 @@ writezone(const char *const name, const
#undef DO
for (i = thistimei; i < thistimelim; ++i)
if (pass == 1)
- puttzcode(ats[i], fp);
+ /*
+ ** Output an INT32_MIN "transition"
+ ** if appropriate--see above.
+ */
+ puttzcode(((ats[i] < INT32_MIN) ?
+ INT32_MIN : ats[i]), fp);
else puttzcode64(ats[i], fp);
for (i = thistimei; i < thistimelim; ++i) {
unsigned char uc;
@@ -1766,6 +1777,7 @@ writezone(const char *const name, const
progname, fullname);
exit(EXIT_FAILURE);
}
+ free(ats);
}
static void
@@ -2091,11 +2103,6 @@ outzone(const struct zone *const zpfirst
updateminmax(leapminyear);
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)
@@ -2195,8 +2202,7 @@ outzone(const struct zone *const zpfirst
if (usestart) {
addtt(starttime, type);
usestart = FALSE;
- } else if (stdoff != 0)
- addtt(min_time, type);
+ } else addtt(min_time, type);
} else for (year = min_year; year <= max_year; ++year) {
if (useuntil && year > zp->z_untilrule.r_hiyear)
break;
@@ -2391,10 +2397,7 @@ addtt(const zic_t starttime, int type)
timecnt = 0;
type = 0;
}
- if (timecnt >= TZ_MAX_TIMES) {
- error(_("too many transitions?!"));
- exit(EXIT_FAILURE);
- }
+ attypes = growalloc(attypes, sizeof *attypes, timecnt, &timecnt_alloc);
attypes[timecnt].at = starttime;
attypes[timecnt].type = type;
++timecnt;
@@ -2592,7 +2595,7 @@ getfields(char *cp)
if (cp == NULL)
return NULL;
- array = emalloc((strlen(cp) + 1) * sizeof *array);
+ array = emalloc(size_product(strlen(cp) + 1, sizeof *array));
nsubs = 0;
for ( ; ; ) {
while (isascii((unsigned char) *cp) &&