Module Name: src Committed By: christos Date: Fri Oct 9 17:21:45 UTC 2015
Modified Files: src/lib/libc/time: Makefile NEWS localtime.c private.h strftime.c strptime.c tz-art.htm tz-link.htm tzfile.5 zic.c Log Message: Release 2015g - 2015-10-01 00:39:51 -0700 Changes affecting code localtime no longer mishandles America/Anchorage after 2037. (Thanks to Bradley White for reporting the bug.) The localtime module allows the variables 'timezone', 'daylight', and 'altzone' to be in common storage shared with other modules, and declares them in case the system <time.h> does not. (Problems reported by Kees Dekker.) On platforms with tm_zone, strftime.c now assumes it is not NULL. This simplifies the code and is consistent with zdump.c. (Problem reported by Christos Zoulas.) Changes affecting documentation The tzfile man page now documents that transition times denote the starts (not the ends) of the corresponding time periods. (Ambiguity reported by Bill Seymour.) To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/lib/libc/time/Makefile cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/NEWS cvs rdiff -u -r1.97 -r1.98 src/lib/libc/time/localtime.c cvs rdiff -u -r1.43 -r1.44 src/lib/libc/time/private.h cvs rdiff -u -r1.34 -r1.35 src/lib/libc/time/strftime.c cvs rdiff -u -r1.48 -r1.49 src/lib/libc/time/strptime.c cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/tz-art.htm cvs rdiff -u -r1.23 -r1.24 src/lib/libc/time/tz-link.htm cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/tzfile.5 cvs rdiff -u -r1.55 -r1.56 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.30 src/lib/libc/time/Makefile:1.31 --- src/lib/libc/time/Makefile:1.30 Thu Aug 13 07:21:18 2015 +++ src/lib/libc/time/Makefile Fri Oct 9 13:21:45 2015 @@ -5,7 +5,7 @@ PACKAGE= tzcode # Version numbers of the code and data distributions. -VERSION= 2015f +VERSION= 2015g # Email address for bug reports. BUGEMAIL= t...@iana.org Index: src/lib/libc/time/NEWS diff -u src/lib/libc/time/NEWS:1.13 src/lib/libc/time/NEWS:1.14 --- src/lib/libc/time/NEWS:1.13 Thu Aug 13 07:21:18 2015 +++ src/lib/libc/time/NEWS Fri Oct 9 13:21:45 2015 @@ -1,5 +1,47 @@ News for the tz database +Release 2015g - 2015-10-01 00:39:51 -0700 + + Changes affecting future time stamps + + Turkey's 2015 fall-back transition is scheduled for Nov. 8, not Oct. 25. + (Thanks to Fatih.) + + Norfolk moves from +1130 to +1100 on 2015-10-04 at 02:00 local time. + (Thanks to Alexander Krivenyshev.) + + Fiji's 2016 fall-back transition is scheduled for January 17, not 24. + (Thanks to Ken Rylander.) + + Fort Nelson, British Columbia will not fall back on 2015-11-01. It has + effectively been on MST (-0700) since it advanced its clocks on 2015-03-08. + New zone America/Fort_Nelson. (Thanks to Matt Johnson.) + + Changes affecting past time stamps + + Norfolk observed DST from 1974-10-27 02:00 to 1975-03-02 02:00. + + Changes affecting code + + localtime no longer mishandles America/Anchorage after 2037. + (Thanks to Bradley White for reporting the bug.) + + The localtime module allows the variables 'timezone', 'daylight', + and 'altzone' to be in common storage shared with other modules, + and declares them in case the system <time.h> does not. + (Problems reported by Kees Dekker.) + + On platforms with tm_zone, strftime.c now assumes it is not NULL. + This simplifies the code and is consistent with zdump.c. + (Problem reported by Christos Zoulas.) + + Changes affecting documentation + + The tzfile man page now documents that transition times denote the + starts (not the ends) of the corresponding time periods. + (Ambiguity reported by Bill Seymour.) + + Release 2015f - 2015-08-10 18:06:56 -0700 Changes affecting future time stamps Index: src/lib/libc/time/localtime.c diff -u src/lib/libc/time/localtime.c:1.97 src/lib/libc/time/localtime.c:1.98 --- src/lib/libc/time/localtime.c:1.97 Tue Aug 18 12:54:27 2015 +++ src/lib/libc/time/localtime.c Fri Oct 9 13:21:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: localtime.c,v 1.97 2015/08/18 16:54:27 riz Exp $ */ +/* $NetBSD: localtime.c,v 1.98 2015/10/09 17:21:45 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.97 2015/08/18 16:54:27 riz Exp $"); +__RCSID("$NetBSD: localtime.c,v 1.98 2015/10/09 17:21:45 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -588,11 +588,6 @@ tzloadbody(char const *name, struct stat break; nread -= p - up->buf; memmove(up->buf, p, (size_t)nread); - /* - ** If this is a signed narrow time_t system, we're done. - */ - if (TYPE_SIGNED(time_t) && stored >= (int) sizeof(time_t)) - break; } if (doextend && nread > 2 && up->buf[0] == '\n' && up->buf[nread - 1] == '\n' && @@ -601,31 +596,52 @@ tzloadbody(char const *name, struct stat up->buf[nread - 1] = '\0'; if (tzparse(&up->buf[1], ts, false) - && ts->typecnt == 2 - && sp->charcnt + ts->charcnt <= TZ_MAX_CHARS) { - for (i = 0; i < 2; ++i) - ts->ttis[i].tt_abbrind += - sp->charcnt; - for (i = 0; i < ts->charcnt; ++i) - sp->chars[sp->charcnt++] = - ts->chars[i]; - i = 0; - while (i < ts->timecnt && - ts->ats[i] <= - sp->ats[sp->timecnt - 1]) - ++i; - while (i < ts->timecnt && - sp->timecnt < TZ_MAX_TIMES) { - sp->ats[sp->timecnt] = - ts->ats[i]; - sp->types[sp->timecnt] = - sp->typecnt + - ts->types[i]; - ++sp->timecnt; - ++i; - } - sp->ttis[sp->typecnt++] = ts->ttis[0]; - sp->ttis[sp->typecnt++] = ts->ttis[1]; + && ts->typecnt == 2) { + + /* Attempt to reuse existing abbreviations. + Without this, America/Anchorage would stop + working after 2037 when TZ_MAX_CHARS is 50, as + sp->charcnt equals 42 (for LMT CAT CAWT CAPT AHST + AHDT YST AKDT AKST) and ts->charcnt equals 10 + (for AKST AKDT). Reusing means sp->charcnt can + stay 42 in this example. */ + int gotabbr = 0; + int charcnt = sp->charcnt; + for (i = 0; i < 2; i++) { + char *tsabbr = ts->chars + ts->ttis[i].tt_abbrind; + int j; + for (j = 0; j < charcnt; j++) + if (strcmp(sp->chars + j, tsabbr) == 0) { + ts->ttis[i].tt_abbrind = j; + gotabbr++; + break; + } + if (! (j < charcnt)) { + int tsabbrlen = strlen(tsabbr); + if (j + tsabbrlen < TZ_MAX_CHARS) { + strcpy(sp->chars + j, tsabbr); + charcnt = j + tsabbrlen + 1; + ts->ttis[i].tt_abbrind = j; + gotabbr++; + } + } + } + if (gotabbr == 2) { + sp->charcnt = charcnt; + for (i = 0; i < ts->timecnt; i++) + if (sp->ats[sp->timecnt - 1] < ts->ats[i]) + break; + while (i < ts->timecnt + && sp->timecnt < TZ_MAX_TIMES) { + sp->ats[sp->timecnt] = ts->ats[i]; + sp->types[sp->timecnt] = (sp->typecnt + + ts->types[i]); + sp->timecnt++; + i++; + } + sp->ttis[sp->typecnt++] = ts->ttis[0]; + sp->ttis[sp->typecnt++] = ts->ttis[1]; + } } } if (sp->timecnt > 1) { Index: src/lib/libc/time/private.h diff -u src/lib/libc/time/private.h:1.43 src/lib/libc/time/private.h:1.44 --- src/lib/libc/time/private.h:1.43 Thu Aug 13 07:21:18 2015 +++ src/lib/libc/time/private.h Fri Oct 9 13:21:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: private.h,v 1.43 2015/08/13 11:21:18 christos Exp $ */ +/* $NetBSD: private.h,v 1.44 2015/10/09 17:21:45 christos Exp $ */ #ifndef PRIVATE_H #define PRIVATE_H @@ -399,12 +399,25 @@ void tzset(void); ** Some time.h implementations don't declare asctime_r. ** Others might define it as a macro. ** Fix the former without affecting the latter. +** Similarly for timezone, daylight, and altzone. */ #ifndef asctime_r extern char * asctime_r(struct tm const *restrict, char *restrict); #endif +#if defined(USG_COMPAT) && !defined(__NetBSD__) +# ifndef timezone +extern long timezone; +# endif +# ifndef daylight +extern int daylight; +# endif +#endif +#if defined ALTZONE && !defined altzone +extern long altzone; +#endif + /* ** The STD_INSPIRED functions are similar, but most also need ** declarations if time_tz is defined. Index: src/lib/libc/time/strftime.c diff -u src/lib/libc/time/strftime.c:1.34 src/lib/libc/time/strftime.c:1.35 --- src/lib/libc/time/strftime.c:1.34 Thu Aug 13 07:21:18 2015 +++ src/lib/libc/time/strftime.c Fri Oct 9 13:21:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: strftime.c,v 1.34 2015/08/13 11:21:18 christos Exp $ */ +/* $NetBSD: strftime.c,v 1.35 2015/10/09 17:21:45 christos Exp $ */ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) @@ -6,7 +6,7 @@ static char elsieid[] = "@(#)strftime.c 7.64"; static char elsieid[] = "@(#)strftime.c 8.3"; #else -__RCSID("$NetBSD: strftime.c,v 1.34 2015/08/13 11:21:18 christos Exp $"); +__RCSID("$NetBSD: strftime.c,v 1.35 2015/10/09 17:21:45 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -487,9 +487,7 @@ label: continue; case 'Z': #ifdef TM_ZONE - if (t->TM_ZONE != NULL) - pt = _add(t->TM_ZONE, pt, ptlim); - else + pt = _add(t->TM_ZONE, pt, ptlim); #endif /* defined TM_ZONE */ if (t->tm_isdst >= 0) pt = _add((sp ? Index: src/lib/libc/time/strptime.c diff -u src/lib/libc/time/strptime.c:1.48 src/lib/libc/time/strptime.c:1.49 --- src/lib/libc/time/strptime.c:1.48 Wed Jul 29 16:32:54 2015 +++ src/lib/libc/time/strptime.c Fri Oct 9 13:21:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: strptime.c,v 1.48 2015/07/29 20:32:54 ginsbach Exp $ */ +/* $NetBSD: strptime.c,v 1.49 2015/10/09 17:21:45 christos Exp $ */ /*- * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strptime.c,v 1.48 2015/07/29 20:32:54 ginsbach Exp $"); +__RCSID("$NetBSD: strptime.c,v 1.49 2015/10/09 17:21:45 christos Exp $"); #endif #include "namespace.h" @@ -533,7 +533,7 @@ literal: tm->TM_GMTOFF = (int)*bp - 'M'; #endif #ifdef TM_ZONE - tm->TM_ZONE = NULL; /* XXX */ + tm->TM_ZONE = utc; /* XXX */ #endif bp++; continue; @@ -574,7 +574,7 @@ literal: tm->TM_GMTOFF = offs; #endif #ifdef TM_ZONE - tm->TM_ZONE = NULL; /* XXX */ + tm->TM_ZONE = utc; /* XXX */ #endif continue; Index: src/lib/libc/time/tz-art.htm diff -u src/lib/libc/time/tz-art.htm:1.10 src/lib/libc/time/tz-art.htm:1.11 --- src/lib/libc/time/tz-art.htm:1.10 Thu Aug 13 07:21:18 2015 +++ src/lib/libc/time/tz-art.htm Fri Oct 9 13:21:45 2015 @@ -496,6 +496,11 @@ yesterday daylight [saving] time ended. midnight." (Conan O'Brien on the 2010-11-08 premiere of <em>Conan</em>.) </li> <li> +"Well, in my time zone that's all the time I have, +but maybe in your time zone I haven't finished yet. So stay tuned!" +(Goldie Hawn, <em>Rowan & Martin's Laugh-In</em> No. 65, 1970-03-09) +</li> +<li> Peppermint Patty: "What if the world comes to an end tonight, Marcie?" <br> Marcie: "I promise there'll be a tomorrow, sir ... in fact, Index: src/lib/libc/time/tz-link.htm diff -u src/lib/libc/time/tz-link.htm:1.23 src/lib/libc/time/tz-link.htm:1.24 --- src/lib/libc/time/tz-link.htm:1.23 Thu Aug 13 07:21:18 2015 +++ src/lib/libc/time/tz-link.htm Fri Oct 9 13:21:45 2015 @@ -8,7 +8,7 @@ <meta http-equiv="Content-type" content='text/html; charset="UTF-8"'> <meta name="DC.Creator" content="Eggert, Paul"> <meta name="DC.Contributor" content="Olson, Arthur David"> -<meta name="DC.Date" content="2015-08-10"> +<meta name="DC.Date" content="2015-10-01"> <meta name="DC.Description" content="Sources of information about time zones and daylight saving time"> <meta name="DC.Identifier" @@ -731,7 +731,7 @@ Schema: Datatypes – dateTime</a> s <a href="http://tools.ietf.org/html/rfc5322">Internet Message Format</a> (Internet <abbr>RFC</abbr> 5322) §3.3 specifies the time notation used in email and <a -href="http://www.w3.org/Protocols/"><abbr>HTTP</abbr></a> +href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol"><abbr>HTTP</abbr></a> headers.</li> <li> <a href="http://tools.ietf.org/html/rfc3339">Date and Time Index: src/lib/libc/time/tzfile.5 diff -u src/lib/libc/time/tzfile.5:1.22 src/lib/libc/time/tzfile.5:1.23 --- src/lib/libc/time/tzfile.5:1.22 Tue Oct 7 17:51:03 2014 +++ src/lib/libc/time/tzfile.5 Fri Oct 9 13:21:45 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: tzfile.5,v 1.22 2014/10/07 21:51:03 christos Exp $ +.\" $NetBSD: tzfile.5,v 1.23 2015/10/09 17:21:45 christos Exp $ .\" .\" This file is in the public domain, so clarified as of .\" 1996-06-05 by Arthur David Olson (arthur_david_ol...@nih.gov). @@ -8,8 +8,6 @@ .Sh NAME .Nm tzfile .Nd time zone information -.Sh SYNOPSIS -.In tzfile.h .Sh DESCRIPTION The time zone information files used by .Xr tzset 3 @@ -54,8 +52,8 @@ Next come .Va tzh_timecnt one-byte unsigned integer values; each one tells which of the different types of local time types -described in the file is associated with the same-indexed -transition time. +described in the file is associated with the time period +starting with the same-indexed transition time. These values serve as indices into an array of .Fa ttinfo structures (with @@ -99,7 +97,8 @@ the first value of each pair gives the t at which a leap second occurs; the second gives the .Em total -number of leap seconds to be applied after the given time. +number of leap seconds to be applied during the time period +starting at the given time. The pairs of values are sorted in ascending order by time. .Pp Then there are Index: src/lib/libc/time/zic.c diff -u src/lib/libc/time/zic.c:1.55 src/lib/libc/time/zic.c:1.56 --- src/lib/libc/time/zic.c:1.55 Thu Aug 13 07:21:18 2015 +++ src/lib/libc/time/zic.c Fri Oct 9 13:21:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: zic.c,v 1.55 2015/08/13 11:21:18 christos Exp $ */ +/* $NetBSD: zic.c,v 1.56 2015/10/09 17:21:45 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.55 2015/08/13 11:21:18 christos Exp $"); +__RCSID("$NetBSD: zic.c,v 1.56 2015/10/09 17:21:45 christos Exp $"); #endif /* !defined lint */ #include "private.h" @@ -1955,7 +1955,7 @@ abbroffset(char *buf, zic_t offset) static size_t doabbr(char *abbr, int abbrlen, struct zone const *zp, const char *letters, - bool isdst, bool doquotes) + zic_t stdoff, bool doquotes) { char * cp; char * slashp; @@ -1966,11 +1966,11 @@ doabbr(char *abbr, int abbrlen, struct z if (slashp == NULL) { char letterbuf[PERCENT_Z_LEN_BOUND + 1]; if (zp->z_format_specifier == 'z') - letters = abbroffset(letterbuf, -zp->z_gmtoff); + letters = abbroffset(letterbuf, -zp->z_gmtoff + stdoff); else if (!letters) letters = "%s"; (void) snprintf(abbr, abbrlen, format, letters); - } else if (isdst) { + } else if (stdoff != 0) { (void) strlcpy(abbr, slashp + 1, abbrlen); } else { (void) memcpy(abbr, format, slashp - format); @@ -2195,7 +2195,7 @@ stringzone(char *result, const int resul if (stdrp == NULL && (zp->z_nrules != 0 || zp->z_stdoff != 0)) return -1; abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar; - len = doabbr(result, resultlen, zp, abbrvar, false, true); + len = doabbr(result, resultlen, zp, abbrvar, 0, true); offsetlen = stringoffset(result + len, -zp->z_gmtoff); if (! offsetlen) { result[0] = '\0'; @@ -2204,7 +2204,7 @@ stringzone(char *result, const int resul len += offsetlen; if (dstrp == NULL) return compat; - len += doabbr(result + len, resultlen - len, zp, dstrp->r_abbrvar, true, true); + len += doabbr(result + len, resultlen - len, zp, dstrp->r_abbrvar, dstrp->r_stdoff, true); if (dstrp->r_stdoff != SECSPERMIN * MINSPERHOUR) { offsetlen = stringoffset(result + len, -(zp->z_gmtoff + dstrp->r_stdoff)); @@ -2376,7 +2376,7 @@ outzone(const struct zone *zpfirst, int if (zp->z_nrules == 0) { stdoff = zp->z_stdoff; doabbr(startbuf, max_abbr_len + 1, zp, - NULL, stdoff != 0, false); + NULL, stdoff, false); type = addtype(oadd(zp->z_gmtoff, stdoff), startbuf, stdoff != 0, startttisstd, startttisgmt); @@ -2472,7 +2472,7 @@ outzone(const struct zone *zpfirst, int max_abbr_len + 1, zp, rp->r_abbrvar, - rp->r_stdoff != 0, + rp->r_stdoff, false); continue; } @@ -2483,15 +2483,14 @@ outzone(const struct zone *zpfirst, int max_abbr_len + 1, zp, rp->r_abbrvar, - rp->r_stdoff != - 0, + rp->r_stdoff, false); } } eats(zp->z_filename, zp->z_linenum, rp->r_filename, rp->r_linenum); doabbr(ab, max_abbr_len + 1, zp, rp->r_abbrvar, - rp->r_stdoff != 0, false); + rp->r_stdoff, false); offset = oadd(zp->z_gmtoff, rp->r_stdoff); type = addtype(offset, ab, rp->r_stdoff != 0, rp->r_todisstd, rp->r_todisgmt);