Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time Release 2015g - 2015-10-01 00:39:51 -0700



details:   https://anonhg.NetBSD.org/src/rev/9495a6de5b17
branches:  trunk
changeset: 340899:9495a6de5b17
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 09 17:21:45 2015 +0000

description:
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.)

diffstat:

 lib/libc/time/Makefile    |   2 +-
 lib/libc/time/NEWS        |  42 ++++++++++++++++++++++++
 lib/libc/time/localtime.c |  80 ++++++++++++++++++++++++++++------------------
 lib/libc/time/private.h   |  15 ++++++++-
 lib/libc/time/strftime.c  |   8 +--
 lib/libc/time/strptime.c  |   8 ++--
 lib/libc/time/tz-art.htm  |   5 ++
 lib/libc/time/tz-link.htm |   4 +-
 lib/libc/time/tzfile.5    |  11 ++---
 lib/libc/time/zic.c       |  23 ++++++-------
 10 files changed, 135 insertions(+), 63 deletions(-)

diffs (truncated from 441 to 300 lines):

diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/Makefile
--- a/lib/libc/time/Makefile    Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/Makefile    Fri Oct 09 17:21:45 2015 +0000
@@ -5,7 +5,7 @@
 PACKAGE=       tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=       2015f
+VERSION=       2015g
 
 # Email address for bug reports.
 BUGEMAIL=      tz%iana.org@localhost
diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/NEWS
--- a/lib/libc/time/NEWS        Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/NEWS        Fri Oct 09 17:21:45 2015 +0000
@@ -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
diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/localtime.c
--- a/lib/libc/time/localtime.c Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/localtime.c Fri Oct 09 17:21:45 2015 +0000
@@ -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 @@
                        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 @@
 
                        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) {
diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/private.h
--- a/lib/libc/time/private.h   Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/private.h   Fri Oct 09 17:21:45 2015 +0000
@@ -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 @@
 ** 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.
diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/strftime.c
--- a/lib/libc/time/strftime.c  Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/strftime.c  Fri Oct 09 17:21:45 2015 +0000
@@ -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 @@
                                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 ?
diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/strptime.c
--- a/lib/libc/time/strptime.c  Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/strptime.c  Fri Oct 09 17:21:45 2015 +0000
@@ -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 @@
                                                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 @@
                        tm->TM_GMTOFF = offs;
 #endif
 #ifdef TM_ZONE
-                       tm->TM_ZONE = NULL;     /* XXX */
+                       tm->TM_ZONE = utc;      /* XXX */
 #endif
                        continue;
 
diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/tz-art.htm
--- a/lib/libc/time/tz-art.htm  Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/tz-art.htm  Fri Oct 09 17:21:45 2015 +0000
@@ -496,6 +496,11 @@
 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 &amp; 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,
diff -r 26cca7e93894 -r 9495a6de5b17 lib/libc/time/tz-link.htm
--- a/lib/libc/time/tz-link.htm Fri Oct 09 14:42:40 2015 +0000
+++ b/lib/libc/time/tz-link.htm Fri Oct 09 17:21:45 2015 +0000
@@ -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 @@
 <a href="http://tools.ietf.org/html/rfc5322";>Internet



Home | Main Index | Thread Index | Old Index