CVS commit: src/lib/libc/time

2021-02-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  1 04:42:14 UTC 2021

Modified Files:
src/lib/libc/time: Makefile NEWS theory.html tz-art.html tz-link.html
version zic.8 zic.c

Log Message:
Merge tzcode-2021a
- No comments in the changelog about the code changes.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/time/Makefile
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/NEWS
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/theory.html
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/version
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/time/zic.8
cvs rdiff -u -r1.77 -r1.78 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.47 src/lib/libc/time/Makefile:1.48
--- src/lib/libc/time/Makefile:1.47	Sat Oct 17 12:24:33 2020
+++ src/lib/libc/time/Makefile	Sun Feb 28 23:42:14 2021
@@ -583,11 +583,19 @@ INSTALL:	ALL install date.1
 		cp date '$(DESTDIR)$(BINDIR)/.'
 		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
 
+# Calculate version number from git, if available.
+# Otherwise, use $(VERSION) unless it is "unknown" and there is already
+# a 'version' file, in which case reuse the existing 'version' contents
+# and append "-dirty" if the contents do not already end in "-dirty".
 version:	$(VERSION_DEPS)
 		{ (type git) >/dev/null 2>&1 && \
 		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
 --abbrev=7 --dirty` || \
-		  V='$(VERSION)'; } && \
+		  if test '$(VERSION)' = unknown && V=`cat $@`; then \
+		case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
+		  else \
+		V='$(VERSION)'; \
+		  fi; } && \
 		printf '%s\n' "$$V" >$@.out
 		mv $@.out $@
 
@@ -872,11 +880,34 @@ $(MANTXTS):	workman.sh
 		LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
 		mv $@.out $@
 
+# Set file timestamps deterministically if possible,
+# so that tarballs containing the timestamps are reproducible.
+#
+# '$(SET_TIMESTAMP_N) N DEST A B C ...' sets the timestamp of the
+# file DEST to the maximum of the timestamps of the files A B C ...,
+# plus N if GNU ls and touch are available.
+SET_TIMESTAMP_N = sh -c '\
+  n=$$0 dest=$$1; shift; \
+  touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \
+  if test $$n != 0 && \
+ lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \
+set x $$lsout && \
+touch -cmd @`expr $$7 + $$n` "$$dest"; \
+  else :; fi'
+# If DEST depends on A B C ... in this Makefile, callers should use
+# $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any
+# downstream 'make' that considers equal timestamps to be out of date.
+# POSIX allows this 'make' behavior, and HP-UX 'make' does it.
+# If all that matters is that the timestamp be reproducible
+# and plausible, use $(SET_TIMESTAMP).
+SET_TIMESTAMP = $(SET_TIMESTAMP_N) 0
+SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
+
 # Set the timestamps to those of the git repository, if available,
 # and if the files have not changed since then.
-# This uses GNU 'touch' syntax 'touch -d@N FILE',
-# where N is the number of seconds since 1970.
-# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
+# This uses GNU 'ls --time-style=+%s', which outputs the seconds count,
+# and GNU 'touch -d@N FILE', where N is the number of seconds since 1970.
+# If git or GNU is absent, don't bother to sync with git timestamps.
 # Also, set the timestamp of each prebuilt file like 'leapseconds'
 # to be the maximum of the files it depends on.
 set-timestamps.out: $(EIGHT_YARDS)
@@ -894,16 +925,16 @@ set-timestamps.out: $(EIGHT_YARDS)
 		fi || exit; \
 		  done; \
 		fi
-		touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds
+		$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
 		for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
-		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
+		  $(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
 		exit; \
 		done
-		touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
-		touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
+		$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
+		$(SET_TIMESTAMP_DEP) tzdata.zi $(TZDATA_ZI_DEPS)
 		touch $@
 set-tzs-timestamp.out: $(TZS)
-		touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
+		$(SET_TIMESTAMP_DEP) $(TZS) $(TZS_DEPS)
 		touch $@
 
 # The zics below ensure that each data file can stand on its own.
@@ -914,7 +945,10 @@ check_public: $(VERSION_DEPS)
 		mkdir public.dir
 		ln $(VERSION_DEPS) public.dir
 		cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
-		for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi; do \
+		for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
+		public.dir/vanguard.zi public.dir/main.zi \
+		public.dir/rearguard.zi; \
+		do \
 		  public.dir/zic -v -d 

CVS commit: src/lib/libc/time

2020-10-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 17 16:24:33 UTC 2020

Modified Files:
src/lib/libc/time: Makefile NEWS version

Log Message:
update to 2020c


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/Makefile
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/NEWS
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/version

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.46 src/lib/libc/time/Makefile:1.47
--- src/lib/libc/time/Makefile:1.46	Fri Oct  9 14:38:48 2020
+++ src/lib/libc/time/Makefile	Sat Oct 17 12:24:33 2020
@@ -1022,10 +1022,14 @@ tzdata$(VERSION)-rearguard.tar.gz: rearg
 		done
 		sed '1s/$$/-rearguard/' \
 		  tzdata$(VERSION)-rearguard.dir/version
+		: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
+		touch -md 2020-10-12T22:53:00Z \
+		  tzdata$(VERSION)-rearguard.dir/pacificnew
 		touch -cmr version tzdata$(VERSION)-rearguard.dir/version
 		LC_ALL=C && export LC_ALL && \
 		  (cd tzdata$(VERSION)-rearguard.dir && \
-		   tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
+		   tar $(TARFLAGS) -cf - \
+			$(COMMON) $(DATA) $(MISC) pacificnew | \
 		 gzip $(GZIPFLAGS)) >$@.out
 		mv $@.out $@
 

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.31 src/lib/libc/time/NEWS:1.32
--- src/lib/libc/time/NEWS:1.31	Fri Oct  9 14:38:48 2020
+++ src/lib/libc/time/NEWS	Sat Oct 17 12:24:33 2020
@@ -1,5 +1,25 @@
 News for the tz database
 
+Release 2020c - 2020-10-16 11:15:53 -0700
+
+  Briefly:
+Fiji starts DST later than usual, on 2020-12-20.
+
+  Changes to future timestamps
+
+Fiji will start DST on 2020-12-20, instead of 2020-11-08 as
+previously predicted.  DST will still end on 2021-01-17.
+(Thanks to Raymond Kumar and Alan Mintz.)  Assume for now that
+the later-than-usual start date is a one-time departure from the
+recent pattern.
+
+  Changes to build procedure
+
+Rearguard tarballs now contain an empty file pacificnew.
+Some older downstream software expects this file to exist.
+(Problem reported by Mike Cullinan.)
+
+
 Release 2020b - 2020-10-06 18:35:04 -0700
 
   Briefly:

Index: src/lib/libc/time/version
diff -u src/lib/libc/time/version:1.14 src/lib/libc/time/version:1.15
--- src/lib/libc/time/version:1.14	Fri Oct  9 14:38:48 2020
+++ src/lib/libc/time/version	Sat Oct 17 12:24:33 2020
@@ -1 +1 @@
-2020b
+2020c



CVS commit: src/lib/libc/time

2020-09-21 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Mon Sep 21 15:31:54 UTC 2020

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Correct range for ISO week conversion

The %V conversion range for strptime(3) should match the strftime(3)
conversion range. A valid ISO week is 1-53.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.62 src/lib/libc/time/strptime.c:1.63
--- src/lib/libc/time/strptime.c:1.62	Thu Aug 24 01:01:09 2017
+++ src/lib/libc/time/strptime.c	Mon Sep 21 15:31:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.63 2020/09/21 15:31:54 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.63 2020/09/21 15:31:54 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
@@ -424,7 +424,7 @@ literal:
 			continue;
 
 		case 'V':	/* The ISO 8601:1988 week number as decimal */
-			bp = conv_num(bp, , 0, 53);
+			bp = conv_num(bp, , 1, 53);
 			continue;
 
 		case 'Y':	/* The year. */



CVS commit: src/lib/libc/time

2020-05-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 25 14:52:48 UTC 2020

Modified Files:
src/lib/libc/time: Makefile NEWS localtime.c private.h strftime.c
theory.html tz-art.html tz-link.html tzfile.5 version zdump.8
zdump.c zic.8 zic.c

Log Message:
Bring in 2020a


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/Makefile
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/time/NEWS src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.122 -r1.123 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/time/private.h
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/theory.html
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/version
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/time/zic.8
cvs rdiff -u -r1.75 -r1.76 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.44 src/lib/libc/time/Makefile:1.45
--- src/lib/libc/time/Makefile:1.44	Wed Jul  3 11:50:16 2019
+++ src/lib/libc/time/Makefile	Mon May 25 10:52:48 2020
@@ -150,6 +150,15 @@ TIME_T_ALTERNATIVES_TAIL = int32_t uint3
 
 REDO=		posix_right
 
+# Whether to put an "Expires" line in the leapseconds file.
+# Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
+# The EXPIRES_LINE value matters only if REDO's value contains "right".
+# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
+# zic's support for the Expires line was introduced in tzdb 2020a,
+# and EXPIRES_LINE defaults to 0 for now so that the leapseconds file
+# can be given to older zic implementations.
+EXPIRES_LINE=	0
+
 # To install data in text form that has all the information of the TZif data,
 # (optionally incorporating leap second information), use
 #	TZDATA_TEXT=	tzdata.zi leapseconds
@@ -295,8 +304,9 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
 # than TM_GMTOFF and TM_ZONE.  However, most of them are standardized.
 # #
 # # To omit or support the external variable "tzname", add one of:
-# #	-DHAVE_TZNAME=0
-# #	-DHAVE_TZNAME=1
+# #	-DHAVE_TZNAME=0 # do not support "tzname"
+# #	-DHAVE_TZNAME=1 # support "tzname", which is defined by system library
+# #	-DHAVE_TZNAME=2 # support and define "tzname"
 # # to the "CFLAGS=" line.  "tzname" is required by POSIX 1988 and later.
 # # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
 # # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
@@ -304,16 +314,20 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
 # # presumably due to memory allocation issues.
 # #
 # # To omit or support the external variables "timezone" and "daylight", add
-# #	-DUSG_COMPAT=0
-# #	-DUSG_COMPAT=1
+# #	-DUSG_COMPAT=0 # do not support
+# #	-DUSG_COMPAT=1 # support, and variables are defined by system library
+# #	-DUSG_COMPAT=2 # support and define variables
 # # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
 # # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
 # # If not defined, the code attempts to guess USG_COMPAT from other macros.
 # #
 # # To support the external variable "altzone", add
-# #	-DALTZONE
+# #	-DALTZONE=0 # do not support
+# #	-DALTZONE=1 # support "altzone", which is defined by system library
+# #	-DALTZONE=2 # support and define "altzone"
 # # to the end of the "CFLAGS=" line; although "altzone" appeared in
 # # System V Release 3.1 it has not been standardized.
+# # If not defined, the code attempts to guess ALTZONE from other macros.
 #
 # If you want functions that were inspired by early versions of X3J11's work,
 # add
@@ -321,9 +335,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
 # to the end of the "CFLAGS=" line.  This arranges for the functions
 # "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
 # "posix2time", and "time2posix" to be added to the time conversion library.
-# "tzsetwall" is like "tzset" except that it arranges for local wall clock
-# time (rather than the timezone specified in the TZ environment variable)
-# to be used.
+# "tzsetwall" is deprecated and is intended to be removed soon; see NEWS.
 # "offtime" is like "gmtime" except that it accepts a second (long) argument
 # that gives an offset to add to the time_t when converting it.
 # "timelocal" is equivalent to "mktime".
@@ -333,7 +345,6 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
 # that gives an offset to use when converting to a time_t.
 # "posix2time" and "time2posix" are described in an included manual page.
 # X3J11's work does not describe any of these functions.
-# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
 # These 

CVS commit: src/lib/libc/time

2019-04-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Apr 20 07:27:40 UTC 2019

Modified Files:
src/lib/libc/time: tzset.3

Log Message:
Remove 'No' macros with no effect.
Add width to table.
Fix en-dashes.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/tzset.3

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/tzset.3
diff -u src/lib/libc/time/tzset.3:1.40 src/lib/libc/time/tzset.3:1.41
--- src/lib/libc/time/tzset.3:1.40	Thu Apr 18 11:20:17 2019
+++ src/lib/libc/time/tzset.3	Sat Apr 20 07:27:39 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tzset.3,v 1.40 2019/04/18 11:20:17 pgoyette Exp $
+.\"	$NetBSD: tzset.3,v 1.41 2019/04/20 07:27:39 wiz Exp $
 .Dd April 18, 2019
 .Dt TZSET 3
 .Os
@@ -169,10 +169,7 @@ is used directly as a specification of t
 it must have the following syntax (spaces inserted for clarity):
 .Sm off
 .Bd -literal -offset indent
-.Cm std Cm offset Oo
-.Cm dst Oo
-.Cm offset Oc Oo
-.No , Cm rule Oc Oc
+.Cm std Cm offset Oo Cm dst Oo Cm offset Oc Oo , Cm rule Oc Oc
 .Ed
 .Sm on
 .Pp
@@ -182,7 +179,7 @@ where:
 Three or more bytes that are the designation for the standard
 .Cm ( std )
 or the alternative
-.Cm ( dst 
+.Cm ( dst
 such as daylight saving time)
 timezone.
 Only
@@ -199,7 +196,7 @@ and
 .Dv > ;
 in this case, the designation can contain any characters other than
 .Dv >
-and 
+and
 .Dv NUL .
 .It Cm offset
 Indicates the value one must add to the local time to arrive at
@@ -236,7 +233,7 @@ daylight saving time is assumed to be on
 One or more digits may be used; the value is always interpreted as a
 decimal number.
 The hour must be between zero and 24, and the minutes (and
-seconds) \*(en if present \*(en between zero and 59.
+seconds) \(en if present \(en between zero and 59.
 If preceded by a
 .Dq -
 the timezone shall be east of the Prime Meridian; otherwise it shall be
@@ -251,7 +248,7 @@ has the form:
 .Bd -literal -offset indent
 .Xo
 .Cm date No /
-.Cm time No ,
+.Cm time ,
 .Cm date No /
 .Cm time
 .Xc
@@ -282,8 +279,8 @@ The Julian day
 (1 \*[Le]
 .Ar n
 \*[Le] 365).
-Leap days are not counted; that is, in all years \*(en including leap
-years \*(en February 28 is day 59 and March 1 is day 60.
+Leap days are not counted; that is, in all years \(en including leap
+years \(en February 28 is day 59 and March 1 is day 60.
 It is impossible to explicitly refer to the occasional February 29.
 .It Ar n
 The zero-based Julian day (0\ \*[Le]
@@ -292,7 +289,7 @@ The zero-based Julian day (0\ \*[Le]
 Leap days are counted, and it is possible to refer to
 February 29.
 .Sm off
-.It Cm M Ns Ar m No . Ar n No . Ar d
+.It Cm M Ns Ar m . Ar n . Ar d
 .Sm on
 The
 .Ar d Ns 'th
@@ -339,7 +336,7 @@ Here are some examples of
 .Va TZ
 values that directly specify the timezone rules; they use some of the
 extensions to POSIX.
-.Bl -tag
+.Bl -tag -width 6n
 .It EST5
 stands for US Eastern Standard
 Time (EST), 5 hours behind UT, without daylight saving.



CVS commit: src/lib/libc/time

2019-04-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Apr 18 11:20:17 UTC 2019

Modified Files:
src/lib/libc/time: tzset.3

Log Message:
Note restrictions on return values from tzgetname() and tzgmtoff()


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/tzset.3

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/tzset.3
diff -u src/lib/libc/time/tzset.3:1.39 src/lib/libc/time/tzset.3:1.40
--- src/lib/libc/time/tzset.3:1.39	Fri Oct 19 23:05:35 2018
+++ src/lib/libc/time/tzset.3	Thu Apr 18 11:20:17 2019
@@ -1,5 +1,5 @@
-.\"	$NetBSD: tzset.3,v 1.39 2018/10/19 23:05:35 christos Exp $
-.Dd October 19, 2018
+.\"	$NetBSD: tzset.3,v 1.40 2019/04/18 11:20:17 pgoyette Exp $
+.Dd April 18, 2019
 .Dt TZSET 3
 .Os
 .Sh NAME
@@ -89,6 +89,12 @@ is set to
 .Va 1
 the call is equivalent to
 .Va tzname[1] .
+The return values for both
+.Fn tzgetname
+and
+.Fn tzgmtoff
+correspond to the latest time for which data is available, even if that
+refers to a future time.
 Finally, the
 .Fn tzgetgmtoff
 function acts like
@@ -424,6 +430,13 @@ The
 .Fn tzset
 function conforms to
 .St -p1003.1-88 .
+.Sh BUGS
+Neither the
+.Fn tzgetname
+nor
+.Fn tzgmtoff
+functions have the ability to specify the point in time for which the
+requested data should be returned.
 .\" @(#)newtzset.3	8.2
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.



CVS commit: src/lib/libc/time

2019-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 17 17:37:29 UTC 2019

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Pick up the latest matching (most recent) entry instead of the first one.

This fixes:
env TZ=Australia/Melbourne date
printing
Thu Apr 18 03:32:32 LMT 2019
instead of:
Thu Apr 18 03:32:32 AEST 2019

XXX: To be strictly correct, the tzgetname() call should probably take a time
reference point in order to return the appropriate zone name for the time
given.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.120 src/lib/libc/time/localtime.c:1.121
--- src/lib/libc/time/localtime.c:1.120	Mon Apr  8 14:50:52 2019
+++ src/lib/libc/time/localtime.c	Wed Apr 17 13:37:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.120 2019/04/08 18:50:52 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.121 2019/04/17 17:37:29 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.120 2019/04/08 18:50:52 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.121 2019/04/17 17:37:29 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -284,15 +284,20 @@ detzcode64(const char *const codep)
  	return result;
 }
 
+#include 
+
 const char *
 tzgetname(const timezone_t sp, int isdst)
 {
 	int i;
+	const char *name = NULL;
 	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo *const ttisp = >ttis[i];
 		if (ttisp->tt_isdst == isdst)
-			return >chars[ttisp->tt_abbrind];
+			name = >chars[ttisp->tt_abbrind];
 	}
+	if (name != NULL)
+		return name;
 	errno = ESRCH;
 	return NULL;
 }



CVS commit: src/lib/libc/time

2019-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  8 18:50:52 UTC 2019

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
The typecnt refers the to ttis array and the timecnt refers to the type array.
The types array can have 0 elements (i.e. timecnt == 0), but the ttis array
needs to have one element (typecnt >= 1). Need to revisit and take into
account the types array.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.119 src/lib/libc/time/localtime.c:1.120
--- src/lib/libc/time/localtime.c:1.119	Sun Apr  7 10:58:25 2019
+++ src/lib/libc/time/localtime.c	Mon Apr  8 14:50:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.119 2019/04/07 14:58:25 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.120 2019/04/08 18:50:52 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.119 2019/04/07 14:58:25 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.120 2019/04/08 18:50:52 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -289,7 +289,7 @@ tzgetname(const timezone_t sp, int isdst
 {
 	int i;
 	for (i = 0; i < sp->typecnt; ++i) {
-		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
+		const struct ttinfo *const ttisp = >ttis[i];
 		if (ttisp->tt_isdst == isdst)
 			return >chars[ttisp->tt_abbrind];
 	}
@@ -303,12 +303,10 @@ tzgetgmtoff(const timezone_t sp, int isd
 	int i;
 	long l = -1;
 	for (i = 0; i < sp->typecnt; ++i) {
-		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
+		const struct ttinfo *const ttisp = >ttis[i];
 
 		if (ttisp->tt_isdst == isdst) {
 			l = ttisp->tt_gmtoff;
-			if (sp->types[i] != 0)
-return l;
 		}
 	}
 	if (l == -1)
@@ -1394,7 +1392,6 @@ zoneinit(struct state *sp, char const *n
 		sp->typecnt = 1;
 		sp->charcnt = 0;
 		sp->goback = sp->goahead = false;
-		sp->types[0] = 0;
 		init_ttinfo(>ttis[0], 0, false, 0);
 		strcpy(sp->chars, gmt);
 		sp->defaulttype = 0;



CVS commit: src/lib/libc/time

2019-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  7 22:31:54 UTC 2019

Modified Files:
src/lib/libc/time: strftime.c

Log Message:
don't print ???, requested by kre@


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/time/strftime.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/strftime.c
diff -u src/lib/libc/time/strftime.c:1.45 src/lib/libc/time/strftime.c:1.46
--- src/lib/libc/time/strftime.c:1.45	Sun Apr  7 10:51:14 2019
+++ src/lib/libc/time/strftime.c	Sun Apr  7 18:31:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: strftime.c,v 1.45 2019/04/07 14:51:14 christos Exp $	*/
+/*	$NetBSD: strftime.c,v 1.46 2019/04/07 22:31:54 christos Exp $	*/
 
 /* Convert a broken-down timestamp to a string.  */
 
@@ -35,7 +35,7 @@
 static char	elsieid[] = "@(#)strftime.c	7.64";
 static char	elsieid[] = "@(#)strftime.c	8.3";
 #else
-__RCSID("$NetBSD: strftime.c,v 1.45 2019/04/07 14:51:14 christos Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.46 2019/04/07 22:31:54 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -550,7 +550,8 @@ label:
 	tzgetname(sp, dst);
 	if (z == NULL)
 		z = tzgetname(sp, !dst);
-	pt = _add(z ? z : "???", pt, ptlim);
+	if (z != NULL)
+		pt = _add(z, pt, ptlim);
 	errno = oerrno;
 }
 #endif



CVS commit: src/lib/libc/time

2019-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  7 14:58:25 UTC 2019

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
only need to initialize the first type.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.118 src/lib/libc/time/localtime.c:1.119
--- src/lib/libc/time/localtime.c:1.118	Sun Apr  7 10:44:51 2019
+++ src/lib/libc/time/localtime.c	Sun Apr  7 10:58:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.118 2019/04/07 14:44:51 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.119 2019/04/07 14:58:25 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.118 2019/04/07 14:44:51 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.119 2019/04/07 14:58:25 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1394,7 +1394,7 @@ zoneinit(struct state *sp, char const *n
 		sp->typecnt = 1;
 		sp->charcnt = 0;
 		sp->goback = sp->goahead = false;
-		sp->types[0] = sp->types[1] = 0;
+		sp->types[0] = 0;
 		init_ttinfo(>ttis[0], 0, false, 0);
 		strcpy(sp->chars, gmt);
 		sp->defaulttype = 0;



CVS commit: src/lib/libc/time

2019-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  7 14:51:15 UTC 2019

Modified Files:
src/lib/libc/time: strftime.c

Log Message:
Don't try to print NULL if we can't get a timezone name. First we try dst,
then we try the non-dst name and finally we just print ??? if that did not
work. This is not needed to handle the "TZ= date" case which was crashing
before because the default timezone was not consistently initialized, but
should handle any timezone now.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/strftime.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/strftime.c
diff -u src/lib/libc/time/strftime.c:1.44 src/lib/libc/time/strftime.c:1.45
--- src/lib/libc/time/strftime.c:1.44	Fri Apr  5 17:27:44 2019
+++ src/lib/libc/time/strftime.c	Sun Apr  7 10:51:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: strftime.c,v 1.44 2019/04/05 21:27:44 christos Exp $	*/
+/*	$NetBSD: strftime.c,v 1.45 2019/04/07 14:51:14 christos Exp $	*/
 
 /* Convert a broken-down timestamp to a string.  */
 
@@ -35,7 +35,7 @@
 static char	elsieid[] = "@(#)strftime.c	7.64";
 static char	elsieid[] = "@(#)strftime.c	8.3";
 #else
-__RCSID("$NetBSD: strftime.c,v 1.44 2019/04/05 21:27:44 christos Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.45 2019/04/07 14:51:14 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -544,9 +544,15 @@ label:
 #ifdef TM_ZONE
 pt = _add(t->TM_ZONE, pt, ptlim);
 #elif HAVE_TZNAME
-if (t->tm_isdst >= 0)
-	pt = _add(tzgetname(sp, t->tm_isdst),
-	pt, ptlim);
+if (t->tm_isdst >= 0) {
+	int oerrno = errno, dst = t->tm_isdst;
+	const char *z =
+	tzgetname(sp, dst);
+	if (z == NULL)
+		z = tzgetname(sp, !dst);
+	pt = _add(z ? z : "???", pt, ptlim);
+	errno = oerrno;
+}
 #endif
 /*
 ** C99 and later say that %Z must be



CVS commit: src/lib/libc/time

2019-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  7 14:44:51 UTC 2019

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Initialize the default timezone a bit more so that tzgetname(3) works.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.117 src/lib/libc/time/localtime.c:1.118
--- src/lib/libc/time/localtime.c:1.117	Thu Apr  4 15:27:28 2019
+++ src/lib/libc/time/localtime.c	Sun Apr  7 10:44:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.117 2019/04/04 19:27:28 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.118 2019/04/07 14:44:51 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.117 2019/04/04 19:27:28 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.118 2019/04/07 14:44:51 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -290,7 +290,6 @@ tzgetname(const timezone_t sp, int isdst
 	int i;
 	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
-
 		if (ttisp->tt_isdst == isdst)
 			return >chars[ttisp->tt_abbrind];
 	}
@@ -1392,9 +1391,10 @@ zoneinit(struct state *sp, char const *n
 		*/
 		sp->leapcnt = 0;		/* so, we're off a little */
 		sp->timecnt = 0;
-		sp->typecnt = 0;
+		sp->typecnt = 1;
 		sp->charcnt = 0;
 		sp->goback = sp->goahead = false;
+		sp->types[0] = sp->types[1] = 0;
 		init_ttinfo(>ttis[0], 0, false, 0);
 		strcpy(sp->chars, gmt);
 		sp->defaulttype = 0;



CVS commit: src/lib/libc/time

2019-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 21:27:44 UTC 2019

Modified Files:
src/lib/libc/time: strftime.3 strftime.c

Log Message:
- Padding support from FreeBSD (GNU extensions)
- add '+' for the c-locale only.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/time/strftime.3
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/time/strftime.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/strftime.3
diff -u src/lib/libc/time/strftime.3:1.34 src/lib/libc/time/strftime.3:1.35
--- src/lib/libc/time/strftime.3:1.34	Fri Oct 19 19:05:35 2018
+++ src/lib/libc/time/strftime.3	Fri Apr  5 17:27:44 2019
@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)strftime.3	5.12 (Berkeley) 6/29/91
-.\"	$NetBSD: strftime.3,v 1.34 2018/10/19 23:05:35 christos Exp $
+.\"	$NetBSD: strftime.3,v 1.35 2019/04/05 21:27:44 christos Exp $
 .\"
-.Dd October 19, 2018
+.Dd April 5, 2019
 .Dt STRFTIME 3
 .Os
 .Sh NAME
@@ -201,6 +201,22 @@ but local time is indeterminate; by conv
 locations while uninhabited, and corresponds to a zero offset when the
 time zone abbreviation begins with
 .Dq Li [-] .
+.It Cm %+
+is replaced by national representation of the date and time
+(the format is similar to that produced by
+.Xr date 1 ) .
+On
+.Nx
+currently this only works for the C locale.
+.It Cm %-*
+GNU libc extension.
+Do not do any padding when performing numerical outputs.
+.It Cm %_*
+GNU libc extension.
+Explicitly specify space for padding.
+.It Cm %0*
+GNU libc extension.
+Explicitly specify zero for padding.
 .It Cm %%
 is replaced by
 .Ql % .

Index: src/lib/libc/time/strftime.c
diff -u src/lib/libc/time/strftime.c:1.43 src/lib/libc/time/strftime.c:1.44
--- src/lib/libc/time/strftime.c:1.43	Thu Apr  4 15:27:28 2019
+++ src/lib/libc/time/strftime.c	Fri Apr  5 17:27:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: strftime.c,v 1.43 2019/04/04 19:27:28 christos Exp $	*/
+/*	$NetBSD: strftime.c,v 1.44 2019/04/05 21:27:44 christos Exp $	*/
 
 /* Convert a broken-down timestamp to a string.  */
 
@@ -35,7 +35,7 @@
 static char	elsieid[] = "@(#)strftime.c	7.64";
 static char	elsieid[] = "@(#)strftime.c	8.3";
 #else
-__RCSID("$NetBSD: strftime.c,v 1.43 2019/04/04 19:27:28 christos Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.44 2019/04/05 21:27:44 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -87,15 +87,44 @@ __weak_alias(strftime_z, _strftime_z)
 enum warn { IN_NONE, IN_SOME, IN_THIS, IN_ALL };
 
 static char *	_add(const char *, char *, const char *);
-static char *	_conv(int, const char *, char *, const char *);
+static char *	_conv(int, const char *, char *, const char *, locale_t);
 static char *	_fmt(const timezone_t, const char *, const struct tm *, char *,
 			const char *, enum warn *, locale_t);
-static char *	_yconv(int, int, bool, bool, char *, const char *);
+static char *	_yconv(int, int, bool, bool, char *, const char *, locale_t);
 
 #ifndef YEAR_2000_NAME
 #define YEAR_2000_NAME	"CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
 #endif /* !defined YEAR_2000_NAME */
 
+#define	IN_NONE	0
+#define	IN_SOME	1
+#define	IN_THIS	2
+#define	IN_ALL	3
+
+#define	PAD_DEFAULT	0
+#define	PAD_LESS	1
+#define	PAD_SPACE	2
+#define	PAD_ZERO	3
+
+static const char fmt_padding[][4][5] = {
+	/* DEFAULT,	LESS,	SPACE,	ZERO */
+#define	PAD_FMT_MONTHDAY	0
+#define	PAD_FMT_HMS		0
+#define	PAD_FMT_CENTURY		0
+#define	PAD_FMT_SHORTYEAR	0
+#define	PAD_FMT_MONTH		0
+#define	PAD_FMT_WEEKOFYEAR	0
+#define	PAD_FMT_DAYOFMONTH	0
+	{ "%02d",	"%d",	"%2d",	"%02d" },
+#define	PAD_FMT_SDAYOFMONTH	1
+#define	PAD_FMT_SHMS		1
+	{ "%2d",	"%d",	"%2d",	"%02d" },
+#define	PAD_FMT_DAYOFYEAR	2
+	{ "%03d",	"%d",	"%3d",	"%03d" },
+#define	PAD_FMT_YEAR		3
+	{ "%04d",	"%d",	"%4d",	"%04d" }
+};
+
 size_t
 strftime_z(const timezone_t sp, char * __restrict s, size_t maxsize,
 const char * __restrict format, const struct tm * __restrict t)
@@ -143,8 +172,14 @@ static char *
 _fmt(const timezone_t sp, const char *format, const struct tm *t, char *pt,
  const char *ptlim, enum warn *warnp, locale_t loc)
 {
+	int Ealternative, Oalternative, PadIndex;
+	_TimeLocale *tptr = _TIME_LOCALE(loc);
+	
 	for ( ; *format; ++format) {
 		if (*format == '%') {
+			Ealternative = 0;
+			Oalternative = 0;
+			PadIndex = PAD_DEFAULT;
 label:
 			switch (*++format) {
 			case '\0':
@@ -153,26 +188,29 @@ label:
 			case 'A':
 pt = _add((t->tm_wday < 0 ||
 	t->tm_wday >= DAYSPERWEEK) ?
-	"?" : _TIME_LOCALE(loc)->day[t->tm_wday],
+	"?" : tptr->day[t->tm_wday],
 	pt, ptlim);
 continue;
 			case 'a':
 pt = _add((t->tm_wday < 0 ||
 	t->tm_wday >= DAYSPERWEEK) ?
-	"?" : _TIME_LOCALE(loc)->abday[t->tm_wday],
+	"?" : tptr->abday[t->tm_wday],
 	pt, ptlim);
 continue;
 			case 'B':
 pt = _add((t->tm_mon < 0 ||
 	t->tm_mon >= MONSPERYEAR) ?
-	"?" : 

CVS commit: src/lib/libc/time

2019-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  4 22:03:23 UTC 2019

Modified Files:
src/lib/libc/time: private.h

Log Message:
deal with zic that's not part of libc.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/lib/libc/time/private.h

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/private.h
diff -u src/lib/libc/time/private.h:1.54 src/lib/libc/time/private.h:1.55
--- src/lib/libc/time/private.h:1.54	Thu Apr  4 15:27:28 2019
+++ src/lib/libc/time/private.h	Thu Apr  4 18:03:23 2019
@@ -1,6 +1,6 @@
 /* Private header for tzdb code.  */
 
-/*	$NetBSD: private.h,v 1.54 2019/04/04 19:27:28 christos Exp $	*/
+/*	$NetBSD: private.h,v 1.55 2019/04/04 22:03:23 christos Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -16,8 +16,6 @@
 #include "nbtool_config.h"
 #endif
 
-#include "reentrant.h"
-
 /*
 ** This file is in the public domain, so clarified as of
 ** 1996-06-05 by Arthur David Olson.
@@ -779,6 +777,8 @@ char *ctime_r(time_t const *, char *);
   ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
 #define SECSPERREPEAT_BITS	34	/* ceil(log2(SECSPERREPEAT)) */
 
+#ifdef _LIBC
+#include "reentrant.h"
 extern struct __state *__lclptr;
 #if defined(__LIBC12_SOURCE__)
 #define tzset_unlocked __tzset_unlocked
@@ -790,5 +790,6 @@ void tzset_unlocked(void);
 #ifdef _REENTRANT
 extern rwlock_t __lcl_lock;
 #endif
+#endif
 
 #endif /* !defined PRIVATE_H */



CVS commit: src/lib/libc/time

2019-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  4 19:42:39 UTC 2019

Modified Files:
src/lib/libc/time: Makefile.inc

Log Message:
ALL_STATE was bought by STATE_FARM.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/Makefile.inc

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.inc
diff -u src/lib/libc/time/Makefile.inc:1.22 src/lib/libc/time/Makefile.inc:1.23
--- src/lib/libc/time/Makefile.inc:1.22	Thu Oct 29 13:53:04 2015
+++ src/lib/libc/time/Makefile.inc	Thu Apr  4 15:42:39 2019
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile.inc,v 1.22 2015/10/29 17:53:04 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.23 2019/04/04 19:42:39 christos Exp $
 
 .PATH: ${.CURDIR}/time
 
 SRCS+=	asctime.c difftime.c localtime.c getdate.c strftime.c strptime.c
 MAN+=	ctime.3 getdate.3 offtime.3 strftime.3 strptime.3		\
 	time2posix.3 tzfile.5 tzset.3
-CPPFLAGS+=-DALL_STATE -DUSG_COMPAT
+CPPFLAGS+=-DUSG_COMPAT
 
 MLINKS+=ctime.3 ctime_r.3	\
 	ctime.3 asctime.3	\



CVS commit: src/lib/libc/time

2019-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  4 19:27:28 UTC 2019

Modified Files:
src/lib/libc/time: localtime.c private.h strftime.c

Log Message:
Make strftime_{l,z} re-entrant and always require a non-NULL timezone to be
passed in so that we can use the current timezone in all evaluations (mktime
tzgetname). Reported by Hamilton Slye.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/time/private.h
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/strftime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.116 src/lib/libc/time/localtime.c:1.117
--- src/lib/libc/time/localtime.c:1.116	Sat Jan 26 23:38:38 2019
+++ src/lib/libc/time/localtime.c	Thu Apr  4 15:27:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.116 2019/01/27 04:38:38 dholland Exp $	*/
+/*	$NetBSD: localtime.c,v 1.117 2019/04/04 19:27:28 christos Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.116 2019/01/27 04:38:38 dholland Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.117 2019/04/04 19:27:28 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -30,7 +30,6 @@ __RCSID("$NetBSD: localtime.c,v 1.116 20
 
 #include "tzfile.h"
 #include 
-#include "reentrant.h"
 
 #if NETBSD_INSPIRED
 # define NETBSD_INSPIRED_EXTERN
@@ -172,7 +171,6 @@ static struct tm *timesub(time_t const *
 static bool typesequiv(struct state const *, int, int);
 static bool tzparse(char const *, struct state *, bool);
 
-static timezone_t lclptr;
 static timezone_t gmtptr;
 
 #ifndef TZ_STRLEN_MAX
@@ -183,8 +181,11 @@ static char		lcl_TZname[TZ_STRLEN_MAX + 
 static int		lcl_is_set;
 
 
+#if !defined(__LIBC12_SOURCE__)
+timezone_t __lclptr;
 #ifdef _REENTRANT
-static rwlock_t lcl_lock = RWLOCK_INITIALIZER;
+rwlock_t __lcl_lock = RWLOCK_INITIALIZER;
+#endif
 #endif
 
 /*
@@ -359,7 +360,7 @@ update_tzname_etc(const struct state *sp
 static void
 settzname(void)
 {
-	timezone_t const	sp = lclptr;
+	timezone_t const	sp = __lclptr;
 	int			i;
 
 #if HAVE_TZNAME
@@ -475,7 +476,7 @@ tzloadbody(char const *name, struct stat
 		/* Set doaccess if NAME contains a ".." file name
 		   component, as such a name could read a file outside
 		   the TZDIR virtual subtree.  */
-		for (dot = name; (dot = strchr(dot, '.')); dot++)
+		for (dot = name; (dot = strchr(dot, '.')) != NULL; dot++)
 		  if ((dot == name || dot[-1] == '/') && dot[1] == '.'
 		  && (dot[2] == '/' || !dot[2])) {
 		doaccess = true;
@@ -1412,14 +1413,14 @@ zoneinit(struct state *sp, char const *n
 static void
 tzsetlcl(char const *name)
 {
-	struct state *sp = lclptr;
+	struct state *sp = __lclptr;
 	int lcl = name ? strlen(name) < sizeof lcl_TZname : -1;
 	if (lcl < 0 ? lcl_is_set < 0
 	: 0 < lcl_is_set && strcmp(lcl_TZname, name) == 0)
 		return;
 
 	if (! sp)
-		lclptr = sp = malloc(sizeof *lclptr);
+		__lclptr = sp = malloc(sizeof *__lclptr);
 	if (sp) {
 		if (zoneinit(sp, name) != 0)
 			zoneinit(sp, "");
@@ -1434,13 +1435,13 @@ tzsetlcl(char const *name)
 void
 tzsetwall(void)
 {
-	rwlock_wrlock(_lock);
+	rwlock_wrlock(&__lcl_lock);
 	tzsetlcl(NULL);
-	rwlock_unlock(_lock);
+	rwlock_unlock(&__lcl_lock);
 }
 #endif
 
-static void
+void
 tzset_unlocked(void)
 {
 	tzsetlcl(getenv("TZ"));
@@ -1449,23 +1450,23 @@ tzset_unlocked(void)
 void
 tzset(void)
 {
-	rwlock_wrlock(_lock);
+	rwlock_wrlock(&__lcl_lock);
 	tzset_unlocked();
-	rwlock_unlock(_lock);
+	rwlock_unlock(&__lcl_lock);
 }
 
 static void
 gmtcheck(void)
 {
 	static bool gmt_is_set;
-	rwlock_wrlock(_lock);
+	rwlock_wrlock(&__lcl_lock);
 	if (! gmt_is_set) {
 		gmtptr = malloc(sizeof *gmtptr);
 		if (gmtptr)
 			gmtload(gmtptr);
 		gmt_is_set = true;
 	}
-	rwlock_unlock(_lock);
+	rwlock_unlock(&__lcl_lock);
 }
 
 #if NETBSD_INSPIRED
@@ -1614,11 +1615,11 @@ localtime_rz(timezone_t sp, time_t const
 static struct tm *
 localtime_tzset(time_t const *timep, struct tm *tmp, bool setname)
 {
-	rwlock_wrlock(_lock);
+	rwlock_wrlock(&__lcl_lock);
 	if (setname || !lcl_is_set)
 		tzset_unlocked();
-	tmp = localsub(lclptr, timep, setname, tmp);
-	rwlock_unlock(_lock);
+	tmp = localsub(__lclptr, timep, setname, tmp);
+	rwlock_unlock(&__lcl_lock);
 	return tmp;
 }
 
@@ -2354,10 +2355,10 @@ mktime(struct tm *tmp)
 {
 	time_t t;
 
-	rwlock_wrlock(_lock);
+	rwlock_wrlock(&__lcl_lock);
 	tzset_unlocked();
-	t = mktime_tzname(lclptr, tmp, true);
-	rwlock_unlock(_lock);
+	t = mktime_tzname(__lclptr, tmp, true);
+	rwlock_unlock(&__lcl_lock);
 	return t;
 }
 
@@ -2435,12 +2436,12 @@ time2posix_z(timezone_t sp, time_t t)
 time_t
 time2posix(time_t t)
 {
-	rwlock_wrlock(_lock);
+	rwlock_wrlock(&__lcl_lock);
 	if (!lcl_is_set)
 		tzset_unlocked();
-	if 

CVS commit: src/lib/libc/time

2019-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  4 19:25:38 UTC 2019

Modified Files:
src/lib/libc/time: difftime.c

Log Message:
explicitly promote to double.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/difftime.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/difftime.c
diff -u src/lib/libc/time/difftime.c:1.21 src/lib/libc/time/difftime.c:1.22
--- src/lib/libc/time/difftime.c:1.21	Sat Jan 26 23:38:38 2019
+++ src/lib/libc/time/difftime.c	Thu Apr  4 15:25:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: difftime.c,v 1.21 2019/01/27 04:38:38 dholland Exp $	*/
+/*	$NetBSD: difftime.c,v 1.22 2019/04/04 19:25:38 christos Exp $	*/
 
 /* Return the difference between two timestamps.  */
 
@@ -12,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)difftime.c	8.1";
 #else
-__RCSID("$NetBSD: difftime.c,v 1.21 2019/01/27 04:38:38 dholland Exp $");
+__RCSID("$NetBSD: difftime.c,v 1.22 2019/04/04 19:25:38 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,13 +45,14 @@ difftime(time_t time1, time_t time0)
 	** if the minuend is greater than or equal to the subtrahend.
 	*/
 	if (!TYPE_SIGNED(time_t))
-		return time0 <= time1 ? time1 - time0 : dminus(time0 - time1);
+		return time0 <= time1 ? time1 - time0 :
+		dminus((double)(time0 - time1));
 
 	/* Use uintmax_t if wide enough.  */
 	/*CONSTCOND*/
 	if (sizeof (time_t) <= sizeof (uintmax_t)) {
 		uintmax_t t1 = time1, t0 = time0;
-		return time0 <= time1 ? t1 - t0 : dminus(t0 - t1);
+		return time0 <= time1 ? t1 - t0 : dminus((double)(t0 - t1));
 	}
 
 	/*



CVS commit: src/lib/libc/time

2019-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr  4 18:18:31 UTC 2019

Modified Files:
src/lib/libc/time: Makefile NEWS README theory.html tz-art.html
tz-link.html tzfile.5 version zic.8 zic.c

Log Message:
merge 2019a

  Changes to code

zic now has an -r option to limit the time range of output data.
For example, 'zic -r @10' limits the output data to
timestamps starting 10 seconds after the Epoch.
This helps shrink output size and can be useful for applications
not needing the full timestamp history, such as TZDIST truncation;
see Internet RFC 8536 section 5.1.  (Inspired by a feature request
from Christopher Wong, helped along by bug reports from Wong and
from Tim Parenti.)

  Changes to documentation

Mention Internet RFC 8536 (February 2019), which documents TZif.

tz-link.html now cites tzdata-meta
.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/Makefile
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/NEWS src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/README
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/time/theory.html
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/version
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/zic.8
cvs rdiff -u -r1.73 -r1.74 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.42 src/lib/libc/time/Makefile:1.43
--- src/lib/libc/time/Makefile:1.42	Mon Dec 31 22:04:56 2018
+++ src/lib/libc/time/Makefile	Thu Apr  4 14:18:31 2019
@@ -12,7 +12,10 @@ VERSION=	unknown
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
 
-# Choose source data features.  To get new features right away, use:
+# DATAFORM selects the data format.
+# Available formats represent essentially the same data, albeit
+# possibly with minor discrepancies that users are not likely to notice.
+# To get new features and the best data right away, use:
 #	DATAFORM=	vanguard
 # To wait a while before using new features, to give downstream users
 # time to upgrade zic (the default), use:
@@ -33,11 +36,11 @@ DATAFORM=		main
 LOCALTIME=	GMT
 
 # If you want something other than Eastern United States time as a template
-# for handling POSIX-style timezone environment variables,
+# for handling ruleless POSIX-style timezone environment variables,
 # change the line below (after finding the timezone you want in the
 # one of the $(TDATA) source files, or adding it to a source file).
-# When a POSIX-style environment variable is handled, the rules in the
-# template file are used to determine "spring forward" and "fall back" days and
+# A ruleless environment setting like TZ='CST6CDT' uses the rules in the
+# template file to determine "spring forward" and "fall back" days and
 # times; the environment variable itself specifies UT offsets of standard and
 # daylight saving time.
 # Alternatively, if you discover you've got the wrong timezone, you can just
@@ -46,7 +49,6 @@ LOCALTIME=	GMT
 # Use the command
 #	make zonenames
 # to get a list of the values you can use for POSIXRULES.
-# If you want POSIX compatibility, use "America/New_York".
 
 POSIXRULES=	America/New_York
 
@@ -113,8 +115,8 @@ TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATI
 TIME_T_ALTERNATIVES_HEAD = int64_t
 TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
 
-# What kind of TZif data files to generate.
-# (TZif is the binary time zone data format that zic generates.)
+# What kind of TZif data files to generate.  (TZif is the binary time
+# zone data format that zic generates; see Internet RFC 8536.)
 # If you want only POSIX time, with time values interpreted as
 # seconds since the epoch (not counting leap seconds), use
 #	REDO=		posix_only
@@ -360,6 +362,9 @@ LEAPSECONDS=
 zic=		./zic
 ZIC=		$(zic) $(ZFLAGS)
 
+# To shrink the size of installed TZif files,
+# append "-r @N" to omit data before N-seconds-after-the-Epoch.
+# See the zic man page for more about -r.
 ZFLAGS=
 
 # How to use zic to install TZif files.
@@ -491,7 +496,8 @@ MANTXTS=	newctime.3.txt newstrftime.3.tx
 COMMON=		calendars CONTRIBUTING LICENSE Makefile \
 			NEWS README theory.html version
 WEB_PAGES=	tz-art.html tz-how-to.html tz-link.html
-CHECK_WEB_PAGES=check_tz-art.html check_tz-how-to.html check_tz-link.html
+CHECK_WEB_PAGES=check_theory.html check_tz-art.html \
+			check_tz-how-to.html check_tz-link.html
 DOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
 PRIMARY_YDATA=	africa antarctica asia australasia \
 		europe northamerica southamerica
@@ -804,9 +810,10 @@ check_tzs:	$(TZS) $(TZS_NEW)
 		touch $@
 
 check_web:	$(CHECK_WEB_PAGES)
+check_theory.html: theory.html
 check_tz-art.html: tz-art.html
 

CVS commit: src/lib/libc/time

2019-02-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Feb 24 11:51:05 UTC 2019

Modified Files:
src/lib/libc/time: strptime.3

Log Message:
fix typo. From Evil_Bob.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/time/strptime.3

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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.36 src/lib/libc/time/strptime.3:1.37
--- src/lib/libc/time/strptime.3:1.36	Fri Oct 27 04:05:21 2017
+++ src/lib/libc/time/strptime.3	Sun Feb 24 11:51:05 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.36 2017/10/27 04:05:21 kre Exp $
+.\"	$NetBSD: strptime.3,v 1.37 2019/02/24 11:51:05 maya Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April  6, 2015
+.Dd Februrary  24, 2019
 .Dt STRPTIME 3
 .Os
 .Sh NAME
@@ -310,7 +310,7 @@ through
 .Pq non-nautical local time zone
 .El
 .It
-An arbirtrary timezone name that can be loaded from the database.
+An arbitrary timezone name that can be loaded from the database.
 .El
 .Po
 A



CVS commit: src/lib/libc/time

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 04:38:38 UTC 2019

Modified Files:
src/lib/libc/time: difftime.c localtime.c

Log Message:
fix duplicated chunk from merge


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/difftime.c
cvs rdiff -u -r1.115 -r1.116 src/lib/libc/time/localtime.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/difftime.c
diff -u src/lib/libc/time/difftime.c:1.20 src/lib/libc/time/difftime.c:1.21
--- src/lib/libc/time/difftime.c:1.20	Sun Jan 27 02:08:35 2019
+++ src/lib/libc/time/difftime.c	Sun Jan 27 04:38:38 2019
@@ -1,6 +1,4 @@
-/*	$NetBSD: difftime.c,v 1.20 2019/01/27 02:08:35 pgoyette Exp $	*/
-
-/* Return the difference between two timestamps.  */
+/*	$NetBSD: difftime.c,v 1.21 2019/01/27 04:38:38 dholland Exp $	*/
 
 /* Return the difference between two timestamps.  */
 
@@ -14,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)difftime.c	8.1";
 #else
-__RCSID("$NetBSD: difftime.c,v 1.20 2019/01/27 02:08:35 pgoyette Exp $");
+__RCSID("$NetBSD: difftime.c,v 1.21 2019/01/27 04:38:38 dholland Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.115 src/lib/libc/time/localtime.c:1.116
--- src/lib/libc/time/localtime.c:1.115	Sun Jan 27 02:08:35 2019
+++ src/lib/libc/time/localtime.c	Sun Jan 27 04:38:38 2019
@@ -1,6 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.115 2019/01/27 02:08:35 pgoyette Exp $	*/
-
-/* Convert timestamp from time_t to struct tm.  */
+/*	$NetBSD: localtime.c,v 1.116 2019/01/27 04:38:38 dholland Exp $	*/
 
 /* Convert timestamp from time_t to struct tm.  */
 
@@ -14,7 +12,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.115 2019/01/27 02:08:35 pgoyette Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.116 2019/01/27 04:38:38 dholland Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 



CVS commit: src/lib/libc/time

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 02:40:50 UTC 2019

Modified Files:
src/lib/libc/time: asctime.c

Log Message:
fix mergeo


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/time/asctime.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/asctime.c
diff -u src/lib/libc/time/asctime.c:1.26 src/lib/libc/time/asctime.c:1.27
--- src/lib/libc/time/asctime.c:1.26	Sun Jan 27 02:08:35 2019
+++ src/lib/libc/time/asctime.c	Sun Jan 27 02:40:49 2019
@@ -1,6 +1,4 @@
-/*	$NetBSD: asctime.c,v 1.26 2019/01/27 02:08:35 pgoyette Exp $	*/
-
-/* asctime and asctime_r a la POSIX and ISO C, except pad years before 1000.  */
+/*	$NetBSD: asctime.c,v 1.27 2019/01/27 02:40:49 dholland Exp $	*/
 
 /* asctime and asctime_r a la POSIX and ISO C, except pad years before 1000.  */
 
@@ -20,7 +18,7 @@
 #if 0
 static char	elsieid[] = "@(#)asctime.c	8.5";
 #else
-__RCSID("$NetBSD: asctime.c,v 1.26 2019/01/27 02:08:35 pgoyette Exp $");
+__RCSID("$NetBSD: asctime.c,v 1.27 2019/01/27 02:40:49 dholland Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 



CVS commit: src/lib/libc/time

2018-12-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan  1 03:04:56 UTC 2019

Modified Files:
src/lib/libc/time: Makefile NEWS localtime.c theory.html tz-art.html
tz-link.html version zdump.c zic.c

Log Message:
Release 2018i - 2018-12-30 11:05:43 -0800

  Briefly:
São Tomé and Príncipe switches from +01 to +00 on 2019-01-01.

  Changes to future timestamps

Due to a change in government, São Tomé and Príncipe switches back
from +01 to +00 on 2019-01-01 at 02:00.  (Thanks to Vadim
Nasardinov and Michael Deckers.)

Release 2018h - 2018-12-23 17:59:32 -0800

  Briefly:
Qyzylorda, Kazakhstan moved from +06 to +05 on 2018-12-21.
New zone Asia/Qostanay because Qostanay, Kazakhstan didn't move.
Metlakatla, Alaska observes PST this winter only.
Guess Morocco will continue to adjust clocks around Ramadan.
Add predictions for Iran from 2038 through 2090.

  Changes to future timestamps

Guess that Morocco will continue to fall back just before and
spring forward just after Ramadan, the practice since 2012.
(Thanks to Maamar Abdelkader.)  This means Morocco will observe
negative DST during Ramadan in main and vanguard formats, and in
rearguard format it stays in the +00 timezone and observes
ordinary DST in all months other than Ramadan.  As before, extend
this guesswork to the year 2037.  As a consequence, Morocco is
scheduled to observe three DST transitions in some Gregorian years
(e.g., 2033) due to the mismatch between the Gregorian and Islamic
calendars.

The table of exact transitions for Iranian DST has been extended.
It formerly cut off before the year 2038 in a nod to 32-bit time_t.
It now cuts off before 2091 as there is doubt about how the Persian
calendar will treat 2091.  This change predicts DST transitions in
2038-9, 2042-3, and 2046-7 to occur one day later than previously
predicted.  As before, post-cutoff transitions are approximated.

  Changes to past and future timestamps

Qyzylorda (aka Kyzylorda) oblast in Kazakhstan moved from +06 to
+05 on 2018-12-21.  This is a zone split as Qostanay (aka
Kostanay) did not switch, so create a zone Asia/Qostanay.

Metlakatla moved from Alaska to Pacific standard time on 2018-11-04.
It did not change clocks that day and remains on -08 this winter.
(Thanks to Ryan Stanley.)  It will revert to the usual Alaska
rules next spring, so this change affects only timestamps
from 2018-11-04 through 2019-03-10.

  Change to past timestamps

Kwajalein's 1993-08-20 transition from -12 to +12 was at 24:00,
not 00:00.  I transcribed the time incorrectly from Shanks.
(Thanks to Phake Nick.)

Nauru's 1979 transition was on 02-10 at 02:00, not 05-01 at 00:00.
(Thanks to Phake Nick.)

Guam observed DST irregularly from 1959 through 1977.
(Thanks to Phake Nick.)

Hong Kong observed DST in 1941 starting 06-15 (not 04-01), then on
10-01 changed standard time to +08:30 (not +08).  Its transition
back to +08 after WWII was on 1945-09-15, not the previous day.
Its 1904-10-30 change took effect at 01:00 +08 (not 00:00 LMT).
(Thanks to Phake Nick, Steve Allen, and Joseph Myers.)  Also,
its 1952 fallback was on 11-02 (not 10-25).

This release contains many changes to timestamps before 1946 due
to Japanese possession or occupation of Pacific/Chuuk,
Pacific/Guam, Pacific/Kosrae, Pacific/Kwajalein, Pacific/Majuro,
Pacific/Nauru, Pacific/Palau, and Pacific/Pohnpei.
(Thanks to Phake Nick.)

Assume that the Spanish East Indies was like the Philippines and
observed American time until the end of 1844.  This affects
Pacific/Chuuk, Pacific/Kosrae, Pacific/Palau, and Pacific/Pohnpei.

  Changes to past tm_isdst flags

For the recent Morocco change, the tm_isdst flag should be 1 from
2018-10-27 00:00 to 2018-10-28 03:00.  (Thanks to Michael Deckers.)
Give a URL to the official decree.  (Thanks to Matt Johnson.)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/time/Makefile
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/time/NEWS
cvs rdiff -u -r1.113 -r1.114 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/time/theory.html
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/version
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.72 -r1.73 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.41 src/lib/libc/time/Makefile:1.42
--- src/lib/libc/time/Makefile:1.41	Fri Oct 19 19:05:35 2018
+++ src/lib/libc/time/Makefile	Mon Dec 31 22:04:56 2018
@@ -380,15 +380,18 @@ AWK=		awk
 # is typically nicer if it works.
 

CVS commit: src/lib/libc/time

2018-10-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 27 22:29:24 UTC 2018

Modified Files:
src/lib/libc/time: NEWS theory.html tz-how-to.html tz-link.html
tzfile.5 version zdump.8 zic.8 zic.c

Log Message:
Welcome tzcode-2018g

  Changes to code

When generating TZif files with leap seconds, zic no longer uses a
format that trips up older 32-bit clients, fixing a bug introduced
in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
for QTBUG-53071 now also works for TZif files with leap seconds.

The translator to rearguard format now rewrites the line
"Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
"Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
and earlier.  (Reported by Christos Zoulas.)

  Changes to documentation

tzfile.5 has new sections on interoperability issues.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/time/NEWS
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/time/theory.html
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/time/tz-how-to.html
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/version
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/time/zic.8
cvs rdiff -u -r1.71 -r1.72 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/NEWS
diff -u src/lib/libc/time/NEWS:1.25 src/lib/libc/time/NEWS:1.26
--- src/lib/libc/time/NEWS:1.25	Fri Oct 19 19:05:35 2018
+++ src/lib/libc/time/NEWS	Sat Oct 27 18:29:24 2018
@@ -1,5 +1,40 @@
 News for the tz database
 
+Release 2018g - 2018-10-26 22:22:45 -0700
+
+  Briefly:
+Morocco switches to permanent +01 on 2018-10-27.
+
+  Changes to future timestamps
+
+Morocco switches from +00/+01 to permanent +01 effective 2018-10-27,
+so its clocks will not fall back on 2018-10-28 as previously scheduled.
+(Thanks to Mohamed Essedik Najd and Brian Inglis.)
+
+  Changes to code
+
+When generating TZif files with leap seconds, zic no longer uses a
+format that trips up older 32-bit clients, fixing a bug introduced
+in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
+for QTBUG-53071 now also works for TZif files with leap seconds.
+
+The translator to rearguard format now rewrites the line
+"Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
+"Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
+This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
+and earlier.  (Reported by Christos Zoulas.)
+
+  Changes to past time zone abbreviations
+
+Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii.
+This reverts to 2011h, as the abbreviation change in 2011i was
+likely inadvertent.
+
+  Changes to documentation
+
+tzfile.5 has new sections on interoperability issues.
+
+
 Release 2018f - 2018-10-18 00:14:18 -0700
 
   Briefly:

Index: src/lib/libc/time/theory.html
diff -u src/lib/libc/time/theory.html:1.4 src/lib/libc/time/theory.html:1.5
--- src/lib/libc/time/theory.html:1.4	Fri Oct 19 19:05:35 2018
+++ src/lib/libc/time/theory.html	Sat Oct 27 18:29:24 2018
@@ -407,7 +407,7 @@ in decreasing order of importance:
   EST/EDT/EWT/EPT/EDDT Eastern [North America],
   EET/EEST Eastern European,
   GST Guam,
-  HST/HDT Hawaii,
+  HST/HDT/HWT/HPT Hawaii,
   HKT/HKST Hong Kong,
   IST India,
   IST/GMT Irish,

Index: src/lib/libc/time/tz-how-to.html
diff -u src/lib/libc/time/tz-how-to.html:1.5 src/lib/libc/time/tz-how-to.html:1.6
--- src/lib/libc/time/tz-how-to.html:1.5	Fri Oct 19 19:05:35 2018
+++ src/lib/libc/time/tz-how-to.html	Sat Oct 27 18:29:24 2018
@@ -459,8 +459,8 @@ given alphabetic string.
 An example of a specific amount of time is:
 
 #Zone NAMEGMTOFF RULES FORMAT [UNTIL]
-Zone Pacific/Honolulu ... 1933 Apr 30 2:00
-  -10:30 1:00  HDT1933 May 21 2:00
+Zone Pacific/Honolulu ... 1933 Apr 30  2:00
+  -10:30 1:00  HDT1933 May 21 12:00
   ...
 
 
@@ -559,7 +559,7 @@ the true offset is undefined.
 Rule  US   1918 1919 -Oct lastSun  2:00  0S
 Rule  US   1942 only -Feb  9   2:00  1:00 W # War
 Rule  US   1945 only -Aug 14  23:00u 1:00 P # Peace
-Rule  US   1945 only -Sep 30   2:00  0S
+Rule  US   1945 only -Sep lastSun  2:00  0S
 
   
 
@@ -570,7 +570,7 @@ Rule  US   1945 only -Sep 30   2
   
 
 #Zone NAMEGMTOFFRULES FORMAT [UNTIL]
-Zone Pacific/Honolulu -10:31:26 - LMT1900 Jan  1 12:00
+Zone Pacific/Honolulu -10:31:26 - LMT1896 Jan 13 12:00
   -10:30- HST1933 Apr 30  2:00
   -10:30

CVS commit: src/lib/libc/time

2018-02-11 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb 11 13:28:50 UTC 2018

Modified Files:
src/lib/libc/time: getdate.3

Log Message:
Remove useless macro.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/getdate.3

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/getdate.3
diff -u src/lib/libc/time/getdate.3:1.9 src/lib/libc/time/getdate.3:1.10
--- src/lib/libc/time/getdate.3:1.9	Wed Feb  7 11:16:05 2018
+++ src/lib/libc/time/getdate.3	Sun Feb 11 13:28:49 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: getdate.3,v 1.9 2018/02/07 11:16:05 pgoyette Exp $
+.\"	$NetBSD: getdate.3,v 1.10 2018/02/11 13:28:49 wiz Exp $
 .\"
 .\" Copyright (c) 2009, 2011, 2012, The NetBSD Foundation.
 .\" All Rights Reserved.
@@ -176,7 +176,6 @@ run job at 3 PM, december 2nd
 .Pp
 The following examples show how local data and time specification can be
 defined in the template.
-.Pp
 .Bl -column -offset indent ".Li Friday 12:00:00" ".Sy Line in Template"
 .It Sy "Input String" Ta Sy "Line in Template"
 .It Li 11/27/86 Ta Li \&%m/\&%d/\&%y
@@ -191,7 +190,6 @@ given that the current date is
 and the
 .Ev LC_TIME
 environment variable is set to the default C locale.
-.Pp
 .Bl -column -offset indent ".Li Jan Wed 1989" ".Sy Line in Template" ".Sy Date"
 .It Sy Input String Ta Sy Line in Template Ta Sy Date
 .It Li Mon Ta Li \&%a Ta Li "Mon Sep 22 12:19:47 EDT 1986"



CVS commit: src/lib/libc/time

2018-02-11 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb 11 13:28:26 UTC 2018

Modified Files:
src/lib/libc/time: ctime.3

Log Message:
Remove Tn. Remove trailing whitespace. Remove useless Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/lib/libc/time/ctime.3

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/ctime.3
diff -u src/lib/libc/time/ctime.3:1.57 src/lib/libc/time/ctime.3:1.58
--- src/lib/libc/time/ctime.3:1.57	Wed Feb  7 11:16:05 2018
+++ src/lib/libc/time/ctime.3	Sun Feb 11 13:28:26 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.57 2018/02/07 11:16:05 pgoyette Exp $
+.\" $NetBSD: ctime.3,v 1.58 2018/02/11 13:28:26 wiz Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -131,7 +131,7 @@ or a
 .Dv NULL
 pointer denoting
 Coordinated Universal Time
-.Pq Tn UTC .
+.Pq UTC .
 .It Fn difftime "time1" "time2"
 The
 .Fn difftime
@@ -176,7 +176,7 @@ fields.
 The
 .Fn gmtime
 function converts to Coordinated Universal Time
-.Pq Tn UTC
+.Pq UTC
 and returns a pointer to the
 .Va tm
 structure described in
@@ -233,7 +233,7 @@ argument, returned by a previous call to
 or a
 .Dv NULL
 pointer denoting Coordinated Universal Time
-.Pq Tn UTC .
+.Pq UTC .
 .It Fn mktime "tm"
 The
 .Fn mktime
@@ -313,7 +313,7 @@ argument, returned by a previous call to
 .Fn tzalloc ,
 or a null pointer denoting
 Coordinated Universal Time
-.Pq Tn UTC .
+.Pq UTC .
 .El
 .Pp
 Declarations of all the functions and externals, and the
@@ -337,7 +337,6 @@ includes the following fields:
char *tm_zone;   /* abbreviation of timezone name (optional) */
long tm_gmtoff;  /* offset from UT in seconds (optional) */
 .Ed
-.Pp
 .Bl -bullet
 .It
 .Va tm_isdst
@@ -432,7 +431,7 @@ argument is
 .Dv NULL ,
 and this is not an error, but a way of referring to
 Coordinated Universal Time
-.Pq Tn UTC .
+.Pq UTC .
 .It
 .Fn tzgetzone
 function returns string containing the name of the timezone given in
@@ -509,9 +508,9 @@ point to an array of characters that
 can be freed or overwritten by later calls to the functions
 .Fn localtime ,
 .Fn tzfree ,
-and
-.Fn tzset , 
-if these functions affect the time zone information that specifies the 
+and
+.Fn tzset ,
+if these functions affect the time zone information that specifies the
 abbreviation in question.
 The remaining functions and data are thread-safe.
 The functions that do take an explicit



CVS commit: src/lib/libc/time

2018-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 25 22:48:42 UTC 2018

Modified Files:
src/lib/libc/time: Makefile NEWS README ctime.3 localtime.c theory.html
tz-how-to.html tzselect.8 tzselect.ksh tzset.3 version zdump.c
zic.8 zic.c

Log Message:
Merge tzcode2018c [ changelog with changes to tzdata sections removed ]

Release 2018c - 2018-01-22 23:00:44 -0800

  Changes to build procedure

The build procedure now works around mawk 1.3.3's lack of support
for character class expressions.  (Problem reported by Ohyama.)

Release 2018b - 2018-01-17 23:24:48 -0800

  Changes to build procedure

The distribution now contains the file 'pacificnew' again.
This file was inadvertantly omitted in the 2018a distribution.
(Problem reported by Matias Fonzo.)

Release 2018a - 2018-01-12 22:29:21 -0800

  Changes to build procedure

The default installation locations have been changed to mostly
match Debian circa 2017, instead of being designed as an add-on to
4.3BSD circa 1986.  This affects the Makefile macros TOPDIR,
TZDIR, MANDIR, and LIBDIR.  New Makefile macros TZDEFAULT, USRDIR,
USRSHAREDIR, BINDIR, ZDUMPDIR, and ZICDIR let installers tailor
locations more precisely.  (This responds to suggestions from
Brian Inglis and from Steve Summit.)

The default installation procedure no longer creates the
backward-compatibility link US/Pacific-New, which causes
confusion during user setup (e.g., see Debian bug 815200).
Use 'make BACKWARD="backward pacificnew"' to create the link
anyway, for now.  Eventually we plan to remove the link entirely.

tzdata.zi now contains a version-number comment.
(Suggested by Tom Lane.)

The Makefile now quotes values like BACKWARD more carefully when
passing them to the shell.  (Problem reported by Zefram.)

Builders no longer need to specify -DHAVE_SNPRINTF on platforms
that have snprintf and use pre-C99 compilers.  (Problem reported
by Jon Skeet.)

  Changes to code

zic has a new option -t FILE that specifies the location of the
file that determines local time when TZ is unset.  The default for
this location can be configured via the new TZDEFAULT makefile
macro, which defaults to /etc/localtime.

Diagnostics and commentary now distinguish UT from UTC more
carefully; see theory.html for more information about UT vs UTC.

zic has been ported to GCC 8's -Wstringop-truncation option.
(Problem reported by Martin Sebor.)

  Changes to documentation and commentary

The zic man page now documents the longstanding behavior that
times and years can be out of the usual range, with negative times
counting backwards from midnight and with year 0 preceding year 1.
(Problem reported by Michael Deckers.)

The theory.html file now mentions the POSIX limit of six chars
per abbreviation, and lists alphabetic abbreviations used.

The files tz-art.htm and tz-link.htm have been renamed to
tz-art.html and tz-link.html, respectively, for consistency with
other file names and to simplify web server configuration.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/Makefile
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/NEWS
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/README
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/time/ctime.3
cvs rdiff -u -r1.110 -r1.111 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/theory.html
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/time/tz-how-to.html
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/tzselect.ksh
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/time/tzset.3
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/time/version
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/zic.8
cvs rdiff -u -r1.69 -r1.70 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.38 src/lib/libc/time/Makefile:1.39
--- src/lib/libc/time/Makefile:1.38	Tue Oct 24 13:38:17 2017
+++ src/lib/libc/time/Makefile	Thu Jan 25 17:48:42 2018
@@ -42,36 +42,63 @@ POSIXRULES=	America/New_York
 # Also see TZDEFRULESTRING below, which takes effect only
 # if the time zone files cannot be accessed.
 
-# Everything gets put in subdirectories of. . .
 
-TOPDIR=		/usr/local
+# Installation locations.
+#
+# The defaults are suitable for Debian, except that if REDO is
+# posix_right or right_posix then files that Debian puts under
+# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead
+# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps,
+# respectively.  Problems with the Debian approach are discussed in
+# the commentary for the right_posix rule (below).
+
+# Destination directory, 

CVS commit: src/lib/libc/time

2017-10-29 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Sun Oct 29 06:07:48 UTC 2017

Modified Files:
src/lib/libc/time: time2posix.3

Log Message:
Fix the escape used for em dash

ok wiz@


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/time2posix.3

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/time2posix.3
diff -u src/lib/libc/time/time2posix.3:1.21 src/lib/libc/time/time2posix.3:1.22
--- src/lib/libc/time/time2posix.3:1.21	Wed Oct 25 19:04:07 2017
+++ src/lib/libc/time/time2posix.3	Sun Oct 29 06:07:48 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time2posix.3,v 1.21 2017/10/25 19:04:07 abhinav Exp $
+.\"	$NetBSD: time2posix.3,v 1.22 2017/10/29 06:07:48 abhinav Exp $
 .Dd October 6, 2014
 .Dt TIME2POSIX 3
 .Os
@@ -46,7 +46,7 @@ by the net number of leap seconds insert
 Typically this is not a problem as the type
 .Va time_t
 is intended to be (mostly)
-opaque \*(en
+opaque \(em
 .Va time_t
 values should only be obtained-from and
 passed-to functions such as



CVS commit: src/lib/libc/time

2017-10-27 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Oct 27 08:43:11 UTC 2017

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Replace a line that somehow got lost in the import from tzcode2017c


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.109 src/lib/libc/time/localtime.c:1.110
--- src/lib/libc/time/localtime.c:1.109	Tue Oct 24 17:38:17 2017
+++ src/lib/libc/time/localtime.c	Fri Oct 27 08:43:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.109 2017/10/24 17:38:17 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.110 2017/10/27 08:43:11 kre 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.109 2017/10/24 17:38:17 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.110 2017/10/27 08:43:11 kre Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -463,6 +463,7 @@ tzloadbody(char const *name, struct stat
 		/* Set doaccess if '.' (as in "../") shows up in name.  */
 		if (strchr(name, '.'))
 			doaccess = true;
+		name = lsp->fullname;
 	}
 	if (doaccess && access(name, R_OK) != 0)
 		return errno;



CVS commit: src/lib/libc/time

2017-10-26 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Oct 27 04:05:21 UTC 2017

Modified Files:
src/lib/libc/time: strptime.3

Log Message:
Minor typo: Coordinated Universal time  should be  Coordinated Universal Time


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/time/strptime.3

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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.35 src/lib/libc/time/strptime.3:1.36
--- src/lib/libc/time/strptime.3:1.35	Sun Dec 25 06:37:50 2016
+++ src/lib/libc/time/strptime.3	Fri Oct 27 04:05:21 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.35 2016/12/25 06:37:50 abhinav Exp $
+.\"	$NetBSD: strptime.3,v 1.36 2017/10/27 04:05:21 kre Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -242,7 +242,7 @@ specified as:
 .Bl -bullet -offset indent -compact
 .It
 UTC
-.Pq Ql Coordinated Universal time
+.Pq Ql Coordinated Universal Time
 .It
 GMT
 .Pq Ql Greenwich Mean Time



CVS commit: src/lib/libc/time

2017-10-25 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Wed Oct 25 19:04:07 UTC 2017

Modified Files:
src/lib/libc/time: time2posix.3

Log Message:
Remove comma after last Nm entry
Remove whitespace at the end of a line


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/time2posix.3

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/time2posix.3
diff -u src/lib/libc/time/time2posix.3:1.20 src/lib/libc/time/time2posix.3:1.21
--- src/lib/libc/time/time2posix.3:1.20	Mon Jul  3 21:32:50 2017
+++ src/lib/libc/time/time2posix.3	Wed Oct 25 19:04:07 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time2posix.3,v 1.20 2017/07/03 21:32:50 wiz Exp $
+.\"	$NetBSD: time2posix.3,v 1.21 2017/10/25 19:04:07 abhinav Exp $
 .Dd October 6, 2014
 .Dt TIME2POSIX 3
 .Os
@@ -6,7 +6,7 @@
 .Nm time2posix ,
 .Nm time2posix_z ,
 .Nm posix2time ,
-.Nm posix2time_z ,
+.Nm posix2time_z
 .Nd convert seconds since the Epoch
 .Sh LIBRARY
 .Lb libc
@@ -37,7 +37,7 @@ If the time package is configured with l
 enabled, however, no such adjustment is needed and
 .Va time_t
 values continue to increase over leap events
-(as a true 
+(as a true
 .Dq "seconds since..."
 value).
 This means that these values will differ from those required by POSIX



CVS commit: src/lib/libc/time

2017-10-25 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Wed Oct 25 19:01:25 UTC 2017

Modified Files:
src/lib/libc/time: offtime.3

Log Message:
Add offtime_r to the NAME section


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/time/offtime.3

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/offtime.3
diff -u src/lib/libc/time/offtime.3:1.3 src/lib/libc/time/offtime.3:1.4
--- src/lib/libc/time/offtime.3:1.3	Thu Apr 14 05:50:50 2011
+++ src/lib/libc/time/offtime.3	Wed Oct 25 19:01:25 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: offtime.3,v 1.3 2011/04/14 05:50:50 jruoho Exp $
+.\"	$NetBSD: offtime.3,v 1.4 2017/10/25 19:01:25 abhinav Exp $
 .\" Written by Klaus Klein, May 10, 2004.
 .\" Public domain.
 .Dd April 14, 2011
@@ -6,6 +6,7 @@
 .Os
 .Sh NAME
 .Nm offtime ,
+.Nm offtime_r ,
 .Nm timeoff ,
 .Nm timegm ,
 .Nm timelocal



CVS commit: src/lib/libc/time

2017-08-11 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Aug 12 03:29:23 UTC 2017

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Fix a couple comments and a spacing nit.

- Change a XXX comment that no longer applies.
- Add a clarifying comment.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.60 src/lib/libc/time/strptime.c:1.61
--- src/lib/libc/time/strptime.c:1.60	Sun May 15 20:37:48 2016
+++ src/lib/libc/time/strptime.c	Sat Aug 12 03:29:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.60 2016/05/15 20:37:48 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.61 2017/08/12 03:29:23 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.60 2016/05/15 20:37:48 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.61 2017/08/12 03:29:23 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
@@ -382,10 +382,10 @@ literal:
 		case 'U':	/* The week of year, beginning on sunday. */
 		case 'W':	/* The week of year, beginning on monday. */
 			/*
-			 * XXX This is bogus, as we can not assume any valid
+			 * This is bogus, as we can not assume any valid
 			 * information present in the tm structure at this
-			 * point to calculate a real value, so just check the
-			 * range for now.
+			 * point to calculate a real value, so save the
+			 * week for now in case it can be used later.
 			 */
 			bp = conv_num(bp, , 0, 53);
 			LEGAL_ALT(ALT_O);
@@ -516,7 +516,7 @@ namedzone:
 /* Nautical / Military style */
 if (delim(bp[1]) &&
 ((*bp >= 'A' && *bp <= 'I') ||
-(*bp >= 'L' && *bp <= 'Y'))) {
+ (*bp >= 'L' && *bp <= 'Y'))) {
 #ifdef TM_GMTOFF
 	/* Argh! No 'J'! */
 	if (*bp >= 'A' && *bp <= 'I')
@@ -635,6 +635,7 @@ loadzone:
 bp = zname;
 continue;
 			}
+			/* ISO 8601 & RFC 3339 limit to 23:59 max */
 			if (offs >= (HOURSPERDAY * SECSPERHOUR))
 goto out;
 			if (neg)



CVS commit: src/lib/libc/time

2017-05-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed May 10 10:34:30 UTC 2017

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Turns out that the previous fix is incorrect, we were not doing ++hit
to change the boolean hit from false to true, but to change it from 1 to 2
which in a sense should have been obvious from the context:
if (hit)
/* more tests */
++hit;
The real problem was that hit was (in the imported tzcode) incorrectly
changed from int to bool in a previous update.

Not that it matters, this code is never actually executed - it was there
to deal with the mythical double leapseconds, which simply never exist
(hit counted the number of leapseconds in an adjustment) and it will all
be gone in the next tzcode update.

For now, just turn hit back into an int, which should satisfy gcc 8,
I hope.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.107 src/lib/libc/time/localtime.c:1.108
--- src/lib/libc/time/localtime.c:1.107	Tue May  9 02:30:49 2017
+++ src/lib/libc/time/localtime.c	Wed May 10 10:34:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.107 2017/05/09 02:30:49 maya Exp $	*/
+/*	$NetBSD: localtime.c,v 1.108 2017/05/10 10:34:30 kre 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.107 2017/05/09 02:30:49 maya Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.108 2017/05/10 10:34:30 kre Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1698,7 +1698,7 @@ timesub(const time_t *timep, int_fast32_
 	int			y;
 	const int *		ip;
 	int_fast64_t		corr;
-	bool			hit;
+	int			hit;
 	int			i;
 
 	corr = 0;
@@ -1716,7 +1716,7 @@ timesub(const time_t *timep, int_fast32_
 		sp->lsis[i - 1].ls_trans + 1 &&
 		sp->lsis[i].ls_corr ==
 		sp->lsis[i - 1].ls_corr + 1) {
-			hit = true;
+			++hit;
 			--i;
 	}
 			}



CVS commit: src/lib/libc/time

2017-05-08 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue May  9 02:30:49 UTC 2017

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
++bool to bool=true to appease GCC 8. NFC

ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.106 src/lib/libc/time/localtime.c:1.107
--- src/lib/libc/time/localtime.c:1.106	Sat Mar 11 18:23:14 2017
+++ src/lib/libc/time/localtime.c	Tue May  9 02:30:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.106 2017/03/11 18:23:14 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.107 2017/05/09 02:30:49 maya 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.106 2017/03/11 18:23:14 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.107 2017/05/09 02:30:49 maya Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1716,7 +1716,7 @@ timesub(const time_t *timep, int_fast32_
 		sp->lsis[i - 1].ls_trans + 1 &&
 		sp->lsis[i].ls_corr ==
 		sp->lsis[i - 1].ls_corr + 1) {
-			++hit;
+			hit = true;
 			--i;
 	}
 			}



CVS commit: src/lib/libc/time

2017-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 25 13:19:45 UTC 2017

Modified Files:
src/lib/libc/time: NEWS tz-link.htm version

Log Message:
merge tzcode2017b.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/NEWS
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/time/version

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/NEWS
diff -u src/lib/libc/time/NEWS:1.20 src/lib/libc/time/NEWS:1.21
--- src/lib/libc/time/NEWS:1.20	Sat Mar 11 13:23:14 2017
+++ src/lib/libc/time/NEWS	Tue Apr 25 09:19:44 2017
@@ -1,5 +1,21 @@
 News for the tz database
 
+Release 2017b - 2017-03-17 07:30:38 -0700
+
+  Briefly: Haiti has resumed DST.
+
+  Changes to past and future time stamps
+
+Haiti resumed observance of DST in 2017.  (Thanks to Steffen Thorsen.)
+
+  Changes to past time stamps
+
+Liberia changed from -004430 to +00 on 1972-01-07, not 1972-05-01.
+
+Use "MMT" to abbreviate Liberia's time zone before 1972, as "-004430"
+is one byte over the POSIX limit.  (Problem reported by Derick Rethans.)
+
+
 Release 2017a - 2017-02-28 00:05:36 -0800
 
   Briefly: Southern Chile moves from -04/-03 to -03, and Mongolia

Index: src/lib/libc/time/tz-link.htm
diff -u src/lib/libc/time/tz-link.htm:1.30 src/lib/libc/time/tz-link.htm:1.31
--- src/lib/libc/time/tz-link.htm:1.30	Sat Mar 11 13:23:14 2017
+++ src/lib/libc/time/tz-link.htm	Tue Apr 25 09:19:44 2017
@@ -10,7 +10,7 @@
  content="Sources for time zone and daylight saving time data">
 
 
-
+
 
 http://www.iso.org/iso/catalogue_detail?csnumber=40874;>https://www.iso.org/standard/40874.html;>ISO
 8601:2004  Data elements and interchange formats  Information
 interchange  Representation of dates and times.

Index: src/lib/libc/time/version
diff -u src/lib/libc/time/version:1.3 src/lib/libc/time/version:1.4
--- src/lib/libc/time/version:1.3	Sat Mar 11 13:23:14 2017
+++ src/lib/libc/time/version	Tue Apr 25 09:19:45 2017
@@ -1 +1 @@
-2017a
+2017b



CVS commit: src/lib/libc/time

2017-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar 11 18:23:14 UTC 2017

Modified Files:
src/lib/libc/time: CONTRIBUTING Makefile NEWS README Theory asctime.c
localtime.c private.h strftime.3 strftime.c tz-art.htm tz-link.htm
version zdump.8 zdump.c zic.c

Log Message:
merge 2017a


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/CONTRIBUTING
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/time/Makefile
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/NEWS
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/README
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/Theory
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/asctime.c
cvs rdiff -u -r1.105 -r1.106 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/time/private.h
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/strftime.3
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/tz-art.htm \
src/lib/libc/time/zdump.8
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/time/version
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.67 -r1.68 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/CONTRIBUTING
diff -u src/lib/libc/time/CONTRIBUTING:1.1 src/lib/libc/time/CONTRIBUTING:1.2
--- src/lib/libc/time/CONTRIBUTING:1.1	Tue Mar 15 11:16:01 2016
+++ src/lib/libc/time/CONTRIBUTING	Sat Mar 11 13:23:14 2017
@@ -18,10 +18,10 @@ data should contain commentary citing re
 justification.
 
 Please submit changes against either the latest release in
- or the master branch of the experimental
-Git repository.  If you use Git the following workflow may be helpful:
+ or the master branch of the development
+repository.  If you use Git the following workflow may be helpful:
 
-  * Copy the experimental repository.
+  * Copy the development repository.
 
   git clone https://github.com/eggert/tz.git
   cd tz

Index: src/lib/libc/time/Makefile
diff -u src/lib/libc/time/Makefile:1.36 src/lib/libc/time/Makefile:1.37
--- src/lib/libc/time/Makefile:1.36	Fri Nov  4 15:41:53 2016
+++ src/lib/libc/time/Makefile	Sat Mar 11 13:23:14 2017
@@ -72,11 +72,11 @@ MANDIR=		$(TOPDIR)/man
 
 LIBDIR=		$(TOPDIR)/lib
 
-# If you always want time values interpreted as "seconds since the epoch
-# (not counting leap seconds)", use
+# If you want only POSIX time, with time values interpreted as
+# seconds since the epoch (not counting leap seconds), use
 #	REDO=		posix_only
-# below.  If you always want right time values interpreted as "seconds since
-# the epoch" (counting leap seconds)", use
+# below.  If you want want only "right" time, with values interpreted
+# as seconds since the epoch (counting leap seconds), use
 #	REDO=		right_only
 # below.  If you want both sets of data available, with leap seconds not
 # counted normally, use
@@ -85,7 +85,10 @@ LIBDIR=		$(TOPDIR)/lib
 # normally, use
 #	REDO=		right_posix
 # below.  POSIX mandates that leap seconds not be counted; for compatibility
-# with it, use "posix_only" or "posix_right".
+# with it, use "posix_only" or "posix_right".  Use POSIX time on systems with
+# leap smearing; this can work better than unsmeared "right" time with
+# applications that are not leap second aware, and is closer to unsmeared
+# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error).
 
 REDO=		posix_right
 
@@ -166,7 +169,7 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-co
 	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
 	-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
 	-Wsuggest-attribute=pure -Wtrampolines \
-	-Wunused -Wwrite-strings \
+	-Wundef -Wunused -Wwrite-strings \
 	-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
 	-Wno-type-limits -Wno-unused-parameter
 #
@@ -543,7 +546,8 @@ force_tzs:	$(TZS_NEW)
 		cp $(TZS_NEW) $(TZS)
 
 libtz.a:	$(LIBOBJS)
-		$(AR) ru $@ $(LIBOBJS)
+		rm -f $@
+		$(AR) -rc $@ $(LIBOBJS)
 		$(RANLIB) $@
 
 date:		$(DATEOBJS)

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.19 src/lib/libc/time/NEWS:1.20
--- src/lib/libc/time/NEWS:1.19	Fri Nov  4 15:41:53 2016
+++ src/lib/libc/time/NEWS	Sat Mar 11 13:23:14 2017
@@ -1,5 +1,154 @@
 News for the tz database
 
+Release 2017a - 2017-02-28 00:05:36 -0800
+
+  Briefly: Southern Chile moves from -04/-03 to -03, and Mongolia
+  discontinues DST.
+
+  Changes to future time stamps
+
+Mongolia no longer observes DST.  (Thanks to Ganbold Tsagaankhuu.)
+
+Chile's Region of Magallanes moves from -04/-03 to -03 year-round.
+Its clocks diverge from America/Santiago starting 2017-05-13 at
+23:00, hiving off a new zone America/Punta_Arenas.  Although the
+Chilean government says this change expires in May 2019, for now
+assume it's permanent.  (Thanks to Juan 

CVS commit: src/lib/libc/time

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 17:44:51 UTC 2017

Modified Files:
src/lib/libc/time: difftime.c

Log Message:
add constcond


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/difftime.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/difftime.c
diff -u src/lib/libc/time/difftime.c:1.16 src/lib/libc/time/difftime.c:1.17
--- src/lib/libc/time/difftime.c:1.16	Thu Aug 13 07:21:18 2015
+++ src/lib/libc/time/difftime.c	Tue Jan 10 12:44:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: difftime.c,v 1.16 2015/08/13 11:21:18 christos Exp $	*/
+/*	$NetBSD: difftime.c,v 1.17 2017/01/10 17:44:51 christos Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)difftime.c	8.1";
 #else
-__RCSID("$NetBSD: difftime.c,v 1.16 2015/08/13 11:21:18 christos Exp $");
+__RCSID("$NetBSD: difftime.c,v 1.17 2017/01/10 17:44:51 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -32,6 +32,7 @@ difftime(time_t time1, time_t time0)
 	** If double is large enough, simply convert and subtract
 	** (assuming that the larger type has more precision).
 	*/
+	/*CONSTCOND*/
 	if (sizeof (time_t) < sizeof (double)) {
 		double t1 = time1, t0 = time0;
 		return t1 - t0;
@@ -45,6 +46,7 @@ difftime(time_t time1, time_t time0)
 		return time0 <= time1 ? time1 - time0 : dminus(time0 - time1);
 
 	/* Use uintmax_t if wide enough.  */
+	/*CONSTCOND*/
 	if (sizeof (time_t) <= sizeof (uintmax_t)) {
 		uintmax_t t1 = time1, t0 = time0;
 		return time0 <= time1 ? t1 - t0 : dminus(t0 - t1);



CVS commit: src/lib/libc/time

2016-12-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Dec 29 21:03:51 UTC 2016

Modified Files:
src/lib/libc/time: ctime.3

Log Message:
Fix asctime_r prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/time/ctime.3

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/ctime.3
diff -u src/lib/libc/time/ctime.3:1.53 src/lib/libc/time/ctime.3:1.54
--- src/lib/libc/time/ctime.3:1.53	Thu Dec 22 17:39:28 2016
+++ src/lib/libc/time/ctime.3	Thu Dec 29 21:03:51 2016
@@ -1,8 +1,8 @@
-.\" $NetBSD: ctime.3,v 1.53 2016/12/22 17:39:28 abhinav Exp $
+.\" $NetBSD: ctime.3,v 1.54 2016/12/29 21:03:51 wiz Exp $
 .\"
 .\" XXX: License missing?
 .\"
-.Dd October 7, 2014
+.Dd December 29, 2016
 .Dt CTIME 3
 .Os
 .Sh NAME
@@ -28,7 +28,7 @@
 .Ft char *
 .Fn asctime "const struct tm *tm"
 .Ft char *
-.Fn asctime_r "const struct tm restrict tm" "char * restrict buf"
+.Fn asctime_r "const struct tm *restrict tm" "char * restrict buf"
 .Ft char *
 .Fn ctime "const time_t *clock"
 .Ft char *



CVS commit: src/lib/libc/time

2016-12-24 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Sun Dec 25 06:37:50 UTC 2016

Modified Files:
src/lib/libc/time: strptime.3

Log Message:
As per the IEEE 1003.1-2008 standard, the range of values for the %S
format specifier is [0,60].


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/time/strptime.3

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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.34 src/lib/libc/time/strptime.3:1.35
--- src/lib/libc/time/strptime.3:1.34	Sat Oct 31 02:09:06 2015
+++ src/lib/libc/time/strptime.3	Sun Dec 25 06:37:50 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.34 2015/10/31 02:09:06 ginsbach Exp $
+.\"	$NetBSD: strptime.3,v 1.35 2016/12/25 06:37:50 abhinav Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -162,7 +162,7 @@ the time (12-hour clock) with %p, using 
 .It Cm \&%R
 the time as %H:%M.
 .It Cm \&%S
-the seconds [0,61];
+the seconds [0,60];
 leading zeros are permitted but not required.
 .It Cm \&%s
 the number of seconds since the Epoch, UTC (see



CVS commit: src/lib/libc/time

2016-12-23 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Sat Dec 24 05:33:51 UTC 2016

Modified Files:
src/lib/libc/time: strftime.3

Log Message:
As per C99 the range of values for the %S format specifier is [0,60]
rather than [0,61]. The standard has removed mention of double leap seconds.
The standard has give the following rationale in the time.h man page:

"The range [0,60] seconds allows for positive or negative leap seconds.
The formal definition of UTC does not permit double leap seconds, so all
mention of double leap seconds has been removed, and the range shortened
from the former [0,61] seconds seen in previous versions of POSIX."


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/strftime.3

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/strftime.3
diff -u src/lib/libc/time/strftime.3:1.31 src/lib/libc/time/strftime.3:1.32
--- src/lib/libc/time/strftime.3:1.31	Thu Sep 22 23:18:10 2016
+++ src/lib/libc/time/strftime.3	Sat Dec 24 05:33:51 2016
@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)strftime.3	5.12 (Berkeley) 6/29/91
-.\"	$NetBSD: strftime.3,v 1.31 2016/09/22 23:18:10 pgoyette Exp $
+.\"	$NetBSD: strftime.3,v 1.32 2016/12/24 05:33:51 abhinav Exp $
 .\"
-.Dd September 22, 2016
+.Dd December 21, 2016
 .Dt STRFTIME 3
 .Os
 .Sh NAME
@@ -144,10 +144,10 @@ is replaced by the time in the format
 is replaced by the locale's representation of 12-hour clock time
 using AM/PM notation.
 .It Cm \&%S
-is replaced by the second as a decimal number [00,61].
+is replaced by the second as a decimal number [00,60].
 The range of
-seconds is (00-61) instead of (00-59) to allow for the periodic occurrence
-of leap seconds and double leap seconds.
+seconds is (00-60) instead of (00-59) to allow for the periodic occurrence
+of leap seconds.
 .It Cm %s
 is replaced by the number of seconds since the Epoch (see
 .Xr ctime 3 ) .



CVS commit: src/lib/libc/time

2016-12-22 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Thu Dec 22 17:39:29 UTC 2016

Modified Files:
src/lib/libc/time: ctime.3

Log Message:
Remove trailing comma at the end of the last .Nm entry in the NAME section


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/time/ctime.3

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/ctime.3
diff -u src/lib/libc/time/ctime.3:1.52 src/lib/libc/time/ctime.3:1.53
--- src/lib/libc/time/ctime.3:1.52	Thu Dec 22 17:27:02 2016
+++ src/lib/libc/time/ctime.3	Thu Dec 22 17:39:28 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.52 2016/12/22 17:27:02 abhinav Exp $
+.\" $NetBSD: ctime.3,v 1.53 2016/12/22 17:39:28 abhinav Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -18,7 +18,7 @@
 .Nm localtime_r ,
 .Nm localtime_rz ,
 .Nm mktime ,
-.Nm mktime_z ,
+.Nm mktime_z
 .Nd convert date and time
 .Sh LIBRARY
 .Lb libc



CVS commit: src/lib/libc/time

2016-12-22 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Thu Dec 22 17:27:02 UTC 2016

Modified Files:
src/lib/libc/time: ctime.3

Log Message:
Grammar fixes at few places
Also, don't use .D1 inside .Bd (mandoc -Tlint was complaining)
Remove whitespace at the end of a sentence


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/lib/libc/time/ctime.3

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/ctime.3
diff -u src/lib/libc/time/ctime.3:1.51 src/lib/libc/time/ctime.3:1.52
--- src/lib/libc/time/ctime.3:1.51	Tue Oct  7 21:51:03 2014
+++ src/lib/libc/time/ctime.3	Thu Dec 22 17:27:02 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.51 2014/10/07 21:51:03 christos Exp $
+.\" $NetBSD: ctime.3,v 1.52 2016/12/22 17:27:02 abhinav Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -65,7 +65,7 @@ function converts a time value contained
 .Fa tm
 structure to a string with the following general format:
 .Bd -literal -offset indent
-.D1 Thu Nov 24 18:22:48 1986\en\e0
+Thu Nov 24 18:22:48 1986\en\e0
 .Ed
 .Pp
 The
@@ -77,7 +77,7 @@ The
 .Fn asctime_r
 has the same behavior as
 .Fn asctime ,
-but the result is stored to
+but the result is stored in
 .Fa buf ,
 which should have a size of at least 26 bytes.
 .It Fn ctime "clock"
@@ -91,7 +91,7 @@ and returns a pointer to a string with t
 Years requiring fewer than four characters are padded with leading zeroes.
 For years longer than four characters, the string is of the form
 .Bd -literal -offset indent
-.D1 "Thu Nov 24 18:22:48 81986\en\e0"
+Thu Nov 24 18:22:48 81986\en\e0
 .Ed
 .Pp
 with five spaces before the year.
@@ -114,7 +114,7 @@ The
 .Fn ctime_r
 is similar to
 .Fn ctime ,
-except it places the result of the conversion on the
+except it places the result of the conversion in the
 .Fa buf
 argument, which should be 26 or more bytes long,
 instead of using a global static buffer.
@@ -165,7 +165,7 @@ is
 .Dv NULL ,
 UTC is used; otherwise,
 .Fa zone
-should be have been allocated by
+should have been allocated by
 .Fn tzalloc
 and should not be freed until after all uses (e.g., by calls to
 .Fn strftime )
@@ -184,11 +184,11 @@ structure described in
 .It Fn gmtime_r "clock" "result"
 The
 .Fn gmtime_r
-provides the same functionality as
+function provides the same functionality as
 .Fn gmtime ,
 differing in that the caller must supply a buffer area
 .Fa result
-to which the result is stored.
+in which the result is stored.
 .It Fn localtime "clock"
 Also
 .Fn localtime
@@ -215,7 +215,7 @@ the
 .Fn localtime_r
 takes an additional buffer
 .Fa result
-as a parameter and stores the result to it.
+as a parameter and stores the result in it.
 Note however that
 .Fn localtime_r
 does not imply initialization of the local time conversion information;
@@ -316,7 +316,7 @@ Coordinated Universal Time
 .Pq Tn UTC .
 .El
 .Pp
-Declarations of all the functions and externals, and the 
+Declarations of all the functions and externals, and the
 .Ft tm
 structure, are in the
 .In time.h
@@ -490,7 +490,7 @@ Rest of the functions conform to
 .Sh CAVEATS
 The functions that do not take an explicit
 .Ft timezone_t
-argument return values point to static data; the data is overwritten by
+argument return values pointing to static data; the data is overwritten by
 each call.
 For the above functions the
 .Fa tm_zone



CVS commit: src/lib/libc/time

2016-11-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Nov  5 23:09:37 UTC 2016

Modified Files:
src/lib/libc/time: zic.c

Log Message:
Actually, this problem won't be reported upstream, their code is
just ...

ptrdiff_t nitems_max = PTRDIFF_MAX - WORK_AROUND_QTBUG_53071;
ptrdiff_t amax = nitems_max < SIZE_MAX ? nitems_max : SIZE_MAX;

which is just fine if you think about it a little,   Unfortunately,
in our zealous effort to never leave a ggc warning unused, and to
treat all of the warnings as fatal errors, that code falls foul of the
"you must not compare an unsigned value with a signed value" warning.

nitems_max is a (signed) largish positive integer (obviously, by
inspection).  If it is less than SIZE_MAX then amax is just nitems_max.
In the unlikely case that size_t has less bits than ptrdiff_t so
SIZE_MAX is smaller, amax is limited to SIZE_MAX (which in that case
is known to fit in the ptrdiff_t and to remain positive).

To pacify gcc (and the way the build system uses it), casts are
required.   Unfortunately the cast that was installed here was to
convert SIZE_MAX to a ptrdiff_t.  Unfortunately when ptrdiff_t has
the same number of bits (or less) as size_t (ie: the common case)
but is signed, (ptrdiff_t)SIZE_MAX is just a fancy way of writing -1.

Rearrange the casting in a way that keeps the original intent
of the code for us (it is actyaly now incorrect if size_t has less
bits than a ptrdiff_t) and keeps gcc happy, all at the same time.

What a mess.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 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/zic.c
diff -u src/lib/libc/time/zic.c:1.66 src/lib/libc/time/zic.c:1.67
--- src/lib/libc/time/zic.c:1.66	Sat Nov  5 22:21:48 2016
+++ src/lib/libc/time/zic.c	Sat Nov  5 23:09:37 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $	*/
+/*	$NetBSD: zic.c,v 1.67 2016/11/05 23:09:37 kre Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $");
+__RCSID("$NetBSD: zic.c,v 1.67 2016/11/05 23:09:37 kre Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -452,14 +452,9 @@ growalloc(void *ptr, size_t itemsize, pt
 	if (nitems < *nitems_alloc)
 		return ptr;
 	else {
-#define IMAX (INT_MAX < SIZE_MAX ? INT_MAX : (int)SIZE_MAX)
-#if 0
 		ptrdiff_t nitems_max = PTRDIFF_MAX - WORK_AROUND_QTBUG_53071;
-		ptrdiff_t amax = nitems_max < (ptrdiff_t)SIZE_MAX ?
-		nitems_max : (ptrdiff_t)SIZE_MAX;
-#endif
-		int nitems_max = IMAX - WORK_AROUND_QTBUG_53071;
-		int amax = nitems_max < IMAX ? nitems_max : IMAX;
+		ptrdiff_t amax = (ptrdiff_t)((size_t)nitems_max < SIZE_MAX ?
+		(size_t)nitems_max : SIZE_MAX);
 		if ((amax - 1) / 3 * 2 < *nitems_alloc)
 			memory_exhausted(_("integer overflow"));
 		*nitems_alloc += (*nitems_alloc >> 1) + 1;



CVS commit: src/lib/libc/time

2016-11-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Nov  5 22:21:48 UTC 2016

Modified Files:
src/lib/libc/time: zic.c

Log Message:
Revert a couple of lines of code from tzcode2016i to their state in 2016h

SIZE_MAX is the max value of a size_t (and is unsigned) so when converted
to a ptrdiff_t  (int) becomes -1.   That's not what the code was attempting
to achieve.

This will be reported upstream to the tzcode maintainers, and we'll see
what variation appears in tzcode2016j ...

Until then, the older code always worked for us, so it will do for now.

This should fix the broken i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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/zic.c
diff -u src/lib/libc/time/zic.c:1.65 src/lib/libc/time/zic.c:1.66
--- src/lib/libc/time/zic.c:1.65	Fri Nov  4 19:41:53 2016
+++ src/lib/libc/time/zic.c	Sat Nov  5 22:21:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.65 2016/11/04 19:41:53 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.65 2016/11/04 19:41:53 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.66 2016/11/05 22:21:48 kre Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -453,9 +453,13 @@ growalloc(void *ptr, size_t itemsize, pt
 		return ptr;
 	else {
 #define IMAX (INT_MAX < SIZE_MAX ? INT_MAX : (int)SIZE_MAX)
+#if 0
 		ptrdiff_t nitems_max = PTRDIFF_MAX - WORK_AROUND_QTBUG_53071;
 		ptrdiff_t amax = nitems_max < (ptrdiff_t)SIZE_MAX ?
 		nitems_max : (ptrdiff_t)SIZE_MAX;
+#endif
+		int nitems_max = IMAX - WORK_AROUND_QTBUG_53071;
+		int amax = nitems_max < IMAX ? nitems_max : IMAX;
 		if ((amax - 1) / 3 * 2 < *nitems_alloc)
 			memory_exhausted(_("integer overflow"));
 		*nitems_alloc += (*nitems_alloc >> 1) + 1;



CVS commit: src/lib/libc/time

2016-11-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  5 01:08:58 UTC 2016

Modified Files:
src/lib/libc/time: private.h

Log Message:
lint knows about _Generic


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libc/time/private.h

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/private.h
diff -u src/lib/libc/time/private.h:1.48 src/lib/libc/time/private.h:1.49
--- src/lib/libc/time/private.h:1.48	Fri Nov  4 15:41:53 2016
+++ src/lib/libc/time/private.h	Fri Nov  4 21:08:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: private.h,v 1.48 2016/11/04 19:41:53 christos Exp $	*/
+/*	$NetBSD: private.h,v 1.49 2016/11/05 01:08:58 christos Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -541,7 +541,7 @@ time_t time2posix_z(timezone_t __restric
 /* The minimum and maximum finite time values.  This implementation
assumes no padding if time_t is signed and either the compiler is
pre-C11 or time_t is not one of the standard signed integer types.  */
-#if (201112 <= __STDC_VERSION__) && !defined(__lint__)
+#if 201112 <= __STDC_VERSION__
 static time_t const time_t_min
   = (TYPE_SIGNED(time_t)
  ? _Generic((time_t) 0,



CVS commit: src/lib/libc/time

2016-11-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov  4 19:41:53 UTC 2016

Modified Files:
src/lib/libc/time: Makefile NEWS localtime.c private.h tz-art.htm
tz-link.htm version zic.c
Added Files:
src/lib/libc/time: LICENSE

Log Message:
tzcode2016i


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc/time/LICENSE
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/time/Makefile
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/NEWS
cvs rdiff -u -r1.104 -r1.105 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/time/private.h
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/version
cvs rdiff -u -r1.64 -r1.65 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.35 src/lib/libc/time/Makefile:1.36
--- src/lib/libc/time/Makefile:1.35	Thu Oct 20 13:41:34 2016
+++ src/lib/libc/time/Makefile	Fri Nov  4 15:41:53 2016
@@ -129,6 +129,10 @@ LDLIBS=
 #  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h"
 #  -DHAVE_TZSET=0 if your system lacks a tzset function
 #  -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?)
+#  -DEPOCH_LOCAL=1 if the 'time' function returns local time not UT
+#  -DEPOCH_OFFSET=N if the 'time' function returns a value N greater
+#	than what POSIX specifies, assuming local time is UT.
+#	For example, N is 252460800 on AmigaOS.
 #  -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
@@ -714,18 +718,12 @@ check_time_t_alternatives:
 		done
 		rm -fr time_t.dir
 
-tarballs signatures: version
-		$(MAKE) VERSION="$$(cat version)" $@_version
-
 tarballs_version: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz \
 		tzdb-$(VERSION).tar.lz
 tarballs traditional_tarballs signatures traditional_signatures: version
 		VERSION=`cat version` && \
 		$(MAKE) VERSION="$$VERSION" $@_version
 
-tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz
-traditional_tarballs_version: \
-  tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
 signatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc
 traditional_signatures_version: \
   tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.18 src/lib/libc/time/NEWS:1.19
--- src/lib/libc/time/NEWS:1.18	Thu Oct 20 13:41:34 2016
+++ src/lib/libc/time/NEWS	Fri Nov  4 15:41:53 2016
@@ -1,5 +1,65 @@
 News for the tz database
 
+Release 2016i - 2016-11-01 23:19:52 -0700
+
+  Briefly: Cyprus split into two time zones on 2016-10-30, and Tonga
+  reintroduces DST on 2016-11-06.
+
+  Changes to future time stamps
+
+Pacific/Tongatapu begins DST on 2016-11-06 at 02:00, ending on
+2017-01-15 at 03:00.  Assume future observances in Tonga will be
+from the first Sunday in November through the third Sunday in
+January, like Fiji.  (Thanks to Pulu ʻAnau.)  Switch to numeric
+time zone abbreviations for this zone.
+
+  Changes to past and future time stamps
+
+Northern Cyprus is now +03 year round, causing a split in Cyprus
+time zones starting 2016-10-30 at 04:00.  This creates a zone
+Asia/Famagusta.  (Thanks to Even Scharning and Matt Johnson.)
+
+Antarctica/Casey switched from +08 to +11 on 2016-10-22.
+(Thanks to Steffen Thorsen.)
+
+  Changes to past time stamps
+
+Several corrections were made for pre-1975 time stamps in Italy.
+These affect Europe/Malta, Europe/Rome, Europe/San_Marino, and
+Europe/Vatican.
+
+First, the 1893-11-01 00:00 transition in Italy used the new UT
+offset (+01), not the old (+00:49:56).  (Thanks to Michael
+Deckers.)
+
+Second, rules for daylight saving in Italy were changed to agree
+with Italy's National Institute of Metrological Research (INRiM)
+except for 1944, as follows (thanks to Pierpaolo Bernardi, Brian
+Inglis, and Michael Deckers):
+
+  The 1916-06-03 transition was at 24:00, not 00:00.
+
+  The 1916-10-01, 1919-10-05, and 1920-09-19 transitions were at
+  00:00, not 01:00.
+
+  The 1917-09-30 and 1918-10-06 transitions were at 24:00, not
+  01:00.
+
+  The 1944-09-17 transition was at 03:00, not 01:00.  This
+  particular change is taken from Italian law as INRiM's table,
+  (which says 02:00) appears to have a typo here.  Also, keep the
+  1944-04-03 transition for Europe/Rome, as Rome was controlled by
+  Germany then.
+
+  The 1967-1970 and 1972-1974 fallback transitions were at 01:00,
+  not 00:00.
+
+  Changes to code
+
+The code should now be buildable on AmigaOS merely by setting the
+appropriate Makefile variables.  (From a patch by Carsten 

CVS commit: src/lib/libc/time

2016-10-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 20 17:41:34 UTC 2016

Modified Files:
src/lib/libc/time: Makefile NEWS Theory private.h strftime.c
tz-link.htm zdump.c
Added Files:
src/lib/libc/time: version
Removed Files:
src/lib/libc/time: version.h

Log Message:
welcome to 2016h


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/time/Makefile
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/time/NEWS
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/Theory
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/private.h
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r0 -r1.1 src/lib/libc/time/version
cvs rdiff -u -r1.2 -r0 src/lib/libc/time/version.h
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/zdump.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.34 src/lib/libc/time/Makefile:1.35
--- src/lib/libc/time/Makefile:1.34	Fri Oct  7 11:29:42 2016
+++ src/lib/libc/time/Makefile	Thu Oct 20 13:41:34 2016
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version number for the distribution, overridden in the 'tarballs' rule below.
-VERSION=	2016g
+VERSION=	unknown
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -101,7 +101,6 @@ PACKRATDATA=
 YEARISTYPE=	./yearistype
 
 # Non-default libraries needed to link.
-# Add -lintl if you want to use 'gettext' on Solaris.
 LDLIBS=
 
 # Add the following to the end of the "CFLAGS=" line as needed.
@@ -109,9 +108,10 @@ LDLIBS=
 #  -DHAVE_DECL_ASCTIME_R=0 if  does not declare asctime_r
 #  -DHAVE_DIRECT_H if mkdir needs  (MS-Windows)
 #  -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_GETTEXT=1 if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
 #  -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
-#	ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8).
+#	ctime_r and asctime_r incompatibly with the POSIX standard
+#	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
 #  -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h"
 #  -DHAVE_LINK=0 if your system lacks a link function
 #  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
@@ -357,14 +357,14 @@ HEADERS=	tzfile.h private.h
 NONLIBSRCS=	zic.c zdump.c
 NEWUCBSRCS=	date.c strftime.c
 SOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
-			tzselect.ksh version workman.sh
+			tzselect.ksh workman.sh
 MANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
 			tzfile.5 tzselect.8 zic.8 zdump.8
 MANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
 			time2posix.3.txt \
 			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
 			date.1.txt
-COMMON=		CONTRIBUTING LICENSE Makefile NEWS README Theory
+COMMON=		CONTRIBUTING LICENSE Makefile NEWS README Theory version
 WEB_PAGES=	tz-art.htm tz-how-to.html tz-link.htm
 DOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
 PRIMARY_YDATA=	africa antarctica asia australasia \
@@ -435,16 +435,20 @@ INSTALL:	ALL install date.1
 		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
 
 version:	$(VERSION_DEPS)
-		{ V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
---abbrev=7 --dirty) || \
+		{ (type git) >/dev/null 2>&1 && \
+		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
+--abbrev=7 --dirty` || \
 		  V=$(VERSION); } && \
-		printf '%s\n' "$$V" >$@
+		printf '%s\n' "$$V" >$@.out
+		mv $@.out $@
 
 version.h:	version
-		(echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \
-		 printf 'static char const TZVERSION[]="%s";\n' \
-		   "$$(cat version)" && \
-		 echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@
+		VERSION=`cat version` && printf '%s\n' \
+		  'static char const PKGVERSION[]="($(PACKAGE)) ";' \
+		  "static char const TZVERSION[]=\"$$VERSION\";" \
+		  'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
+		  >$@.out
+		mv $@.out $@
 
 zdump:		$(TZDOBJS)
 		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
@@ -457,7 +461,8 @@ yearistype:	yearistype.sh
 		chmod +x yearistype
 
 leapseconds:	$(LEAP_DEPS)
-		$(AWK) -f leapseconds.awk leap-seconds.list >$@
+		$(AWK) -f leapseconds.awk leap-seconds.list >$@.out
+		mv $@.out $@
 
 # Arguments to pass to submakes of install_data.
 # They can be overridden by later submake arguments.
@@ -515,12 +520,14 @@ $(TZS_NEW):	$(TDATA) zdump zic
 		$(zic) -d tzs.dir $(TDATA)
 		$(AWK) '/^Link/{print $$1 "\t" $$2 "\t" $$3}' \
 		   $(TDATA) | LC_ALL=C sort >$@.out
-		zones=$$($(AWK) -v wd="$$(pwd)" \
+		wd=`pwd` && \
+		zones=`$(AWK) -v wd="$$wd" \
 '/^Zone/{print wd "/tzs.dir/" $$2}' $(TDATA) \
-			 | LC_ALL=C sort) && \
+			 | LC_ALL=C sort` && \
 		./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
-		sed 

CVS commit: src/lib/libc/time

2016-10-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Oct  7 19:47:16 UTC 2016

Modified Files:
src/lib/libc/time: zic.c

Log Message:
Patch 0001 from upstream to tzcode2016g to restore full functionality
of zic -l


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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/zic.c
diff -u src/lib/libc/time/zic.c:1.63 src/lib/libc/time/zic.c:1.64
--- src/lib/libc/time/zic.c:1.63	Fri Oct  7 15:29:42 2016
+++ src/lib/libc/time/zic.c	Fri Oct  7 19:47:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.63 2016/10/07 15:29:42 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.64 2016/10/07 19:47:16 kre Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.63 2016/10/07 15:29:42 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.64 2016/10/07 19:47:16 kre Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -776,6 +776,44 @@ namecheck(const char *name)
 	return componentcheck(name, component, cp);
 }
 
+/* Create symlink contents suitable for symlinking FROM to TO, as a
+   freshly allocated string.  FROM should be a relative file name, and
+   is relative to the global variable DIRECTORY.  TO can be either
+   relative or absolute.  */
+static char *
+relname(char const *from, char const *to)
+{
+  size_t i, taillen, dotdotetcsize;
+  size_t dir_len = 0, dotdots = 0, linksize = SIZE_MAX;
+  char const *f = from;
+  char *result = NULL;
+  if (*to == '/') {
+/* Make F absolute too.  */
+size_t len = strlen(directory);
+bool needslash = len && directory[len - 1] != '/';
+linksize = len + needslash + strlen(from) + 1;
+f = result = emalloc(linksize);
+strcpy(result, directory);
+result[len] = '/';
+strcpy(result + len + needslash, from);
+  }
+  for (i = 0; f[i] && f[i] == to[i]; i++)
+if (f[i] == '/')
+  dir_len = i + 1;
+  for (; f[i]; i++)
+dotdots += f[i] == '/' && f[i - 1] != '/';
+  taillen = i - dir_len;
+  dotdotetcsize = 3 * dotdots + taillen + 1;
+  if (dotdotetcsize <= linksize) {
+if (!result)
+  result = emalloc(dotdotetcsize);
+for (i = 0; i < dotdots; i++)
+  memcpy(result + 3 * i, "../", 3);
+memmove(result + 3 * dotdots, f + dir_len, taillen + 1);
+  }
+  return result;
+}
+
 static void
 dolink(char const *fromfield, char const *tofield, bool staysymlink)
 {
@@ -812,30 +850,15 @@ dolink(char const *fromfield, char const
 	  link_errno = link(fromfield, tofield) == 0 ? 0 : errno;
 	}
 	if (link_errno != 0) {
-	  const char *s = fromfield;
-	  const char *t;
-	  char *p;
-	  size_t dotdots = 0;
-	  char *symlinkcontents;
-	  int symlink_errno;
-
-	  do
-	t = s;
-	  while ((s = strchr(s, '/'))
-		 && strncmp(fromfield, tofield, ++s - fromfield) == 0);
-
-	  for (s = tofield + (t - fromfield); *s; s++)
-	dotdots += *s == '/';
-	  symlinkcontents = emalloc(3 * dotdots + strlen(t) + 1);
-	  for (p = symlinkcontents; dotdots-- != 0; p += 3)
-	memcpy(p, "../", 3);
-	  strcpy(p, t);
-	  symlink_errno = symlink(symlinkcontents, tofield) == 0 ? 0 : errno;
+	  bool absolute = *fromfield == '/';
+	  char *linkalloc = absolute ? NULL : relname(fromfield, tofield);
+	  char const *contents = absolute ? fromfield : linkalloc;
+	  int symlink_errno = symlink(contents, tofield) == 0 ? 0 : errno;
 	  if (symlink_errno == ENOENT && !todirs_made) {
 	mkdirs(tofield, true);
-	symlink_errno = symlink(symlinkcontents, tofield) == 0 ? 0 : errno;
+	symlink_errno = symlink(contents, tofield) == 0 ? 0 : errno;
 	  }
-	  free(symlinkcontents);
+	  free(linkalloc);
 	  if (symlink_errno == 0) {
 	if (link_errno != ENOTSUP)
 	  warning(_("symbolic link used because hard link failed: %s"),



CVS commit: src/lib/libc/time

2016-10-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  7 15:29:42 UTC 2016

Modified Files:
src/lib/libc/time: Makefile NEWS README Theory localtime.c private.h
strftime.c tz-art.htm tz-how-to.html tz-link.htm tzfile.5 tzset.3
zdump.8 zdump.c zic.c

Log Message:
merge tzcode2016g


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/time/Makefile
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/NEWS
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/README
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/Theory
cvs rdiff -u -r1.103 -r1.104 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/time/private.h
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/tz-how-to.html
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.34 -r1.35 src/lib/libc/time/tzset.3
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.62 -r1.63 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.33 src/lib/libc/time/Makefile:1.34
--- src/lib/libc/time/Makefile:1.33	Fri Sep 16 13:12:06 2016
+++ src/lib/libc/time/Makefile	Fri Oct  7 11:29:42 2016
@@ -4,8 +4,8 @@
 # Package name for the code distribution.
 PACKAGE=	tzcode
 
-# Version numbers of the code and data distributions.
-VERSION=	2016f
+# Version number for the distribution, overridden in the 'tarballs' rule below.
+VERSION=	2016g
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -241,7 +241,7 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-co
 CFLAGS=
 
 # Linker flags.  Default to $(LFLAGS) for backwards compatibility
-# to tzcode2012h and earlier.
+# to release 2012h and earlier.
 
 LDFLAGS=	$(LFLAGS)
 
@@ -257,7 +257,7 @@ ZIC=		$(zic) $(ZFLAGS)
 
 ZFLAGS=
 
-# How to use zic to install tzdata binary files.
+# How to use zic to install tz binary files.
 
 ZIC_INSTALL=	$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
 
@@ -273,16 +273,16 @@ AWK=		awk
 KSHELL=		/bin/bash
 
 # The path where SGML DTDs are kept and the catalog file(s) to use when
-# validating.  The default is appropriate for Ubuntu 13.10.
+# validating.  The default should work on both Debian and Red Hat.
 SGML_TOPDIR= /usr
 SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd
 SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224
 SGML_CATALOG_FILES= \
-  $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat
+  $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat:$(SGML_TOPDIR)/share/sgml/html/4.01/HTML4.cat
 
 # The name, arguments and environment of a program to validate your web pages.
-# See  for a validator, and
-#  for a validation library.
+# See  for a validator, and
+#  for a validation library.
 VALIDATE = nsgmls
 VALIDATE_FLAGS = -s -B -wall -wno-unused-param
 VALIDATE_ENV = \
@@ -327,7 +327,7 @@ OK_LINE=	'^'$(OK_CHAR)'*$$'
 
 # Flags to give 'tar' when making a distribution.
 # Try to use flags appropriate for GNU tar.
-GNUTARFLAGS=	--numeric-owner --owner=0 --group=0 --mode=go+u,go-w
+GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name
 TARFLAGS=	`if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
 		 then echo $(GNUTARFLAGS); \
 		 else :; \
@@ -357,7 +357,7 @@ HEADERS=	tzfile.h private.h
 NONLIBSRCS=	zic.c zdump.c
 NEWUCBSRCS=	date.c strftime.c
 SOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
-			tzselect.ksh workman.sh
+			tzselect.ksh version workman.sh
 MANS=		newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
 			tzfile.5 tzselect.8 zic.8 zdump.8
 MANTXTS=	newctime.3.txt newstrftime.3.txt newtzset.3.txt \
@@ -379,7 +379,32 @@ DATA=		$(YDATA) $(NDATA) backzone $(TABD
 			leap-seconds.list yearistype.sh
 AWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk
 MISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
-ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
+TZS_YEAR=	2050
+TZS=		to$(TZS_YEAR).tzs
+TZS_NEW=	to$(TZS_YEAR)new.tzs
+TZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
+			private.h tzfile.h zdump.c zic.c
+ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS)
+
+# Consult these files when deciding whether to rebuild the 'version' file.
+# This list is not the same as the output of 'git ls-files', since
+# .gitignore is not distributed.
+VERSION_DEPS= \
+		CONTRIBUTING LICENSE Makefile NEWS README Theory \
+		africa antarctica asctime.c asia australasia \
+		backward backzone \
+		checklinks.awk checktab.awk \
+		date.1 date.c 

CVS commit: src/lib/libc/time

2016-09-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Sep 22 23:18:11 UTC 2016

Modified Files:
src/lib/libc/time: strftime.3

Log Message:
Since the argument buf is earlier described as a buffer, replace all
references to "the array" with "the buffer" for consistency.

Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/time/strftime.3

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/strftime.3
diff -u src/lib/libc/time/strftime.3:1.30 src/lib/libc/time/strftime.3:1.31
--- src/lib/libc/time/strftime.3:1.30	Fri Sep 20 19:06:54 2013
+++ src/lib/libc/time/strftime.3	Thu Sep 22 23:18:10 2016
@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)strftime.3	5.12 (Berkeley) 6/29/91
-.\"	$NetBSD: strftime.3,v 1.30 2013/09/20 19:06:54 christos Exp $
+.\"	$NetBSD: strftime.3,v 1.31 2016/09/22 23:18:10 pgoyette Exp $
 .\"
-.Dd April 14, 2011
+.Dd September 22, 2016
 .Dt STRFTIME 3
 .Os
 .Sh NAME
@@ -68,14 +68,14 @@ and one other character.
 .Pp
 No more than
 .Fa maxsize
-characters will be placed into the array.
+characters will be placed into the buffer.
 If the total number of resulting characters, including the terminating
 null character, is not more than
 .Fa maxsize ,
 .Fn strftime
-returns the number of characters in the array, not counting the
+returns the number of characters in the buffer, not counting the
 terminating null.
-Otherwise, zero is returned and the contents of the array are undefined.
+Otherwise, zero is returned and the contents of the buffer are undefined.
 .Pp
 Each conversion specification is replaced by the characters as
 follows which are then copied into the buffer.



CVS commit: src/lib/libc/time

2016-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 20 15:03:07 UTC 2016

Modified Files:
src/lib/libc/time: zic.c

Log Message:
use a define, and cast.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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/zic.c
diff -u src/lib/libc/time/zic.c:1.61 src/lib/libc/time/zic.c:1.62
--- src/lib/libc/time/zic.c:1.61	Tue Sep 20 09:09:08 2016
+++ src/lib/libc/time/zic.c	Tue Sep 20 11:03:07 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.62 2016/09/20 15:03:07 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 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.62 2016/09/20 15:03:07 christos Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -437,9 +437,9 @@ growalloc(void *ptr, size_t itemsize, in
 	if (nitems < *nitems_alloc)
 		return ptr;
 	else {
-		static const int imax = INT_MAX < SIZE_MAX ? INT_MAX : SIZE_MAX;
-		int nitems_max = imax - WORK_AROUND_QTBUG_53071;
-		int amax = nitems_max < imax ? nitems_max : imax;
+#define IMAX (INT_MAX < SIZE_MAX ? INT_MAX : (int)SIZE_MAX)
+		int nitems_max = IMAX - WORK_AROUND_QTBUG_53071;
+		int amax = nitems_max < IMAX ? nitems_max : IMAX;
 		if ((amax - 1) / 3 * 2 < *nitems_alloc)
 			memory_exhausted(_("int overflow"));
 		*nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;



CVS commit: src/lib/libc/time

2016-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 20 13:09:08 UTC 2016

Modified Files:
src/lib/libc/time: zic.c

Log Message:
put back part of the code that determines the smallest of INT_MAX and
SIZE_MAX to avoid llvm truncation warning.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 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/zic.c
diff -u src/lib/libc/time/zic.c:1.60 src/lib/libc/time/zic.c:1.61
--- src/lib/libc/time/zic.c:1.60	Mon Sep 19 14:43:23 2016
+++ src/lib/libc/time/zic.c	Tue Sep 20 09:09:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.60 2016/09/19 18:43:23 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 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 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.60 2016/09/19 18:43:23 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 christos Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -437,8 +437,9 @@ growalloc(void *ptr, size_t itemsize, in
 	if (nitems < *nitems_alloc)
 		return ptr;
 	else {
-		size_t nitems_max = INT_MAX - WORK_AROUND_QTBUG_53071;
-		int amax = nitems_max < SIZE_MAX ? nitems_max : SIZE_MAX;
+		static const int imax = INT_MAX < SIZE_MAX ? INT_MAX : SIZE_MAX;
+		int nitems_max = imax - WORK_AROUND_QTBUG_53071;
+		int amax = nitems_max < imax ? nitems_max : imax;
 		if ((amax - 1) / 3 * 2 < *nitems_alloc)
 			memory_exhausted(_("int overflow"));
 		*nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;



CVS commit: src/lib/libc/time

2016-09-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep 19 18:43:23 UTC 2016

Modified Files:
src/lib/libc/time: zic.c

Log Message:
PR/51484: gson@: Fix off by one (wrong merge)


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 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/zic.c
diff -u src/lib/libc/time/zic.c:1.59 src/lib/libc/time/zic.c:1.60
--- src/lib/libc/time/zic.c:1.59	Fri Sep 16 13:12:06 2016
+++ src/lib/libc/time/zic.c	Mon Sep 19 14:43:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.59 2016/09/16 17:12:06 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.60 2016/09/19 18:43:23 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 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.59 2016/09/16 17:12:06 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.60 2016/09/19 18:43:23 christos Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -158,7 +158,7 @@ enum { PERCENT_Z_LEN_BOUND = sizeof "+99
QTBUG-53071 .  This
workaround will no longer be needed when Qt 5.6.1 and earlier are
obsolete, say in the year 2021.  */
-enum { WORK_AROUND_QTBUG_53071 = true };
+enum { WORK_AROUND_QTBUG_53071 = 1 };
 
 static int		charcnt;
 static bool		errors;
@@ -1645,7 +1645,7 @@ writezone(const char *const name, const 
 	zic_t one = 1;
 	zic_t y2038_boundary = one << 31;
 	int nats = timecnt + WORK_AROUND_QTBUG_53071;
-	zic_t *ats = zic_malloc(size_product(timecnt, sizeof *ats + 1));
+	zic_t *ats = zic_malloc(size_product(nats, sizeof *ats + 1));
 	void *typesptr = ats + nats;
 	unsigned char *types = typesptr;
 



CVS commit: src/lib/libc/time

2016-09-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 16 17:12:06 UTC 2016

Modified Files:
src/lib/libc/time: Makefile NEWS Theory tz-art.htm tz-link.htm zic.c
Added Files:
src/lib/libc/time: tz-how-to.html

Log Message:
welcome to tzcond-2016f


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/Makefile
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/NEWS
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/Theory
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/tz-art.htm
cvs rdiff -u -r0 -r1.1 src/lib/libc/time/tz-how-to.html
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.58 -r1.59 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.32 src/lib/libc/time/Makefile:1.33
--- src/lib/libc/time/Makefile:1.32	Tue Mar 15 11:16:01 2016
+++ src/lib/libc/time/Makefile	Fri Sep 16 13:12:06 2016
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2016b
+VERSION=	2016f
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.15 src/lib/libc/time/NEWS:1.16
--- src/lib/libc/time/NEWS:1.15	Tue Mar 15 11:16:01 2016
+++ src/lib/libc/time/NEWS	Fri Sep 16 13:12:06 2016
@@ -1,7 +1,136 @@
 News for the tz database
 
+Release 2016f - 2016-07-05 16:26:51 +0200
+
+  Changes affecting future time stamps
+
+The Egyptian government changed its mind on short notice, and
+Africa/Cairo will not introduce DST starting 2016-07-07 after all.
+(Thanks to Mina Samuel.)
+
+Asia/Novosibirsk switches from +06 to +07 on 2016-07-24 at 02:00.
+(Thanks to Stepan Golosunov.)
+
+  Changes to past and future time stamps
+
+Asia/Novokuznetsk and Asia/Novosibirsk now use numeric time zone
+abbreviations instead of invented ones.
+
+  Changes affecting past time stamps
+
+Europe/Minsk's 1992-03-29 spring-forward transition was at 02:00 not 00:00.
+(Thanks to Stepan Golosunov.)
+
+
+Release 2016e - 2016-06-14 08:46:16 -0700
+
+  Changes affecting future time stamps
+
+Africa/Cairo observes DST in 2016 from July 7 to the end of October.
+Guess October 27 and 24:00 transitions.  (Thanks to Steffen Thorsen.)
+For future years, guess April's last Thursday to October's last
+Thursday except for Ramadan.
+
+  Changes affecting past time stamps
+
+Locations while uninhabited now use '-00', not 'zzz', as a
+placeholder time zone abbreviation.  This is inspired by Internet
+RFC 3339 and is more consistent with numeric time zone
+abbreviations already used elsewhere.  The change affects several
+arctic and antarctic locations, e.g., America/Cambridge_Bay before
+1920 and Antarctica/Troll before 2005.
+
+Asia/Baku's 1992-09-27 transition from +04 (DST) to +04 (non-DST) was
+at 03:00, not 23:00 the previous day.  (Thanks to Michael Deckers.)
+
+  Changes to code
+
+zic now outputs a dummy transition at time 2**31 - 1 in zones
+whose POSIX-style TZ strings contain a '<'.  This mostly works
+around Qt bug 53071 .
+(Thanks to Zhanibek Adilbekov for reporting the Qt bug.)
+
+  Changes affecting documentation and commentary
+
+tz-link.htm says why governments should give plenty of notice for
+time zone or DST changes, and refers to Matt Johnson's blog post.
+
+tz-link.htm mentions Tzdata for Elixir.  (Thanks to Matt Johnson.)
+
+
+Release 2016d - 2016-04-17 22:50:29 -0700
+
+  Changes affecting future time stamps
+
+America/Caracas switches from -0430 to -04 on 2016-05-01 at 02:30.
+(Thanks to Alexander Krivenyshev for the heads-up.)
+
+Asia/Magadan switches from +10 to +11 on 2016-04-24 at 02:00.
+(Thanks to Alexander Krivenyshev and Matt Johnson.)
+
+New zone Asia/Tomsk, split off from Asia/Novosibirsk.  It covers
+Tomsk Oblast, Russia, which switches from +06 to +07 on 2016-05-29
+at 02:00.  (Thanks to Stepan Golosunov.)
+
+  Changes affecting past time stamps
+
+New zone Europe/Kirov, split off from Europe/Volgograd.  It covers
+Kirov Oblast, Russia, which switched from +04/+05 to +03/+04 on
+1989-03-26 at 02:00, roughly a year after Europe/Volgograd made
+the same change.  (Thanks to Stepan Golosunov.)
+
+Russia and nearby locations had daylight-saving transitions on
+1992-03-29 at 02:00 and 1992-09-27 at 03:00, instead of on
+1992-03-28 at 23:00 and 1992-09-26 at 23:00.  (Thanks to Stepan
+Golosunov.)
+
+Many corrections to historical time in Kazakhstan from 1991
+through 2005.  (Thanks to Stepan Golosunov.)  Replace Kazakhstan's
+invented time zone abbreviations with numeric abbreviations.
+
+  Changes to commentary
+
+Mention Internet RFCs 7808 (TZDIST) and 7809 (CalDAV time 

CVS commit: src/lib/libc/time

2016-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue May 31 03:47:49 UTC 2016

Modified Files:
src/lib/libc/time: zic.c

Log Message:
PR 51003 David Binderman: bzero struct before passing it around.

This is actually unnecessary as the call in question uses only fields
that have been set explicitly, but good practice regardless and it's
not like it's on a performance-critical path.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 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/zic.c
diff -u src/lib/libc/time/zic.c:1.57 src/lib/libc/time/zic.c:1.58
--- src/lib/libc/time/zic.c:1.57	Tue Mar 15 15:16:01 2016
+++ src/lib/libc/time/zic.c	Tue May 31 03:47:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.57 2016/03/15 15:16:01 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.58 2016/05/31 03:47:49 dholland Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.57 2016/03/15 15:16:01 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.58 2016/05/31 03:47:49 dholland Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -2551,6 +2551,7 @@ error(_("can't determine time zone abbre
 		*/
 		struct rule xr;
 		struct attype *lastat;
+		memset(, 0, sizeof(xr));
 		xr.r_month = TM_JANUARY;
 		xr.r_dycode = DC_DOM;
 		xr.r_dayofmonth = 1;



CVS commit: src/lib/libc/time

2016-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 15 20:37:48 UTC 2016

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
remove stray debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.59 src/lib/libc/time/strptime.c:1.60
--- src/lib/libc/time/strptime.c:1.59	Sun May 15 16:36:42 2016
+++ src/lib/libc/time/strptime.c	Sun May 15 16:37:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.59 2016/05/15 20:36:42 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.60 2016/05/15 20:37:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.59 2016/05/15 20:36:42 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.60 2016/05/15 20:37:48 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -476,7 +476,6 @@ literal:
 			 * Note: J maybe used to denote non-nautical
 			 *   local time
 			 */
-printf("start parsing %s\n", bp);
 			if (mandatory)
 while (isspace(*bp))
 	bp++;
@@ -518,7 +517,6 @@ namedzone:
 if (delim(bp[1]) &&
 ((*bp >= 'A' && *bp <= 'I') ||
 (*bp >= 'L' && *bp <= 'Y'))) {
-printf("military\n");
 #ifdef TM_GMTOFF
 	/* Argh! No 'J'! */
 	if (*bp >= 'A' && *bp <= 'I')
@@ -538,7 +536,6 @@ printf("military\n");
 }
 /* 'J' is local time */
 if (delim(bp[1]) && *bp == 'J') {
-printf("localtime\n");
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = -timezone;
 #endif
@@ -556,10 +553,8 @@ printf("localtime\n");
 if (delim(bp[0]) || delim(bp[1]) ||
 delim(bp[2]) || !delim(bp[3]))
 	goto loadzone;
-printf("findstring\n");
 ep = find_string(bp, , nast, NULL, 4);
 if (ep != NULL) {
-printf("foundstring\n");
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = (-5 - i) * SECSPERHOUR;
 #endif
@@ -569,10 +564,8 @@ printf("foundstring\n");
 	bp = ep;
 	continue;
 }
-printf("findstring2\n");
 ep = find_string(bp, , nadt, NULL, 4);
 if (ep != NULL) {
-printf("foundstring2\n");
 	tm->tm_isdst = 1;
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = (-4 - i) * SECSPERHOUR;
@@ -586,12 +579,10 @@ printf("foundstring2\n");
 /*
  * Our current timezone
  */
-printf("findstring3\n");
 ep = find_string(bp, ,
 	   	 (const char * const *)tzname,
 	   	  NULL, 2);
 if (ep != NULL) {
-printf("foundstring3\n");
 	tm->tm_isdst = i;
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = -timezone;
@@ -603,7 +594,6 @@ printf("foundstring3\n");
 	continue;
 }
 loadzone:
-printf("loadzone\n");
 /*
  * The hard way, load the zone!
  */
@@ -624,7 +614,6 @@ printf("loadzone\n");
 }
 break;
 			}
-printf("offs=%ld i=%d\n", (long)offs, i);
 			if (isdigit(*bp))
 goto out;
 			switch (i) {
@@ -648,7 +637,6 @@ printf("offs=%ld i=%d\n", (long)offs, i)
 			}
 			if (offs >= (HOURSPERDAY * SECSPERHOUR))
 goto out;
-printf("done neg=%d offs=%ld\n", neg, (long)offs);
 			if (neg)
 offs = -offs;
 			tm->tm_isdst = 0;	/* XXX */



CVS commit: src/lib/libc/time

2016-05-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 15 20:36:42 UTC 2016

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Bail out if the string does not look like a timezone (is empty or does not
start with a letter or a number). tzparse("") or tzparse(".45") don't fail.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.58 src/lib/libc/time/strptime.c:1.59
--- src/lib/libc/time/strptime.c:1.58	Fri Oct 30 23:42:00 2015
+++ src/lib/libc/time/strptime.c	Sun May 15 16:36:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.58 2015/10/31 03:42:00 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.59 2016/05/15 20:36:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.58 2015/10/31 03:42:00 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.59 2016/05/15 20:36:42 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -128,6 +128,8 @@ fromzone(const unsigned char **bp, struc
 
 	if (mandatory)
 		*bp = rp;
+	if (!isalnum((unsigned char)*buf))
+		return 0;
 	tz = tzalloc(buf);
 	if (tz == NULL)
 		return 0;
@@ -474,6 +476,7 @@ literal:
 			 * Note: J maybe used to denote non-nautical
 			 *   local time
 			 */
+printf("start parsing %s\n", bp);
 			if (mandatory)
 while (isspace(*bp))
 	bp++;
@@ -515,6 +518,7 @@ namedzone:
 if (delim(bp[1]) &&
 ((*bp >= 'A' && *bp <= 'I') ||
 (*bp >= 'L' && *bp <= 'Y'))) {
+printf("military\n");
 #ifdef TM_GMTOFF
 	/* Argh! No 'J'! */
 	if (*bp >= 'A' && *bp <= 'I')
@@ -534,6 +538,7 @@ namedzone:
 }
 /* 'J' is local time */
 if (delim(bp[1]) && *bp == 'J') {
+printf("localtime\n");
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = -timezone;
 #endif
@@ -551,8 +556,10 @@ namedzone:
 if (delim(bp[0]) || delim(bp[1]) ||
 delim(bp[2]) || !delim(bp[3]))
 	goto loadzone;
+printf("findstring\n");
 ep = find_string(bp, , nast, NULL, 4);
 if (ep != NULL) {
+printf("foundstring\n");
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = (-5 - i) * SECSPERHOUR;
 #endif
@@ -562,8 +569,10 @@ namedzone:
 	bp = ep;
 	continue;
 }
+printf("findstring2\n");
 ep = find_string(bp, , nadt, NULL, 4);
 if (ep != NULL) {
+printf("foundstring2\n");
 	tm->tm_isdst = 1;
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = (-4 - i) * SECSPERHOUR;
@@ -577,10 +586,12 @@ namedzone:
 /*
  * Our current timezone
  */
+printf("findstring3\n");
 ep = find_string(bp, ,
 	   	 (const char * const *)tzname,
 	   	  NULL, 2);
 if (ep != NULL) {
+printf("foundstring3\n");
 	tm->tm_isdst = i;
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = -timezone;
@@ -592,6 +603,7 @@ namedzone:
 	continue;
 }
 loadzone:
+printf("loadzone\n");
 /*
  * The hard way, load the zone!
  */
@@ -612,6 +624,7 @@ loadzone:
 }
 break;
 			}
+printf("offs=%ld i=%d\n", (long)offs, i);
 			if (isdigit(*bp))
 goto out;
 			switch (i) {
@@ -635,6 +648,7 @@ loadzone:
 			}
 			if (offs >= (HOURSPERDAY * SECSPERHOUR))
 goto out;
+printf("done neg=%d offs=%ld\n", neg, (long)offs);
 			if (neg)
 offs = -offs;
 			tm->tm_isdst = 0;	/* XXX */



CVS commit: src/lib/libc/time

2016-03-19 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Fri Mar 18 12:41:25 UTC 2016

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Use the correct upper bounds for the types array.  The correct upper
bound is typecnt not timecnt.  Now perpetual 'standard' time zones
will work correctly as they have a typecnt of 1 but a timecnt of 0.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.102 src/lib/libc/time/localtime.c:1.103
--- src/lib/libc/time/localtime.c:1.102	Tue Mar 15 15:16:01 2016
+++ src/lib/libc/time/localtime.c	Fri Mar 18 12:41:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.102 2016/03/15 15:16:01 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach 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.102 2016/03/15 15:16:01 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -282,7 +282,7 @@ const char *
 tzgetname(const timezone_t sp, int isdst)
 {
 	int i;
-	for (i = 0; i < sp->timecnt; ++i) {
+	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
 
 		if (ttisp->tt_isdst == isdst)
@@ -297,7 +297,7 @@ tzgetgmtoff(const timezone_t sp, int isd
 {
 	int i;
 	long l = -1;
-	for (i = 0; i < sp->timecnt; ++i) {
+	for (i = 0; i < sp->typecnt; ++i) {
 		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
 
 		if (ttisp->tt_isdst == isdst) {



CVS commit: src/lib/libc/time

2016-03-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 15 15:16:01 UTC 2016

Modified Files:
src/lib/libc/time: Makefile NEWS README Theory localtime.c private.h
strftime.c tz-art.htm tz-link.htm tzselect.ksh zdump.c zic.c
Added Files:
src/lib/libc/time: CONTRIBUTING

Log Message:
Sync with 2016b


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc/time/CONTRIBUTING
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/Makefile
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/NEWS \
src/lib/libc/time/tzselect.ksh
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/README
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/Theory
cvs rdiff -u -r1.101 -r1.102 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/private.h
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.56 -r1.57 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.31 src/lib/libc/time/Makefile:1.32
--- src/lib/libc/time/Makefile:1.31	Fri Oct  9 13:21:45 2015
+++ src/lib/libc/time/Makefile	Tue Mar 15 11:16:01 2016
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2015g
+VERSION=	2016b
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -84,14 +84,18 @@ LIBDIR=		$(TOPDIR)/lib
 # below.  If you want both sets of data available, with leap seconds counted
 # normally, use
 #	REDO=		right_posix
-# below.  If you want just POSIX-compatible time values, but with
-# out-of-scope and often-wrong data from the file 'backzone', use
-#	REDO=		posix_packrat
-# POSIX mandates that leap seconds not be counted; for compatibility with it,
-# use "posix_only", "posix_right", or "posix_packrat".
+# below.  POSIX mandates that leap seconds not be counted; for compatibility
+# with it, use "posix_only" or "posix_right".
 
 REDO=		posix_right
 
+# If you want out-of-scope and often-wrong data from the file 'backzone', use
+#	PACKRATDATA=	backzone
+# To omit this data, use
+#	PACKRATDATA=
+
+PACKRATDATA=
+
 # Since "." may not be in PATH...
 
 YEARISTYPE=	./yearistype
@@ -102,6 +106,8 @@ LDLIBS=
 
 # Add the following to the end of the "CFLAGS=" line as needed.
 #  -DBIG_BANG=-999LL if the Big Bang occurred at time -999 (see zic.c)
+#  -DHAVE_DECL_ASCTIME_R=0 if  does not declare asctime_r
+#  -DHAVE_DIRECT_H if mkdir needs  (MS-Windows)
 #  -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
@@ -112,6 +118,8 @@ LDLIBS=
 #  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
 #	This defaults to 1 if a working localtime_rz seems to be available.
 #	localtime_rz can make zdump significantly faster, but is nonstandard.
+#  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
+#	functions like 'link' or variables like 'tzname' required by POSIX
 #  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h"
 #  -DHAVE_STRFTIME_L=1 if  declares locale_t and strftime_l
 #	This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise.
@@ -237,11 +245,22 @@ CFLAGS=
 
 LDFLAGS=	$(LFLAGS)
 
+# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
+# submake command lines.  The default is no leap seconds.
+
+LEAPSECONDS=
+
+# The zic command and its arguments.
+
 zic=		./zic
 ZIC=		$(zic) $(ZFLAGS)
 
 ZFLAGS=
 
+# How to use zic to install tzdata binary files.
+
+ZIC_INSTALL=	$(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
+
 # The name of a Posix-compliant 'awk' on your system.
 AWK=		awk
 
@@ -345,8 +364,8 @@ MANTXTS=	newctime.3.txt newstrftime.3.tx
 			time2posix.3.txt \
 			tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \
 			date.1.txt
-COMMON=		CONTRIBUTING Makefile NEWS README Theory
-WEB_PAGES=	tz-art.htm tz-link.htm
+COMMON=		CONTRIBUTING LICENSE Makefile NEWS README Theory
+WEB_PAGES=	tz-art.htm tz-how-to.html tz-link.htm
 DOCS=		$(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
 PRIMARY_YDATA=	africa antarctica asia australasia \
 		europe northamerica southamerica
@@ -367,7 +386,7 @@ ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) 
 
 SHELL=		/bin/sh
 
-all:		tzselect zic zdump libtz.a $(TABDATA)
+all:		tzselect yearistype zic zdump libtz.a $(TABDATA)
 
 ALL:		all date $(ENCHILADA)
 
@@ -376,8 +395,7 @@ install:	all $(DATA) $(REDO) $(MANS)
 			$(DESTDIR)$(LIBDIR) \
 			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
 			$(DESTDIR)$(MANDIR)/man8
-		$(ZIC) -y $(YEARISTYPE) \
-			-d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
+		$(ZIC_INSTALL) -l $(LOCALTIME) -p 

CVS commit: src/lib/libc/time

2016-02-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 20 20:11:37 UTC 2016

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
PR/50133: Martin Husemann: Can't cache $TZ.
XXX: Pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.100 src/lib/libc/time/localtime.c:1.101
--- src/lib/libc/time/localtime.c:1.100	Thu Oct 29 15:18:32 2015
+++ src/lib/libc/time/localtime.c	Sat Feb 20 15:11:37 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.100 2015/10/29 19:18:32 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.101 2016/02/20 20:11:37 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.100 2015/10/29 19:18:32 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.101 2016/02/20 20:11:37 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1540,7 +1540,7 @@ localtime(const time_t *timep)
 struct tm *
 localtime_r(const time_t * __restrict timep, struct tm *tmp)
 {
-	return localtime_tzset(timep, tmp, false);
+	return localtime_tzset(timep, tmp, true);
 }
 
 /*



CVS commit: src/lib/libc/time

2015-10-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Oct 31 02:09:06 UTC 2015

Modified Files:
src/lib/libc/time: strptime.3

Log Message:
- Add reference to RFC-3339
- Add J to military / nautical time zone description


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/time/strptime.3

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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.33 src/lib/libc/time/strptime.3:1.34
--- src/lib/libc/time/strptime.3:1.33	Thu Oct 29 22:42:55 2015
+++ src/lib/libc/time/strptime.3	Sat Oct 31 02:09:06 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.33 2015/10/29 22:42:55 wiz Exp $
+.\"	$NetBSD: strptime.3,v 1.34 2015/10/31 02:09:06 ginsbach Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -221,7 +221,7 @@ with \&%C, specifies the year [0,99] wit
 .It Cm \&%Y
 the year, including the century (i.e., 1996).
 .It Cm \&%z
-an ISO 8601 or RFC-2822 time zone specification.
+an ISO 8601, RFC-2822, or RFC-3339 time zone specification.
 This is one of the following:
 .Bl -dash -offset indent -compact
 .It
@@ -295,7 +295,7 @@ or
 .Pq Dq S
 time
 .It
-a single letter military time zone specified as:
+a single letter military or nautical time zone specified as:
 .Bl -bullet -offset indent -compact
 .It
 .Dq A
@@ -304,7 +304,10 @@ through
 .It
 .Dq K
 through
-.Dq Y .
+.Dq Y
+.It
+.Dq J
+.Pq non-nautical local time zone
 .El
 .It
 An arbirtrary timezone name that can be loaded from the database.



CVS commit: src/lib/libc/time

2015-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 31 02:14:08 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
make %Z and %z understand the same strings.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.56 src/lib/libc/time/strptime.c:1.57
--- src/lib/libc/time/strptime.c:1.56	Fri Oct 30 17:36:25 2015
+++ src/lib/libc/time/strptime.c	Fri Oct 30 22:14:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.56 2015/10/30 21:36:25 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.57 2015/10/31 02:14:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.56 2015/10/30 21:36:25 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.57 2015/10/31 02:14:08 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -79,7 +79,6 @@ static const u_char *find_string(const u
 #define HAVE_YEAR(s)		(s & S_YEAR)
 #define HAVE_HOUR(s)		(s & S_HOUR)
 
-static char gmt[] = { "GMT" };
 static char utc[] = { "UTC" };
 /* RFC-822/RFC-2822 */
 static const char * const nast[5] = {
@@ -117,19 +116,23 @@ first_wday_of(int yr)
 #define delim(p)	((p) == '\0' || isspace((unsigned char)(p)))
 
 static int
-fromzone(const unsigned char **bp, struct tm *tm)
+fromzone(const unsigned char **bp, struct tm *tm, int mandatory)
 {
 	timezone_t tz;
 	char buf[512], *p;
+	const unsigned char *rp;
 
-	for (p = buf; !delim(**bp) && p < [sizeof(buf) - 1]; (*bp)++)
-		*p++ = **bp;
+	for (p = buf, rp = *bp; !delim(*rp) && p < [sizeof(buf) - 1]; rp++)
+		*p++ = *rp;
 	*p = '\0';
 
+	if (mandatory)
+		*bp = rp;
 	tz = tzalloc(buf);
 	if (tz == NULL)
 		return 0;
 
+	*bp = rp;
 	tm->tm_isdst = 0;	/* XXX */
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = tzgetgmtoff(tz, tm->tm_isdst);
@@ -154,7 +157,7 @@ strptime_l(const char *buf, const char *
 	unsigned char c;
 	const unsigned char *bp, *ep, *zname;
 	int alt_format, i, split_year = 0, neg = 0, state = 0,
-	day_offset = -1, week_offset = 0, offs;
+	day_offset = -1, week_offset = 0, offs, mandatory;
 	const char *new_fmt;
 
 	bp = (const u_char *)buf;
@@ -449,36 +452,9 @@ literal:
 			continue;
 
 		case 'Z':
-			tzset();
-			if (strncmp((const char *)bp, gmt, 3) == 0 ||
-			strncmp((const char *)bp, utc, 3) == 0) {
-tm->tm_isdst = 0;
-#ifdef TM_GMTOFF
-tm->TM_GMTOFF = 0;
-#endif
-#ifdef TM_ZONE
-tm->TM_ZONE = gmt;
-#endif
-bp += 3;
-			} else {
-ep = find_string(bp, ,
-	   	 (const char * const *)tzname,
-	   	  NULL, 2);
-if (ep != NULL) {
-	tm->tm_isdst = i;
-#ifdef TM_GMTOFF
-	tm->TM_GMTOFF = -timezone;
-#endif
-#ifdef TM_ZONE
-	tm->TM_ZONE = tzname[i];
-	bp = ep;
-#endif
-} else
-	(void)fromzone(, tm);
-			}
-			continue;
-
 		case 'z':
+			tzset();
+			mandatory = c == 'z';
 			/*
 			 * We recognize all ISO 8601 formats:
 			 * Z	= Zulu time/UTC
@@ -498,8 +474,9 @@ literal:
 			 * Note: J maybe used to denote non-nautical
 			 *   local time
 			 */
-			while (isspace(*bp))
-bp++;
+			if (mandatory)
+while (isspace(*bp))
+	bp++;
 
 			zname = bp;
 			switch (*bp++) {
@@ -597,14 +574,30 @@ namedzone:
 	bp = ep;
 	continue;
 }
-
+/*
+ * Our current timezone
+ */
+ep = find_string(bp, ,
+	   	 (const char * const *)tzname,
+	   	  NULL, 2);
+if (ep != NULL) {
+	tm->tm_isdst = i;
+#ifdef TM_GMTOFF
+	tm->TM_GMTOFF = -timezone;
+#endif
+#ifdef TM_ZONE
+	tm->TM_ZONE = tzname[i];
+#endif
+	bp = ep;
+	continue;
+}
 loadzone:
 /*
  * The hard way, load the zone!
  */
-if (fromzone(, tm))
+if (fromzone(, tm, mandatory))
 	continue;
-return NULL;
+goto out;
 			}
 			offs = 0;
 			for (i = 0; i < 4; ) {
@@ -620,23 +613,28 @@ loadzone:
 break;
 			}
 			if (isdigit(*bp))
-return NULL;
+goto out;
 			switch (i) {
 			case 2:
 offs *= SECSPERHOUR;
 break;
 			case 4:
 i = offs % 100;
+offs /= 100;
 if (i >= SECSPERMIN)
-	return NULL;
+	goto out;
 /* Convert minutes into decimal */
-offs = (offs / 100) * SECSPERHOUR + i * SECSPERMIN;
+offs = offs * SECSPERHOUR + i * SECSPERMIN;
 break;
 			default:
-return NULL;
+			out:
+if (mandatory)
+	return NULL;
+bp = zname;
+continue;
 			}
 			if (offs >= (HOURSPERDAY * SECSPERHOUR))
-return NULL;
+goto out;
 			if (neg)
 offs = -offs;
 			tm->tm_isdst = 0;	/* XXX */



CVS commit: src/lib/libc/time

2015-10-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sat Oct 31 03:42:00 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Don't attempt to set TM_ZONE (name) for 'J' as isdst isn't known.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.57 src/lib/libc/time/strptime.c:1.58
--- src/lib/libc/time/strptime.c:1.57	Sat Oct 31 02:14:08 2015
+++ src/lib/libc/time/strptime.c	Sat Oct 31 03:42:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.57 2015/10/31 02:14:08 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.58 2015/10/31 03:42:00 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.57 2015/10/31 02:14:08 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.58 2015/10/31 03:42:00 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
@@ -538,7 +538,7 @@ namedzone:
 	tm->TM_GMTOFF = -timezone;
 #endif
 #ifdef TM_ZONE
-	tm->TM_ZONE = tzname[i];
+	tm->TM_ZONE = NULL; /* XXX */
 #endif
 	bp++;
 	continue;



CVS commit: src/lib/libc/time

2015-10-30 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Fri Oct 30 21:36:25 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Add 'J' (Juliett) as military time zone name meaning the local time zone.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.55 src/lib/libc/time/strptime.c:1.56
--- src/lib/libc/time/strptime.c:1.55	Fri Oct 30 18:20:16 2015
+++ src/lib/libc/time/strptime.c	Fri Oct 30 21:36:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.55 2015/10/30 18:20:16 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.56 2015/10/30 21:36:25 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.55 2015/10/30 18:20:16 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.56 2015/10/30 21:36:25 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
@@ -492,9 +492,11 @@ literal:
 			 * C[DS]T = Central : -5 | -6
 			 * M[DS]T = Mountain: -6 | -7
 			 * P[DS]T = Pacific : -7 | -8
-			 *  Military
+			 *  Nautical/Military
 			 * [A-IL-M] = -1 ... -9 (J not used)
 			 * [N-Y]  = +1 ... +12
+			 * Note: J maybe used to denote non-nautical
+			 *   local time
 			 */
 			while (isspace(*bp))
 bp++;
@@ -532,7 +534,7 @@ literal:
 namedzone:
 bp = zname;
 
-/* Military style */
+/* Nautical / Military style */
 if (delim(bp[1]) &&
 ((*bp >= 'A' && *bp <= 'I') ||
 (*bp >= 'L' && *bp <= 'Y'))) {
@@ -553,6 +555,17 @@ namedzone:
 	bp++;
 	continue;
 }
+/* 'J' is local time */
+if (delim(bp[1]) && *bp == 'J') {
+#ifdef TM_GMTOFF
+	tm->TM_GMTOFF = -timezone;
+#endif
+#ifdef TM_ZONE
+	tm->TM_ZONE = tzname[i];
+#endif
+	bp++;
+	continue;
+}
 
 /*
  * From our 3 letter hard-coded table



CVS commit: src/lib/libc/time

2015-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 30 18:04:42 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
revert timezone() ifdef; it is wrong (pointed out by ginsbach)


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.53 src/lib/libc/time/strptime.c:1.54
--- src/lib/libc/time/strptime.c:1.53	Thu Oct 29 23:18:10 2015
+++ src/lib/libc/time/strptime.c	Fri Oct 30 14:04:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.53 2015/10/30 03:18:10 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.54 2015/10/30 18:04:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.53 2015/10/30 03:18:10 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.54 2015/10/30 18:04:42 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -467,10 +467,7 @@ literal:
 if (ep != NULL) {
 	tm->tm_isdst = i;
 #ifdef TM_GMTOFF
-#ifdef USG_COMPAT
 	tm->TM_GMTOFF = -timezone;
-#else
-	tm->TM_GMTOFF = -timezone();
 #endif
 #endif
 #ifdef TM_ZONE



CVS commit: src/lib/libc/time

2015-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 30 18:20:16 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
drop stray #endif


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.54 src/lib/libc/time/strptime.c:1.55
--- src/lib/libc/time/strptime.c:1.54	Fri Oct 30 14:04:42 2015
+++ src/lib/libc/time/strptime.c	Fri Oct 30 14:20:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.54 2015/10/30 18:04:42 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.55 2015/10/30 18:20:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.54 2015/10/30 18:04:42 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.55 2015/10/30 18:20:16 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -469,7 +469,6 @@ literal:
 #ifdef TM_GMTOFF
 	tm->TM_GMTOFF = -timezone;
 #endif
-#endif
 #ifdef TM_ZONE
 	tm->TM_ZONE = tzname[i];
 	bp = ep;



CVS commit: src/lib/libc/time

2015-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 29 17:53:05 UTC 2015

Modified Files:
src/lib/libc/time: Makefile.inc

Log Message:
Add tzgetgmtoff(3)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/Makefile.inc

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.inc
diff -u src/lib/libc/time/Makefile.inc:1.21 src/lib/libc/time/Makefile.inc:1.22
--- src/lib/libc/time/Makefile.inc:1.21	Wed Oct  8 01:44:03 2014
+++ src/lib/libc/time/Makefile.inc	Thu Oct 29 13:53:04 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.21 2014/10/08 05:44:03 msaitoh Exp $
+#	$NetBSD: Makefile.inc,v 1.22 2015/10/29 17:53:04 christos Exp $
 
 .PATH: ${.CURDIR}/time
 
@@ -29,6 +29,7 @@ MLINKS+=ctime.3 ctime_r.3	\
 	time2posix.3 posix2time_z.3 \
 	time2posix.3 time2posix_z.3 \
 	tzset.3 tzgetname.3	\
+	tzset.3 tzgetgmtoff.3	\
 	tzset.3 daylight.3	\
 	tzset.3 tzalloc.3	\
 	tzset.3 tzfree.3	\



CVS commit: src/lib/libc/time

2015-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 29 17:54:49 UTC 2015

Modified Files:
src/lib/libc/time: strptime.3 strptime.c

Log Message:
PR/50380: Balazs Scheidler: strptime() returns incorrect values in tm_gmtoff
- Always offset in seconds.
- Handle arbitrary timezones.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/strptime.3
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/time/strptime.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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.31 src/lib/libc/time/strptime.3:1.32
--- src/lib/libc/time/strptime.3:1.31	Mon Apr  6 10:38:22 2015
+++ src/lib/libc/time/strptime.3	Thu Oct 29 13:54:49 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.31 2015/04/06 14:38:22 ginsbach Exp $
+.\"	$NetBSD: strptime.3,v 1.32 2015/10/29 17:54:49 christos Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -223,33 +223,56 @@ the year, including the century (i.e., 1
 .It Cm \&%z
 an ISO 8601 or RFC-2822 time zone specification.
 This is one of the following:
-the offset from
-Coordinated Universal Time
+.Bl -dash -offset indent -compact
+.It
+The offset from Coordinated Universal Time
 .Pq Ql UTC
 specified as:
-.Dq [+-]hhmm ,
-.Dq [+-]hh:mm ,
-or
-.Dq [+-]hh ;
+.Bl -bullet -offset indent -compact
+.It
+[+-]hhmm
+.It
+[+-]hh:mm
+.It
+[+-]hh
+.El
+.It
 .Ql UTC
 specified as:
-.Dq GMT
-.Pq Ql Greenwich Mean Time ,
-.Dq UT
-.Pq Ql Universal Time ,
-or
-.Dq Z
-.Pq Ql Zulu Time ;
-a three character US time zone specified as:
-.Dq EDT ,
-.Dq EST ,
-.Dq CDT ,
-.Dq CST ,
-.Dq MDT ,
-.Dq MST ,
-.Dq PDT ,
-or
-.Dq PST ,
+.Bl -bullet -offset indent -compact
+.It
+UTC
+.Pq Ql Coordinated Universal time
+.It
+GMT
+.Pq Ql Greenwich Mean Time
+.It
+UT
+.Pq Ql Universal Time
+.It
+Z
+.Pq Ql Zulu Time
+.El
+.It
+A three character US time zone specified as:
+.Bl -bullet -offset indent -compact
+.It
+EDT
+.It
+EST
+.It
+CDT
+.It
+CST
+.It
+MDT
+.It
+MST
+.It
+PDT
+.It
+PST
+.El
 with the first letter standing for
 .Ql Eastern
 .Pq Dq E ,
@@ -270,15 +293,22 @@ time
 or
 .Ql Standard
 .Pq Dq S
-time;
+time
+.It 
 a single letter military time zone specified as:
+.Bl -bullet -offset indent -compact
+.It
 .Dq A
 through
 .Dq I
-and
+.It
 .Dq K
 through
 .Dq Y .
+.El
+.It
+An arbirtrary timezone name that can be loaded from the database.
+.El
 .Po
 A
 .Nx

Index: src/lib/libc/time/strptime.c
diff -u src/lib/libc/time/strptime.c:1.49 src/lib/libc/time/strptime.c:1.50
--- src/lib/libc/time/strptime.c:1.49	Fri Oct  9 13:21:45 2015
+++ src/lib/libc/time/strptime.c	Thu Oct 29 13:54:49 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.49 2015/10/09 17:21:45 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.50 2015/10/29 17:54:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.49 2015/10/09 17:21:45 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.50 2015/10/29 17:54:49 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -114,6 +114,34 @@ first_wday_of(int yr)
 	(isleap(yr) ? 6 : 0) + 1) % 7;
 }
 
+#define delim(p)	((p) == '\0' || isspace((unsigned char)(p)))
+
+static int
+fromzone(const unsigned char **bp, struct tm *tm)
+{
+	timezone_t tz;
+	char buf[512], *p;
+
+	for (p = buf; !delim(**bp) && p < [sizeof(buf) - 1]; (*bp)++)
+		*p++ = **bp;
+	*p = '\0';
+
+	tz = tzalloc(buf);
+	if (tz == NULL)
+		return 0;
+
+	tm->tm_isdst = 0;	/* XXX */
+#ifdef TM_GMTOFF
+	tm->TM_GMTOFF = tzgetgmtoff(tz, tm->tm_isdst);
+#endif
+#ifdef TM_ZONE
+	// Can't use tzgetname() here because we are going to free()
+	tm->TM_ZONE = utc; /* XXX */
+#endif
+	tzfree(tz);
+	return 1;
+}
+
 char *
 strptime(const char *buf, const char *fmt, struct tm *tm)
 {
@@ -124,7 +152,7 @@ char *
 strptime_l(const char *buf, const char *fmt, struct tm *tm, locale_t loc)
 {
 	unsigned char c;
-	const unsigned char *bp, *ep;
+	const unsigned char *bp, *ep, *zname;
 	int alt_format, i, split_year = 0, neg = 0, state = 0,
 	day_offset = -1, week_offset = 0, offs;
 	const char *new_fmt;
@@ -439,13 +467,18 @@ literal:
 if (ep != NULL) {
 	tm->tm_isdst = i;
 #ifdef TM_GMTOFF
-	tm->TM_GMTOFF = -(timezone);
+#ifdef USG_COMPAT
+	tm->TM_GMTOFF = -timezone;
+#else
+	tm->TM_GMTOFF = -timezone();
+#endif
 #endif
 #ifdef TM_ZONE
 	tm->TM_ZONE = tzname[i];
+	bp = ep;
 #endif
-}
-bp = ep;
+} else
+	(void)fromzone(, tm);
 			}
 			continue;
 
@@ -470,16 +503,21 @@ literal:
 			while (isspace(*bp))
 bp++;
 
+			zname = bp;
 			switch (*bp++) {
 			case 'G':
 if (*bp++ != 'M')
-	return NULL;
+	goto namedzone;
 /*FALLTHROUGH*/
 			case 'U':
 if (*bp++ != 'T')
-	return NULL;
+	goto namedzone;
+else if (!delim(*bp) && 

CVS commit: src/lib/libc/time

2015-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 29 17:51:58 UTC 2015

Modified Files:
src/lib/libc/time: tzset.3

Log Message:
Document tzgetgmtoff(3)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/tzset.3

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/tzset.3
diff -u src/lib/libc/time/tzset.3:1.32 src/lib/libc/time/tzset.3:1.33
--- src/lib/libc/time/tzset.3:1.32	Sun Apr  5 04:36:38 2015
+++ src/lib/libc/time/tzset.3	Thu Oct 29 13:51:58 2015
@@ -1,11 +1,12 @@
-.\"	$NetBSD: tzset.3,v 1.32 2015/04/05 08:36:38 pgoyette Exp $
-.Dd October 23, 2014
+.\"	$NetBSD: tzset.3,v 1.33 2015/10/29 17:51:58 christos Exp $
+.Dd October 29, 2015
 .Dt TZSET 3
 .Os
 .Sh NAME
 .Nm tzset ,
 .Nm tzalloc ,
 .Nm tzgetname ,
+.Nm tzgetgmtoff ,
 .Nm tzfree
 .Nd initialize time conversion information
 .Sh LIBRARY
@@ -18,6 +19,8 @@
 .Fn tzfree "timezone_t restrict tz"
 .Ft const char *
 .Fn tzgetname "timezone_t restrict tz" "int isdst"
+.Ft long
+.Fn tzgetgmtoff "timezone_t restrict tz" "int isdst"
 .Ft void
 .Fn tzset "void"
 .Sh DESCRIPTION
@@ -70,7 +73,7 @@ This invalidates any
 pointers that
 .Fa tz
 was used to set.
-Finally,
+The function
 .Fn tzgetname
 returns the name for the given
 .Fa tz .
@@ -86,6 +89,17 @@ is set to
 .Va 1
 the call is equivalent to
 .Va tzname[1] .
+Finally, the
+.Fn tzgetgmtoff
+function acts like
+.Fn tzgetname
+only it returns the offset in seconds from GMT for the timezone.
+If there is no match, then
+.Dv \-1 
+is returned and 
+.Va errno
+is set to
+.Dv ESRCH .
 The
 .Fn tzset
 function acts like



CVS commit: src/lib/libc/time

2015-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 29 19:18:32 UTC 2015

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
another lint warning for compat.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.99 src/lib/libc/time/localtime.c:1.100
--- src/lib/libc/time/localtime.c:1.99	Thu Oct 29 13:49:24 2015
+++ src/lib/libc/time/localtime.c	Thu Oct 29 15:18:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.99 2015/10/29 17:49:24 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.100 2015/10/29 19:18:32 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.99 2015/10/29 17:49:24 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.100 2015/10/29 19:18:32 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -639,7 +639,7 @@ tzloadbody(char const *name, struct stat
 			  size_t tsabbrlen = strlen(tsabbr);
 			  if (j + tsabbrlen < TZ_MAX_CHARS) {
 strcpy(sp->chars + j, tsabbr);
-charcnt = j + tsabbrlen + 1;
+charcnt = (int_fast32_t)(j + tsabbrlen + 1);
 ts->ttis[i].tt_abbrind = j;
 gotabbr++;
 			  }



CVS commit: src/lib/libc/time

2015-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 29 19:18:19 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
- use #defined constants (from gisbach)
- back to setting tm_zone to NULL when we don't know.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.50 src/lib/libc/time/strptime.c:1.51
--- src/lib/libc/time/strptime.c:1.50	Thu Oct 29 13:54:49 2015
+++ src/lib/libc/time/strptime.c	Thu Oct 29 15:18:19 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.50 2015/10/29 17:54:49 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.51 2015/10/29 19:18:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.50 2015/10/29 17:54:49 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.51 2015/10/29 19:18:19 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -136,7 +136,7 @@ fromzone(const unsigned char **bp, struc
 #endif
 #ifdef TM_ZONE
 	// Can't use tzgetname() here because we are going to free()
-	tm->TM_ZONE = utc; /* XXX */
+	tm->TM_ZONE = NULL; /* XXX */
 #endif
 	tzfree(tz);
 	return 1;
@@ -549,10 +549,10 @@ namedzone:
 		tm->TM_GMTOFF = 'A' - (int)*bp;
 	else if (*bp >= 'N' && *bp <= 'Y')
 		tm->TM_GMTOFF = (int)*bp - 'M';
-	tm->TM_GMTOFF *= 3600;
+	tm->TM_GMTOFF *= SECSPERHOUR;
 #endif
 #ifdef TM_ZONE
-	tm->TM_ZONE = utc; /* XXX */
+	tm->TM_ZONE = NULL; /* XXX */
 #endif
 	bp++;
 	continue;
@@ -568,7 +568,7 @@ namedzone:
 ep = find_string(bp, , nast, NULL, 4);
 if (ep != NULL) {
 #ifdef TM_GMTOFF
-	tm->TM_GMTOFF = (-5 - i) * 3600;
+	tm->TM_GMTOFF = (-5 - i) * SECSPERHOUR;
 #endif
 #ifdef TM_ZONE
 	tm->TM_ZONE = __UNCONST(nast[i]);
@@ -580,7 +580,7 @@ namedzone:
 if (ep != NULL) {
 	tm->tm_isdst = 1;
 #ifdef TM_GMTOFF
-	tm->TM_GMTOFF = (-4 - i) * 3600;
+	tm->TM_GMTOFF = (-4 - i) * SECSPERHOUR;
 #endif
 #ifdef TM_ZONE
 	tm->TM_ZONE = __UNCONST(nadt[i]);
@@ -614,14 +614,14 @@ loadzone:
 return NULL;
 			switch (i) {
 			case 2:
-offs *= 3600;
+offs *= SECSPERHOUR;
 break;
 			case 4:
 i = offs % 100;
-if (i >= 60)
+if (i >= SECSPERMIN)
 	return NULL;
 /* Convert minutes into decimal */
-offs = (offs / 100) * 3600 + i * 60;
+offs = (offs / 100) * SECSPERHOUR + i * SECSPERMIN;
 break;
 			default:
 return NULL;
@@ -633,7 +633,7 @@ loadzone:
 			tm->TM_GMTOFF = offs;
 #endif
 #ifdef TM_ZONE
-			tm->TM_ZONE = utc;	/* XXX */
+			tm->TM_ZONE = NULL;	/* XXX */
 #endif
 			continue;
 



CVS commit: src/lib/libc/time

2015-10-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Oct 29 22:42:55 UTC 2015

Modified Files:
src/lib/libc/time: strptime.3 tzset.3

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/strptime.3
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/time/tzset.3

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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.32 src/lib/libc/time/strptime.3:1.33
--- src/lib/libc/time/strptime.3:1.32	Thu Oct 29 17:54:49 2015
+++ src/lib/libc/time/strptime.3	Thu Oct 29 22:42:55 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.32 2015/10/29 17:54:49 christos Exp $
+.\"	$NetBSD: strptime.3,v 1.33 2015/10/29 22:42:55 wiz Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -294,7 +294,7 @@ or
 .Ql Standard
 .Pq Dq S
 time
-.It 
+.It
 a single letter military time zone specified as:
 .Bl -bullet -offset indent -compact
 .It

Index: src/lib/libc/time/tzset.3
diff -u src/lib/libc/time/tzset.3:1.33 src/lib/libc/time/tzset.3:1.34
--- src/lib/libc/time/tzset.3:1.33	Thu Oct 29 17:51:58 2015
+++ src/lib/libc/time/tzset.3	Thu Oct 29 22:42:55 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tzset.3,v 1.33 2015/10/29 17:51:58 christos Exp $
+.\"	$NetBSD: tzset.3,v 1.34 2015/10/29 22:42:55 wiz Exp $
 .Dd October 29, 2015
 .Dt TZSET 3
 .Os
@@ -95,8 +95,8 @@ function acts like
 .Fn tzgetname
 only it returns the offset in seconds from GMT for the timezone.
 If there is no match, then
-.Dv \-1 
-is returned and 
+.Dv \-1
+is returned and
 .Va errno
 is set to
 .Dv ESRCH .



CVS commit: src/lib/libc/time

2015-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 29 17:49:24 UTC 2015

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Add tzgetgmtoff, delint compat


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.98 src/lib/libc/time/localtime.c:1.99
--- src/lib/libc/time/localtime.c:1.98	Fri Oct  9 13:21:45 2015
+++ src/lib/libc/time/localtime.c	Thu Oct 29 13:49:24 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.98 2015/10/09 17:21:45 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.99 2015/10/29 17:49:24 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.98 2015/10/09 17:21:45 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.99 2015/10/29 17:49:24 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -289,6 +289,25 @@ tzgetname(const timezone_t sp, int isdst
 	return NULL;
 }
 
+long
+tzgetgmtoff(const timezone_t sp, int isdst)
+{
+	int i;
+	long l = -1;
+	for (i = 0; i < sp->timecnt; ++i) {
+		const struct ttinfo *const ttisp = >ttis[sp->types[i]];
+
+		if (ttisp->tt_isdst == isdst) {
+			l = ttisp->tt_gmtoff;
+			if (sp->types[i] != 0)
+return l;
+		}
+	}
+	if (l == -1)
+		errno = ESRCH;
+	return l;
+}
+
 static void
 scrub_abbrs(struct state *sp)
 {
@@ -617,7 +636,7 @@ tzloadbody(char const *name, struct stat
 break;
 			  }
 			if (! (j < charcnt)) {
-			  int tsabbrlen = strlen(tsabbr);
+			  size_t tsabbrlen = strlen(tsabbr);
 			  if (j + tsabbrlen < TZ_MAX_CHARS) {
 strcpy(sp->chars + j, tsabbr);
 charcnt = j + tsabbrlen + 1;
@@ -1253,7 +1272,7 @@ tzparse(const char *name, struct state *
 		init_ttinfo(>ttis[1], 0, false, 0);
 		sp->defaulttype = 0;
 	}
-	sp->charcnt = charcnt;
+	sp->charcnt = (int)charcnt;
 	cp = sp->chars;
 	(void) memcpy(cp, stdname, stdlen);
 	cp += stdlen;



CVS commit: src/lib/libc/time

2015-10-29 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Fri Oct 30 01:49:36 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Reject timezone offsets more than 12 hours (east or west).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.51 src/lib/libc/time/strptime.c:1.52
--- src/lib/libc/time/strptime.c:1.51	Thu Oct 29 19:18:19 2015
+++ src/lib/libc/time/strptime.c	Fri Oct 30 01:49:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.51 2015/10/29 19:18:19 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.52 2015/10/30 01:49:36 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.51 2015/10/29 19:18:19 christos Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.52 2015/10/30 01:49:36 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
@@ -626,6 +626,8 @@ loadzone:
 			default:
 return NULL;
 			}
+			if (offs > (12 * SECSPERHOUR))
+return NULL;
 			if (neg)
 offs = -offs;
 			tm->tm_isdst = 0;	/* XXX */



CVS commit: src/lib/libc/time

2015-10-09 Thread Christos Zoulas
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  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  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 

CVS commit: src/lib/libc/time

2015-08-18 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Aug 18 16:54:27 UTC 2015

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Remove second 'const' declaration, to hopefully fix clang builds.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.96 src/lib/libc/time/localtime.c:1.97
--- src/lib/libc/time/localtime.c:1.96	Thu Aug 13 11:21:18 2015
+++ src/lib/libc/time/localtime.c	Tue Aug 18 16:54:27 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.96 2015/08/13 11:21:18 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.97 2015/08/18 16:54:27 riz 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.96 2015/08/13 11:21:18 christos Exp $);
+__RCSID($NetBSD: localtime.c,v 1.97 2015/08/18 16:54:27 riz Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1581,7 +1581,7 @@ leaps_thru_end_of(const int y)
 
 static struct tm *
 timesub(const time_t *timep, int_fast32_t offset,
-const struct state const *sp, struct tm *tmp)
+const struct state *sp, struct tm *tmp)
 {
 	const struct lsinfo *	lp;
 	time_t			tdays;



CVS commit: src/lib/libc/time

2015-08-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 13 11:21:18 UTC 2015

Modified Files:
src/lib/libc/time: Makefile NEWS Theory difftime.c localtime.c
private.h strftime.c tz-art.htm tz-link.htm zdump.c zic.8 zic.c

Log Message:
merge 2015f


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/time/Makefile
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/NEWS
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/time/Theory
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/difftime.c
cvs rdiff -u -r1.95 -r1.96 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/private.h
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/time/zic.8
cvs rdiff -u -r1.54 -r1.55 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.29 src/lib/libc/time/Makefile:1.30
--- src/lib/libc/time/Makefile:1.29	Sun Jun 21 12:06:51 2015
+++ src/lib/libc/time/Makefile	Thu Aug 13 07:21:18 2015
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2015e
+VERSION=	2015f
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -102,7 +102,6 @@ LDLIBS=
 
 # Add the following to the end of the CFLAGS= line as needed.
 #  -DBIG_BANG=-999LL if the Big Bang occurred at time -999 (see zic.c)
-#  -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
@@ -113,10 +112,6 @@ LDLIBS=
 #  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
 #	This defaults to 1 if a working localtime_rz seems to be available.
 #	localtime_rz can make zdump significantly faster, but is nonstandard.
-#  -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)
-#  -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD)
 #  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with stdint.h
 #  -DHAVE_STRFTIME_L=1 if time.h declares locale_t and strftime_l
 #	This defaults to 0 if _POSIX_VERSION  200809, 1 otherwise.
@@ -126,7 +121,6 @@ LDLIBS=
 #  -DHAVE_SYS_WAIT_H=0 if your compiler lacks a sys/wait.h
 #  -DHAVE_TZSET=0 if your system lacks a tzset function
 #  -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
 #  -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
@@ -148,7 +142,7 @@ LDLIBS=
 #  -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) if you are using recent GCC and want lots of checking
 GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
 	-Wall -Wextra \
 	-Wbad-function-cast -Wcast-align -Wdate-time \

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.12 src/lib/libc/time/NEWS:1.13
--- src/lib/libc/time/NEWS:1.12	Sun Jun 21 12:06:51 2015
+++ src/lib/libc/time/NEWS	Thu Aug 13 07:21:18 2015
@@ -1,5 +1,71 @@
 News for the tz database
 
+Release 2015f - 2015-08-10 18:06:56 -0700
+
+  Changes affecting future time stamps
+
+North Korea switches to +0830 on 2015-08-15.  (Thanks to Steffen Thorsen.)
+The abbreviation remains KST.  (Thanks to Robert Elz.)
+
+Uruguay no longer observes DST.  (Thanks to Steffen Thorsen
+and Pablo Camargo.)
+
+  Changes affecting past and future time stamps
+
+Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC.
+(Thanks to Roman Tudos.)
+
+  Changes affecting data format and code
+
+zic's '-y YEARISTYPE' option is no longer documented.  The TYPE
+field of a Rule line should now be '-'; the old values 'even',
+'odd', 'uspres', 'nonpres', 'nonuspres' were already undocumented.
+Although the implementation has not changed, these features do not
+work in the default installation, they are not used in the data,
+and they are now considered obsolescent.
+
+zic now checks that two rules don't take effect at the same time.
+(Thanks to Jon Skeet and Arthur David Olson.)  Constraints on
+simultaneity are now documented.
+
+The two characters '%z' in a zone format now stand for the UTC
+offset, e.g., '-07' for seven 

CVS commit: src/lib/libc/time

2015-07-29 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Wed Jul 29 20:32:54 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Only apply am/pm adjustment to tm_hour when it has actually been parsed.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.47 src/lib/libc/time/strptime.c:1.48
--- src/lib/libc/time/strptime.c:1.47	Wed Jul 22 13:33:59 2015
+++ src/lib/libc/time/strptime.c	Wed Jul 29 20:32:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.47 2015/07/22 13:33:59 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.48 2015/07/29 20:32:54 ginsbach 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.47 2015/07/22 13:33:59 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.48 2015/07/29 20:32:54 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -70,12 +70,14 @@ static const u_char *find_string(const u
 #define S_YDAY			(1  2)
 #define S_MDAY			(1  3)
 #define S_WDAY			(1  4)
+#define S_HOUR			(1  5)
 
 #define HAVE_MDAY(s)		(s  S_MDAY)
 #define HAVE_MON(s)		(s  S_MON)
 #define HAVE_WDAY(s)		(s  S_WDAY)
 #define HAVE_YDAY(s)		(s  S_YDAY)
 #define HAVE_YEAR(s)		(s  S_YEAR)
+#define HAVE_HOUR(s)		(s  S_HOUR)
 
 static char gmt[] = { GMT };
 static char utc[] = { UTC };
@@ -262,6 +264,7 @@ literal:
 		case 'H':
 			bp = conv_num(bp, tm-tm_hour, 0, 23);
 			LEGAL_ALT(ALT_O);
+			state |= S_HOUR;
 			continue;
 
 		case 'l':	/* The hour (12-hour clock representation). */
@@ -272,6 +275,7 @@ literal:
 			if (tm-tm_hour == 12)
 tm-tm_hour = 0;
 			LEGAL_ALT(ALT_O);
+			state |= S_HOUR;
 			continue;
 
 		case 'j':	/* The day of year. */
@@ -298,7 +302,7 @@ literal:
 		case 'p':	/* The locale's equivalent of AM/PM. */
 			bp = find_string(bp, i, _TIME_LOCALE(loc)-am_pm,
 			NULL, 2);
-			if (tm-tm_hour  11)
+			if (HAVE_HOUR(state)  tm-tm_hour  11)
 return NULL;
 			tm-tm_hour += i * 12;
 			LEGAL_ALT(0);



CVS commit: src/lib/libc/time

2015-07-22 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Wed Jul 22 13:33:59 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
More KNF style changes -- consistent use of whitespace in #defines.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.46 src/lib/libc/time/strptime.c:1.47
--- src/lib/libc/time/strptime.c:1.46	Mon Jul 20 14:37:11 2015
+++ src/lib/libc/time/strptime.c	Wed Jul 22 13:33:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.46 2015/07/20 14:37:11 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.47 2015/07/22 13:33:59 ginsbach 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.46 2015/07/20 14:37:11 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.47 2015/07/22 13:33:59 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -63,19 +63,19 @@ static const u_char *find_string(const u
  */
 #define ALT_E			0x01
 #define ALT_O			0x02
-#define	LEGAL_ALT(x)		{ if (alt_format  ~(x)) return NULL; }
+#define LEGAL_ALT(x)		{ if (alt_format  ~(x)) return NULL; }
 
-#define	S_YEAR		(1  0)
-#define	S_MON		(1  1)
-#define	S_YDAY		(1  2)
-#define	S_MDAY		(1  3)
-#define	S_WDAY		(1  4)
-
-#define HAVE_MDAY(s)	(s  S_MDAY)
-#define HAVE_MON(s)	(s  S_MON)
-#define HAVE_WDAY(s)	(s  S_WDAY)
-#define HAVE_YDAY(s)	(s  S_YDAY)
-#define HAVE_YEAR(s)	(s  S_YEAR)
+#define S_YEAR			(1  0)
+#define S_MON			(1  1)
+#define S_YDAY			(1  2)
+#define S_MDAY			(1  3)
+#define S_WDAY			(1  4)
+
+#define HAVE_MDAY(s)		(s  S_MDAY)
+#define HAVE_MON(s)		(s  S_MON)
+#define HAVE_WDAY(s)		(s  S_WDAY)
+#define HAVE_YDAY(s)		(s  S_YDAY)
+#define HAVE_YEAR(s)		(s  S_YEAR)
 
 static char gmt[] = { GMT };
 static char utc[] = { UTC };



CVS commit: src/lib/libc/time

2015-07-20 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Mon Jul 20 14:37:11 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
KNF and additional comments


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.45 src/lib/libc/time/strptime.c:1.46
--- src/lib/libc/time/strptime.c:1.45	Wed Jul 15 13:54:38 2015
+++ src/lib/libc/time/strptime.c	Mon Jul 20 14:37:11 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.45 2015/07/15 13:54:38 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.46 2015/07/20 14:37:11 ginsbach 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.45 2015/07/15 13:54:38 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.46 2015/07/20 14:37:11 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -50,6 +50,10 @@ __weak_alias(strptime,_strptime)
 __weak_alias(strptime_l, _strptime_l)
 #endif
 
+static const u_char *conv_num(const unsigned char *, int *, uint, uint);
+static const u_char *find_string(const u_char *, int *, const char * const *,
+	const char * const *, int);
+
 #define _TIME_LOCALE(loc) \
 ((_TimeLocale *)((loc)-part_impl[(size_t)LC_TIME]))
 
@@ -83,12 +87,14 @@ static const char * const nadt[5] = {
EDT,CDT,MDT,PDT,\0\0\0
 };
 
-static const u_char *conv_num(const unsigned char *, int *, uint, uint);
-static const u_char *find_string(const u_char *, int *, const char * const *,
-	const char * const *, int);
-
+/*
+ * Table to determine the ordinal date for the start of a month.
+ * Ref: http://en.wikipedia.org/wiki/ISO_week_date
+ */
 static const int start_of_month[2][13] = {
+	/* non-leap year */
 	{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+	/* leap year */
 	{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
 };
 
@@ -586,11 +592,13 @@ literal:
 
 	if (!HAVE_YDAY(state)  HAVE_YEAR(state)) {
 		if (HAVE_MON(state)  HAVE_MDAY(state)) {
+			/* calculate day of year (ordinal date) */
 			tm-tm_yday =  start_of_month[isleap_sum(tm-tm_year,
 			TM_YEAR_BASE)][tm-tm_mon] + (tm-tm_mday - 1);
 			state |= S_YDAY;
 		} else if (day_offset != -1) {
-			/* Set the date to the first Sunday (or Monday)
+			/*
+			 * Set the date to the first Sunday (or Monday)
 			 * of the specified week of the year.
 			 */
 			if (!HAVE_WDAY(state)) {
@@ -607,7 +615,9 @@ literal:
 
 	if (HAVE_YDAY(state)  HAVE_YEAR(state)) {
 		int isleap;
+
 		if (!HAVE_MON(state)) {
+			/* calculate month of day of year */
 			i = 0;
 			isleap = isleap_sum(tm-tm_year, TM_YEAR_BASE);
 			while (tm-tm_yday = start_of_month[isleap][i])
@@ -620,13 +630,17 @@ literal:
 			tm-tm_mon = i - 1;
 			state |= S_MON;
 		}
+
 		if (!HAVE_MDAY(state)) {
+			/* calculate day of month */
 			isleap = isleap_sum(tm-tm_year, TM_YEAR_BASE);
 			tm-tm_mday = tm-tm_yday -
 			start_of_month[isleap][tm-tm_mon] + 1;
 			state |= S_MDAY;
 		}
+
 		if (!HAVE_WDAY(state)) {
+			/* calculate day of week */
 			i = 0;
 			week_offset = first_wday_of(tm-tm_year);
 			while (i++ = tm-tm_yday) {



CVS commit: src/lib/libc/time

2015-07-15 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Wed Jul 15 13:54:38 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Don't set state when parsing any timezone (%z) information.  The '+' in
this case isn't the same as the FreeBSD '%+' str[fp]time() (GNU) extension.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.44 src/lib/libc/time/strptime.c:1.45
--- src/lib/libc/time/strptime.c:1.44	Tue Jul 14 18:07:17 2015
+++ src/lib/libc/time/strptime.c	Wed Jul 15 13:54:38 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.44 2015/07/14 18:07:17 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.45 2015/07/15 13:54:38 ginsbach 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.44 2015/07/14 18:07:17 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.45 2015/07/15 13:54:38 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -480,7 +480,6 @@ literal:
 continue;
 			case '+':
 neg = 0;
-state |= S_WDAY | S_MON | S_MDAY | S_YEAR;
 break;
 			case '-':
 neg = 1;



CVS commit: src/lib/libc/time

2015-07-14 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Tue Jul 14 18:07:17 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Set S_WDAY state for %u (same as it is set for %w).


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.43 src/lib/libc/time/strptime.c:1.44
--- src/lib/libc/time/strptime.c:1.43	Mon Jul 13 17:45:16 2015
+++ src/lib/libc/time/strptime.c	Tue Jul 14 18:07:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.43 2015/07/13 17:45:16 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.44 2015/07/14 18:07:17 ginsbach 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.43 2015/07/13 17:45:16 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.44 2015/07/14 18:07:17 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -363,6 +363,7 @@ literal:
 			bp = conv_num(bp, i, 1, 7);
 			tm-tm_wday = i % 7;
 			LEGAL_ALT(ALT_O);
+			state |= S_WDAY;
 			continue;
 
 		case 'g':	/* The year corresponding to the ISO week



CVS commit: src/lib/libc/time

2015-07-13 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Mon Jul 13 17:45:16 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Switch to using isleap() and isleap_sum() macros from tzfile.h to be
consistent with strftime.c and localtime.c.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.42 src/lib/libc/time/strptime.c:1.43
--- src/lib/libc/time/strptime.c:1.42	Wed Jul  8 19:48:20 2015
+++ src/lib/libc/time/strptime.c	Mon Jul 13 17:45:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.42 2015/07/08 19:48:20 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.43 2015/07/13 17:45:16 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,13 +31,12 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: strptime.c,v 1.42 2015/07/08 19:48:20 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.43 2015/07/13 17:45:16 ginsbach Exp $);
 #endif
 
 #include namespace.h
 #include sys/localedef.h
 #include sys/types.h
-#include sys/clock.h
 #include ctype.h
 #include locale.h
 #include string.h
@@ -104,7 +103,7 @@ static int
 first_wday_of(int yr)
 {
 	return ((2 * (3 - (yr / 100) % 4)) + (yr % 100) + ((yr % 100) /  4) +
-	(is_leap_year(yr) ? 6 : 0) + 1) % 7;
+	(isleap(yr) ? 6 : 0) + 1) % 7;
 }
 
 char *
@@ -587,7 +586,7 @@ literal:
 
 	if (!HAVE_YDAY(state)  HAVE_YEAR(state)) {
 		if (HAVE_MON(state)  HAVE_MDAY(state)) {
-			tm-tm_yday =  start_of_month[is_leap_year(tm-tm_year +
+			tm-tm_yday =  start_of_month[isleap_sum(tm-tm_year,
 			TM_YEAR_BASE)][tm-tm_mon] + (tm-tm_mday - 1);
 			state |= S_YDAY;
 		} else if (day_offset != -1) {
@@ -610,7 +609,7 @@ literal:
 		int isleap;
 		if (!HAVE_MON(state)) {
 			i = 0;
-			isleap = is_leap_year(tm-tm_year + TM_YEAR_BASE);
+			isleap = isleap_sum(tm-tm_year, TM_YEAR_BASE);
 			while (tm-tm_yday = start_of_month[isleap][i])
 i++;
 			if (i  12) {
@@ -622,7 +621,7 @@ literal:
 			state |= S_MON;
 		}
 		if (!HAVE_MDAY(state)) {
-			isleap = is_leap_year(tm-tm_year + TM_YEAR_BASE);
+			isleap = isleap_sum(tm-tm_year, TM_YEAR_BASE);
 			tm-tm_mday = tm-tm_yday -
 			start_of_month[isleap][tm-tm_mon] + 1;
 			state |= S_MDAY;



CVS commit: src/lib/libc/time

2015-07-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 11 16:09:15 UTC 2015

Modified Files:
src/lib/libc/time: tzcode2netbsd

Log Message:
- don't copy the man pages anymore. they have been converted to mdoc
  format.
- don't delete extra files, but mention the 'import' process


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/time/tzcode2netbsd

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/tzcode2netbsd
diff -u src/lib/libc/time/tzcode2netbsd:1.5 src/lib/libc/time/tzcode2netbsd:1.6
--- src/lib/libc/time/tzcode2netbsd:1.5	Thu May 27 16:33:31 2004
+++ src/lib/libc/time/tzcode2netbsd	Sat Jul 11 12:09:15 2015
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 #
-# $NetBSD: tzcode2netbsd,v 1.5 2004/05/27 20:33:31 kleink Exp $
+# $NetBSD: tzcode2netbsd,v 1.6 2015/07/11 16:09:15 christos Exp $
 #
 # Convert an extracted tzcode distribution into the format suitable
 # for importing it into the NetBSD source tree.
@@ -23,11 +23,10 @@ NOIMPORT=Makefile
 	zdump.8.txt
 	zic.8.txt
 
-NEWTONORMAL=ctime.3
-	tzset.3
+#rm -f ${NOIMPORT}
+#mv tzfile.h ../../../include
 
-rm -f ${NOIMPORT}
-
-for f in ${NEWTONORMAL}; do
-	mv new${f} ${f};
-done
+echo remember to check tzfile.h in ../../../include
+echo you can find the current version in the Makefile
+echo we don't use this script anymore to import, but diff against the
+echo current version and apply patches.



CVS commit: src/lib/libc/time

2015-07-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 11 16:41:08 UTC 2015

Removed Files:
src/lib/libc/time: tzfile.h

Log Message:
remove local copy of tzfile.h


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r0 src/lib/libc/time/tzfile.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/time

2015-07-08 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Wed Jul  8 18:44:09 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.40 src/lib/libc/time/strptime.c:1.41
--- src/lib/libc/time/strptime.c:1.40	Fri Jul  3 13:06:54 2015
+++ src/lib/libc/time/strptime.c	Wed Jul  8 18:44:09 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.40 2015/07/03 13:06:54 christos Exp $	*/
+/*	$NetBSD: strptime.c,v 1.41 2015/07/08 18:44:09 ginsbach 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.40 2015/07/03 13:06:54 christos Exp $);
+__RCSID($NetBSD: strptime.c,v 1.41 2015/07/08 18:44:09 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -62,11 +62,11 @@ __weak_alias(strptime_l, _strptime_l)
 #define ALT_O			0x02
 #define	LEGAL_ALT(x)		{ if (alt_format  ~(x)) return NULL; }
 
-#define	FLAG_YEAR	(1  0)
-#define	FLAG_MONTH	(1  1)
-#define	FLAG_YDAY	(1  2)
-#define	FLAG_MDAY	(1  3)
-#define	FLAG_WDAY	(1  4)
+#define	S_YEAR		(1  0)
+#define	S_MON		(1  1)
+#define	S_YDAY		(1  2)
+#define	S_MDAY		(1  3)
+#define	S_WDAY		(1  4)
 
 static char gmt[] = { GMT };
 static char utc[] = { UTC };
@@ -112,7 +112,7 @@ strptime_l(const char *buf, const char *
 {
 	unsigned char c;
 	const unsigned char *bp, *ep;
-	int alt_format, i, split_year = 0, neg = 0, flags = 0,
+	int alt_format, i, split_year = 0, neg = 0, state = 0,
 	day_offset = -1, week_offset = 0, offs;
 	const char *new_fmt;
 
@@ -161,20 +161,20 @@ literal:
 		 */
 		case 'c':	/* Date and time, using the locale's format. */
 			new_fmt = _TIME_LOCALE(loc)-d_t_fmt;
-			flags |= FLAG_WDAY | FLAG_MONTH | FLAG_MDAY |
-			FLAG_YEAR;
+			state |= S_WDAY | S_MON | S_MDAY |
+			S_YEAR;
 			goto recurse;
 
 		case 'D':	/* The date as %m/%d/%y. */
 			new_fmt = %m/%d/%y;
 			LEGAL_ALT(0);
-			flags |= FLAG_MONTH | FLAG_MDAY | FLAG_YEAR;
+			state |= S_MON | S_MDAY | S_YEAR;
 			goto recurse;
 
 		case 'F':	/* The date as %Y-%m-%d. */
 			new_fmt = %Y-%m-%d;
 			LEGAL_ALT(0);
-			flags |= FLAG_MONTH | FLAG_MDAY | FLAG_YEAR;
+			state |= S_MON | S_MDAY | S_YEAR;
 			goto recurse;
 
 		case 'R':	/* The time as %H:%M. */
@@ -198,7 +198,7 @@ literal:
 
 		case 'x':	/* The date, using the locale's format. */
 			new_fmt = _TIME_LOCALE(loc)-d_fmt;
-			flags |= FLAG_MONTH | FLAG_MDAY | FLAG_YEAR;
+			state |= S_MON | S_MDAY | S_YEAR;
 		recurse:
 			bp = (const u_char *)strptime((const char *)bp,
 			new_fmt, tm);
@@ -213,7 +213,7 @@ literal:
 			bp = find_string(bp, tm-tm_wday,
 			_TIME_LOCALE(loc)-day, _TIME_LOCALE(loc)-abday, 7);
 			LEGAL_ALT(0);
-			flags |= FLAG_WDAY;
+			state |= S_WDAY;
 			continue;
 
 		case 'B':	/* The month, using the locale's form. */
@@ -223,7 +223,7 @@ literal:
 			_TIME_LOCALE(loc)-mon, _TIME_LOCALE(loc)-abmon,
 			12);
 			LEGAL_ALT(0);
-			flags |= FLAG_MONTH;
+			state |= S_MON;
 			continue;
 
 		case 'C':	/* The century number. */
@@ -236,14 +236,14 @@ literal:
 			split_year = 1;
 			tm-tm_year = i;
 			LEGAL_ALT(ALT_E);
-			flags |= FLAG_YEAR;
+			state |= S_YEAR;
 			continue;
 
 		case 'd':	/* The day of month. */
 		case 'e':
 			bp = conv_num(bp, tm-tm_mday, 1, 31);
 			LEGAL_ALT(ALT_O);
-			flags |= FLAG_MDAY;
+			state |= S_MDAY;
 			continue;
 
 		case 'k':	/* The hour (24-hour clock representation). */
@@ -269,7 +269,7 @@ literal:
 			bp = conv_num(bp, i, 1, 366);
 			tm-tm_yday = i - 1;
 			LEGAL_ALT(0);
-			flags |= FLAG_YDAY;
+			state |= S_YDAY;
 			continue;
 
 		case 'M':	/* The minute. */
@@ -282,7 +282,7 @@ literal:
 			bp = conv_num(bp, i, 1, 12);
 			tm-tm_mon = i - 1;
 			LEGAL_ALT(ALT_O);
-			flags |= FLAG_MONTH;
+			state |= S_MON;
 			continue;
 
 		case 'p':	/* The locale's equivalent of AM/PM. */
@@ -327,8 +327,8 @@ literal:
 if (localtime_r(sse, tm) == NULL)
 	bp = NULL;
 else
-	flags |= FLAG_YDAY | FLAG_WDAY |
-	FLAG_MONTH | FLAG_MDAY | FLAG_YEAR;
+	state |= S_YDAY | S_WDAY |
+	S_MON | S_MDAY | S_YEAR;
 			}
 			continue;
 
@@ -352,7 +352,7 @@ literal:
 		case 'w':	/* The day of week, beginning on sunday. */
 			bp = conv_num(bp, tm-tm_wday, 0, 6);
 			LEGAL_ALT(ALT_O);
-			flags |= FLAG_WDAY;
+			state |= S_WDAY;
 			continue;
 
 		case 'u':	/* The day of week, monday = 1. */
@@ -384,7 +384,7 @@ literal:
 			bp = conv_num(bp, i, 0, );
 			tm-tm_year = i - TM_YEAR_BASE;
 			LEGAL_ALT(ALT_E);
-			flags |= FLAG_YEAR;
+			state |= S_YEAR;
 			continue;
 
 		case 'y':	/* The year within 100 years of the epoch. */
@@ -402,7 +402,7 @@ literal:
 	i = i + 1900 - TM_YEAR_BASE;
 			}
 			tm-tm_year = i;

CVS commit: src/lib/libc/time

2015-07-08 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Wed Jul  8 19:48:20 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
Add macros to clarify what (parse) state is needed to calculate 'missing'
tm fields.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.41 src/lib/libc/time/strptime.c:1.42
--- src/lib/libc/time/strptime.c:1.41	Wed Jul  8 18:44:09 2015
+++ src/lib/libc/time/strptime.c	Wed Jul  8 19:48:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.41 2015/07/08 18:44:09 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.42 2015/07/08 19:48:20 ginsbach 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.41 2015/07/08 18:44:09 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.42 2015/07/08 19:48:20 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -68,6 +68,12 @@ __weak_alias(strptime_l, _strptime_l)
 #define	S_MDAY		(1  3)
 #define	S_WDAY		(1  4)
 
+#define HAVE_MDAY(s)	(s  S_MDAY)
+#define HAVE_MON(s)	(s  S_MON)
+#define HAVE_WDAY(s)	(s  S_WDAY)
+#define HAVE_YDAY(s)	(s  S_YDAY)
+#define HAVE_YEAR(s)	(s  S_YEAR)
+
 static char gmt[] = { GMT };
 static char utc[] = { UTC };
 /* RFC-822/RFC-2822 */
@@ -161,8 +167,7 @@ literal:
 		 */
 		case 'c':	/* Date and time, using the locale's format. */
 			new_fmt = _TIME_LOCALE(loc)-d_t_fmt;
-			state |= S_WDAY | S_MON | S_MDAY |
-			S_YEAR;
+			state |= S_WDAY | S_MON | S_MDAY | S_YEAR;
 			goto recurse;
 
 		case 'D':	/* The date as %m/%d/%y. */
@@ -475,8 +480,7 @@ literal:
 continue;
 			case '+':
 neg = 0;
-state |= S_WDAY | S_MON |  S_MDAY |
-S_YEAR;
+state |= S_WDAY | S_MON | S_MDAY | S_YEAR;
 break;
 			case '-':
 neg = 1;
@@ -581,8 +585,8 @@ literal:
 		}
 	}
 
-	if (!(state  S_YDAY)  (state  S_YEAR)) {
-		if ((state  (S_MON | S_MDAY)) == (S_MON | S_MDAY)) {
+	if (!HAVE_YDAY(state)  HAVE_YEAR(state)) {
+		if (HAVE_MON(state)  HAVE_MDAY(state)) {
 			tm-tm_yday =  start_of_month[is_leap_year(tm-tm_year +
 			TM_YEAR_BASE)][tm-tm_mon] + (tm-tm_mday - 1);
 			state |= S_YDAY;
@@ -590,7 +594,7 @@ literal:
 			/* Set the date to the first Sunday (or Monday)
 			 * of the specified week of the year.
 			 */
-			if (!(state  S_WDAY)) {
+			if (!HAVE_WDAY(state)) {
 tm-tm_wday = day_offset;
 state |= S_WDAY;
 			}
@@ -602,9 +606,9 @@ literal:
 		}
 	}
 
-	if ((state  (S_YEAR | S_YDAY)) == (S_YEAR | S_YDAY)) {
+	if (HAVE_YDAY(state)  HAVE_YEAR(state)) {
 		int isleap;
-		if (!(state  S_MON)) {
+		if (!HAVE_MON(state)) {
 			i = 0;
 			isleap = is_leap_year(tm-tm_year + TM_YEAR_BASE);
 			while (tm-tm_yday = start_of_month[isleap][i])
@@ -617,13 +621,13 @@ literal:
 			tm-tm_mon = i - 1;
 			state |= S_MON;
 		}
-		if (!(state  S_MDAY)) {
+		if (!HAVE_MDAY(state)) {
 			isleap = is_leap_year(tm-tm_year + TM_YEAR_BASE);
 			tm-tm_mday = tm-tm_yday -
 			start_of_month[isleap][tm-tm_mon] + 1;
 			state |= S_MDAY;
 		}
-		if (!(state  S_WDAY)) {
+		if (!HAVE_WDAY(state)) {
 			i = 0;
 			week_offset = first_wday_of(tm-tm_year);
 			while (i++ = tm-tm_yday) {



CVS commit: src/lib/libc/time

2015-07-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul  3 13:06:55 UTC 2015

Modified Files:
src/lib/libc/time: strptime.c

Log Message:
PR/50009: David CARLIER: Enhance strptime to fill out more fields when it
can. From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/strptime.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/strptime.c
diff -u src/lib/libc/time/strptime.c:1.39 src/lib/libc/time/strptime.c:1.40
--- src/lib/libc/time/strptime.c:1.39	Mon Apr  6 10:38:22 2015
+++ src/lib/libc/time/strptime.c	Fri Jul  3 09:06:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.39 2015/04/06 14:38:22 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.40 2015/07/03 13:06:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,11 +31,13 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: strptime.c,v 1.39 2015/04/06 14:38:22 ginsbach Exp $);
+__RCSID($NetBSD: strptime.c,v 1.40 2015/07/03 13:06:54 christos Exp $);
 #endif
 
 #include namespace.h
 #include sys/localedef.h
+#include sys/types.h
+#include sys/clock.h
 #include ctype.h
 #include locale.h
 #include string.h
@@ -60,6 +62,12 @@ __weak_alias(strptime_l, _strptime_l)
 #define ALT_O			0x02
 #define	LEGAL_ALT(x)		{ if (alt_format  ~(x)) return NULL; }
 
+#define	FLAG_YEAR	(1  0)
+#define	FLAG_MONTH	(1  1)
+#define	FLAG_YDAY	(1  2)
+#define	FLAG_MDAY	(1  3)
+#define	FLAG_WDAY	(1  4)
+
 static char gmt[] = { GMT };
 static char utc[] = { UTC };
 /* RFC-822/RFC-2822 */
@@ -74,6 +82,25 @@ static const u_char *conv_num(const unsi
 static const u_char *find_string(const u_char *, int *, const char * const *,
 	const char * const *, int);
 
+static const int start_of_month[2][13] = {
+	{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+	{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+};
+
+/*
+ * Calculate the week day of the first day of a year. Valid for
+ * the Gregorian calendar, which began Sept 14, 1752 in the UK
+ * and its colonies. Ref:
+ * http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week
+ */
+
+static int
+first_wday_of(int yr)
+{
+	return ((2 * (3 - (yr / 100) % 4)) + (yr % 100) + ((yr % 100) /  4) +
+	(is_leap_year(yr) ? 6 : 0) + 1) % 7;
+}
+
 char *
 strptime(const char *buf, const char *fmt, struct tm *tm)
 {
@@ -85,7 +112,8 @@ strptime_l(const char *buf, const char *
 {
 	unsigned char c;
 	const unsigned char *bp, *ep;
-	int alt_format, i, split_year = 0, neg = 0, offs;
+	int alt_format, i, split_year = 0, neg = 0, flags = 0,
+	day_offset = -1, week_offset = 0, offs;
 	const char *new_fmt;
 
 	bp = (const u_char *)buf;
@@ -133,16 +161,20 @@ literal:
 		 */
 		case 'c':	/* Date and time, using the locale's format. */
 			new_fmt = _TIME_LOCALE(loc)-d_t_fmt;
+			flags |= FLAG_WDAY | FLAG_MONTH | FLAG_MDAY |
+			FLAG_YEAR;
 			goto recurse;
 
 		case 'D':	/* The date as %m/%d/%y. */
 			new_fmt = %m/%d/%y;
 			LEGAL_ALT(0);
+			flags |= FLAG_MONTH | FLAG_MDAY | FLAG_YEAR;
 			goto recurse;
 
 		case 'F':	/* The date as %Y-%m-%d. */
 			new_fmt = %Y-%m-%d;
 			LEGAL_ALT(0);
+			flags |= FLAG_MONTH | FLAG_MDAY | FLAG_YEAR;
 			goto recurse;
 
 		case 'R':	/* The time as %H:%M. */
@@ -166,6 +198,7 @@ literal:
 
 		case 'x':	/* The date, using the locale's format. */
 			new_fmt = _TIME_LOCALE(loc)-d_fmt;
+			flags |= FLAG_MONTH | FLAG_MDAY | FLAG_YEAR;
 		recurse:
 			bp = (const u_char *)strptime((const char *)bp,
 			new_fmt, tm);
@@ -180,6 +213,7 @@ literal:
 			bp = find_string(bp, tm-tm_wday,
 			_TIME_LOCALE(loc)-day, _TIME_LOCALE(loc)-abday, 7);
 			LEGAL_ALT(0);
+			flags |= FLAG_WDAY;
 			continue;
 
 		case 'B':	/* The month, using the locale's form. */
@@ -189,6 +223,7 @@ literal:
 			_TIME_LOCALE(loc)-mon, _TIME_LOCALE(loc)-abmon,
 			12);
 			LEGAL_ALT(0);
+			flags |= FLAG_MONTH;
 			continue;
 
 		case 'C':	/* The century number. */
@@ -201,12 +236,14 @@ literal:
 			split_year = 1;
 			tm-tm_year = i;
 			LEGAL_ALT(ALT_E);
+			flags |= FLAG_YEAR;
 			continue;
 
 		case 'd':	/* The day of month. */
 		case 'e':
 			bp = conv_num(bp, tm-tm_mday, 1, 31);
 			LEGAL_ALT(ALT_O);
+			flags |= FLAG_MDAY;
 			continue;
 
 		case 'k':	/* The hour (24-hour clock representation). */
@@ -232,6 +269,7 @@ literal:
 			bp = conv_num(bp, i, 1, 366);
 			tm-tm_yday = i - 1;
 			LEGAL_ALT(0);
+			flags |= FLAG_YDAY;
 			continue;
 
 		case 'M':	/* The minute. */
@@ -244,6 +282,7 @@ literal:
 			bp = conv_num(bp, i, 1, 12);
 			tm-tm_mon = i - 1;
 			LEGAL_ALT(ALT_O);
+			flags |= FLAG_MONTH;
 			continue;
 
 		case 'p':	/* The locale's equivalent of AM/PM. */
@@ -287,6 +326,9 @@ literal:
 
 if (localtime_r(sse, tm) == NULL)
 	bp = NULL;
+else
+	flags |= FLAG_YDAY | FLAG_WDAY |
+	FLAG_MONTH | FLAG_MDAY | 

CVS commit: src/lib/libc/time

2015-06-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 22 17:43:23 UTC 2015

Modified Files:
src/lib/libc/time: private.h

Log Message:
don't define statics we don't need


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/time/private.h

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/private.h
diff -u src/lib/libc/time/private.h:1.41 src/lib/libc/time/private.h:1.42
--- src/lib/libc/time/private.h:1.41	Sun Jun 21 12:06:51 2015
+++ src/lib/libc/time/private.h	Mon Jun 22 13:43:23 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: private.h,v 1.41 2015/06/21 16:06:51 christos Exp $	*/
+/*	$NetBSD: private.h,v 1.42 2015/06/22 17:43:23 christos Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -501,9 +501,11 @@ time_t time2posix_z(timezone_t __restric
 #define MINVAL(t, b)		\
   ((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
 
+#ifdef LOCALTIME_IMPLEMENTATION
 /* The minimum and maximum finite time values.  This assumes no padding.  */
 static time_t const time_t_min = MINVAL(time_t, TYPE_BIT(time_t));
 static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
+#endif
 
 #ifndef INT_STRLEN_MAXIMUM
 /*



CVS commit: src/lib/libc/time

2015-06-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 21 16:06:51 UTC 2015

Modified Files:
src/lib/libc/time: Makefile NEWS localtime.c private.h tzselect.ksh
zdump.c zic.8 zic.c

Log Message:
merge tzcode2015e:

  Changes affecting code

When displaying data, tzselect converts it to the current locale's
encoding if the iconv command works.  (Problem reported by random832.)

tzselect no longer mishandles Dominica, fixing a bug introduced
in Release 2014f.  (Problem reported by Owen Leibman.)

zic -l no longer fails when compiled with -DTZDEFAULT=\/etc/localtime\.
This fixes a bug introduced in Release 2014f.
(Problem reported by Leonardo Chiquitto.)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/time/Makefile
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/NEWS
cvs rdiff -u -r1.94 -r1.95 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/private.h \
src/lib/libc/time/zdump.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/tzselect.ksh
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/time/zic.8
cvs rdiff -u -r1.53 -r1.54 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.28 src/lib/libc/time/Makefile:1.29
--- src/lib/libc/time/Makefile:1.28	Tue Apr 28 13:00:24 2015
+++ src/lib/libc/time/Makefile	Sun Jun 21 12:06:51 2015
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2015d
+VERSION=	2015e
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -293,23 +293,24 @@ TAB_CHAR=	'	'
 SAFE_CHARSET1=	$(TAB_CHAR)' !\'$$sharp'$$%'\''()*+,./0123456789:;=?@'
 SAFE_CHARSET2=	'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`'
 SAFE_CHARSET3=	'abcdefghijklmnopqrstuvwxyz{|}~'
-SAFE_CHARSET=	]$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)-
-SAFE_CHAR=	'['$(SAFE_CHARSET)']'
-# NONSYM_CHAR is a regular expression that matches any character
-# except for a small number of symbols, where we prefer to stick with
+SAFE_CHARSET=	$(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
+SAFE_CHAR=	'[]'$(SAFE_CHARSET)'-]'
+
+# OK_CHAR matches any character allowed in the distributed files.
+# This is the same as SAFE_CHAR, except that multibyte letters are
+# also allowed so that commentary can contain people's names and quote
+# non-English sources.  For non-letters the sources are limited to
 # ASCII renderings for the convenience of maintainers whose text editors
 # mishandle UTF-8 by default (e.g., XEmacs 21.4.22).
-NONSYM_CHAR=	'[^–—°′″≈≠≤≥±−×÷∞←→↔·•§¶«»‘’‚‛“”„‟‹›「」『』〝〞〟]'
+OK_CHAR=	'[][:alpha:]'$(SAFE_CHARSET)'-]'
 
 # SAFE_LINE matches a line of safe characters.
-# SAFE_SHARP_LINE is similar, except any character can follow '#';
+# SAFE_SHARP_LINE is similar, except any OK character can follow '#';
 # this is so that comments can contain non-ASCII characters.
-# NONSYM_LINE matches a line of non-symbols.
-# VALID_LINE matches a line of any validly-encoded characters.
+# OK_LINE matches a line of OK characters.
 SAFE_LINE=	'^'$(SAFE_CHAR)'*$$'
-SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(NONSYM_CHAR)'*)?$$'
-NONSYM_LINE=	'^'$(NONSYM_CHAR)'*$$'
-VALID_LINE=	'^.*$$'
+SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$'
+OK_LINE=	'^'$(OK_CHAR)'*$$'
 
 # Flags to give 'tar' when making a distribution.
 # Try to use flags appropriate for GNU tar.
@@ -324,6 +325,8 @@ GZIPFLAGS=	-9 ${GZIP_N_FLAG}
 
 ###
 
+#MAKE=		make
+
 cc=		cc
 CC=		$(cc) -DTZDIR=\$(TZDIR)\
 
@@ -372,7 +375,7 @@ SHELL=		/bin/sh
 
 all:		tzselect zic zdump libtz.a $(TABDATA)
 
-ALL:		all date
+ALL:		all date $(ENCHILADA)
 
 install:	all $(DATA) $(REDO) $(MANS)
 		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
@@ -476,14 +479,11 @@ check:		check_character_set check_white_
 check_character_set: $(ENCHILADA)
 		LC_ALL=en_US.utf8  export LC_ALL  \
 		sharp='#'  \
-		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
+		! grep -Env $(SAFE_LINE) Makefile $(MANS) date.1 $(MANTXTS) \
 			$(MISC) $(SOURCES) $(WEB_PAGES)  \
 		! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \
-			iso3166.tab leapseconds yearistype.sh zone.tab  \
-		test $$(grep -Ecv $(SAFE_SHARP_LINE) Makefile) -eq 1  \
-		! grep -Env $(NONSYM_LINE) CONTRIBUTING NEWS README Theory \
-			$(MANS) date.1 zone1970.tab  \
-		! grep -Env $(VALID_LINE) $(ENCHILADA)
+			leapseconds yearistype.sh zone.tab  \
+		! grep -Env $(OK_LINE) $(ENCHILADA)
 
 check_white_space: $(ENCHILADA)
 		! grep -En ' '$(TAB_CHAR)|$$(printf '[\f\r\v]') $(ENCHILADA)
@@ -574,9 +574,9 @@ set-timestamps.out: $(ENCHILADA)
 # The zics below ensure that each data file can stand on its own.
 # We also do an all-files run to catch links to links.
 
-check_public:	$(ENCHILADA)
-		make maintainer-clean
-		make CFLAGS=$(GCC_DEBUG_FLAGS) $(ENCHILADA) 

CVS commit: src/lib/libc/time

2015-04-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 28 17:00:24 UTC 2015

Modified Files:
src/lib/libc/time: Makefile NEWS private.h tz-link.htm zic.c
Removed Files:
src/lib/libc/time: ialloc.c scheck.c

Log Message:
welcome to tzcode 2015d (zic performance improvements and cleanups)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/Makefile
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/NEWS
cvs rdiff -u -r1.9 -r0 src/lib/libc/time/ialloc.c
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/private.h
cvs rdiff -u -r1.12 -r0 src/lib/libc/time/scheck.c
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.52 -r1.53 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.27 src/lib/libc/time/Makefile:1.28
--- src/lib/libc/time/Makefile:1.27	Tue Mar 24 16:01:18 2015
+++ src/lib/libc/time/Makefile	Tue Apr 28 13:00:24 2015
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2015b
+VERSION=	2015d
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -120,6 +120,7 @@ LDLIBS=
 #  -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with stdint.h
 #  -DHAVE_STRFTIME_L=1 if time.h declares locale_t and strftime_l
 #	This defaults to 0 if _POSIX_VERSION  200809, 1 otherwise.
+#  -DHAVE_STRDUP=0 if your system lacks the strdup function
 #  -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
@@ -150,18 +151,18 @@ LDLIBS=
 #  $(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 \
+	-Wbad-function-cast -Wcast-align -Wdate-time \
 	-Wdeclaration-after-statement \
+	-Wdouble-promotion \
 	-Wformat=2 -Winit-self -Wjump-misses-init \
-	-Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
-	-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 \
+	-Wlogical-op -Wmissing-prototypes -Wnested-externs \
+	-Wold-style-definition -Woverlength-strings -Wpointer-arith \
 	-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
 	-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
 	-Wsuggest-attribute=pure -Wtrampolines \
-	-Wwrite-strings
+	-Wunused -Wwrite-strings \
+	-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
+	-Wno-type-limits -Wno-unused-parameter
 #
 # If you want to use System V compatibility code, add
 #	-DUSG_COMPAT
@@ -331,13 +332,13 @@ AR=		ar
 # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
 RANLIB=		:
 
-TZCOBJS=	zic.o scheck.o ialloc.o
+TZCOBJS=	zic.o
 TZDOBJS=	zdump.o localtime.o asctime.o
 DATEOBJS=	date.o localtime.o strftime.o asctime.o
 LIBSRCS=	localtime.c asctime.c difftime.c
 LIBOBJS=	localtime.o asctime.o difftime.o
 HEADERS=	tzfile.h private.h
-NONLIBSRCS=	zic.c zdump.c scheck.c ialloc.c
+NONLIBSRCS=	zic.c zdump.c
 NEWUCBSRCS=	date.c strftime.c
 SOURCES=	$(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
 			tzselect.ksh workman.sh
@@ -655,9 +656,7 @@ zonenames:	$(TDATA)
 asctime.o:	private.h tzfile.h
 date.o:		private.h
 difftime.o:	private.h
-ialloc.o:	private.h
 localtime.o:	private.h tzfile.h
-scheck.o:	private.h
 strftime.o:	private.h tzfile.h
 zdump.o:	version.h
 zic.o:		private.h tzfile.h version.h

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.10 src/lib/libc/time/NEWS:1.11
--- src/lib/libc/time/NEWS:1.10	Tue Mar 24 16:01:18 2015
+++ src/lib/libc/time/NEWS	Tue Apr 28 13:00:24 2015
@@ -1,5 +1,79 @@
 News for the tz database
 
+Release 2015d - 2015-04-24 08:09:46 -0700
+
+  Changes affecting future time stamps
+
+Egypt will not observe DST in 2015 and will consider canceling it
+permanently.  For now, assume no DST indefinitely.
+(Thanks to Ahmed Nazmy and Tim Parenti.)
+
+  Changes affecting past time stamps
+
+America/Whitehorse switched from UTC-9 to UTC-8 on 1967-05-28, not
+1966-07-01.  Also, Yukon's time zone history is documented better.
+(Thanks to Brian Inglis and Dennis Ferguson.)
+
+  Change affecting past and future time zone abbreviations
+
+The abbreviations for Hawaii-Aleutian standard and daylight times
+have been changed from HAST/HADT to HST/HDT, as per US Government
+Printing Office style.  This affects only America/Adak since 1983,
+as America/Honolulu was already using the new style.
+
+  Changes affecting code
+
+   zic has some minor performance improvements.
+
+
+Release 2015c - 2015-04-11 08:55:55 -0700
+
+  Changes affecting future time stamps
+
+Egypt's 

CVS commit: src/lib/libc/time

2015-04-06 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Mon Apr  6 14:38:22 UTC 2015

Modified Files:
src/lib/libc/time: strptime.3 strptime.c

Log Message:
Add UTC as a synonym for GMT (%Z).  [from FreeBSD]


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/time/strptime.3
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/strptime.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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.30 src/lib/libc/time/strptime.3:1.31
--- src/lib/libc/time/strptime.3:1.30	Fri Apr  3 15:52:50 2015
+++ src/lib/libc/time/strptime.3	Mon Apr  6 14:38:22 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: strptime.3,v 1.30 2015/04/03 15:52:50 ginsbach Exp $
+.\	$NetBSD: strptime.3,v 1.31 2015/04/06 14:38:22 ginsbach Exp $
 .\
 .\ Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -26,7 +26,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April  3, 2015
+.Dd April  6, 2015
 .Dt STRPTIME 3
 .Os
 .Sh NAME
@@ -335,8 +335,10 @@ The
 .Cm \%Z
 format specifier only accepts time zone
 abbreviations of the local time zone,
-or the value
-.Dq GMT .
+or the values
+.Dq GMT
+or
+.Dq UTC .
 This limitation is caused by the ambiguity
 of overloaded time zone abbreviations,
 for example EST is both Eastern Standard

Index: src/lib/libc/time/strptime.c
diff -u src/lib/libc/time/strptime.c:1.38 src/lib/libc/time/strptime.c:1.39
--- src/lib/libc/time/strptime.c:1.38	Fri May 17 12:55:57 2013
+++ src/lib/libc/time/strptime.c	Mon Apr  6 14:38:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.38 2013/05/17 12:55:57 joerg Exp $	*/
+/*	$NetBSD: strptime.c,v 1.39 2015/04/06 14:38:22 ginsbach 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.38 2013/05/17 12:55:57 joerg Exp $);
+__RCSID($NetBSD: strptime.c,v 1.39 2015/04/06 14:38:22 ginsbach Exp $);
 #endif
 
 #include namespace.h
@@ -357,7 +357,8 @@ literal:
 
 		case 'Z':
 			tzset();
-			if (strncmp((const char *)bp, gmt, 3) == 0) {
+			if (strncmp((const char *)bp, gmt, 3) == 0 ||
+			strncmp((const char *)bp, utc, 3) == 0) {
 tm-tm_isdst = 0;
 #ifdef TM_GMTOFF
 tm-TM_GMTOFF = 0;



CVS commit: src/lib/libc/time

2015-04-05 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr  5 08:36:38 UTC 2015

Modified Files:
src/lib/libc/time: tzset.3

Log Message:
Remove dangling cross-ref to localtime(3).  There's another cross-ref in
the next sentence that actually makes sense.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/tzset.3

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/tzset.3
diff -u src/lib/libc/time/tzset.3:1.31 src/lib/libc/time/tzset.3:1.32
--- src/lib/libc/time/tzset.3:1.31	Thu Oct 23 18:45:58 2014
+++ src/lib/libc/time/tzset.3	Sun Apr  5 08:36:38 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: tzset.3,v 1.31 2014/10/23 18:45:58 christos Exp $
+.\	$NetBSD: tzset.3,v 1.32 2015/04/05 08:36:38 pgoyette Exp $
 .Dd October 23, 2014
 .Dt TZSET 3
 .Os
@@ -103,7 +103,6 @@ If the implied call to
 fails,
 .Fn tzset
 falls back on UTC.
-.Xr localtime 3 .
 If
 .Ev TZ
 is



CVS commit: src/lib/libc/time

2015-04-03 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Fri Apr  3 15:52:51 UTC 2015

Modified Files:
src/lib/libc/time: strptime.3

Log Message:
Fix spelling; time zone is two words not one.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/time/strptime.3

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/strptime.3
diff -u src/lib/libc/time/strptime.3:1.29 src/lib/libc/time/strptime.3:1.30
--- src/lib/libc/time/strptime.3:1.29	Tue Apr 12 08:40:34 2011
+++ src/lib/libc/time/strptime.3	Fri Apr  3 15:52:50 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: strptime.3,v 1.29 2011/04/12 08:40:34 jruoho Exp $
+.\	$NetBSD: strptime.3,v 1.30 2015/04/03 15:52:50 ginsbach Exp $
 .\
 .\ Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -26,7 +26,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 12, 2011
+.Dd April  3, 2015
 .Dt STRPTIME 3
 .Os
 .Sh NAME
@@ -221,7 +221,7 @@ with \%C, specifies the year [0,99] wit
 .It Cm \%Y
 the year, including the century (i.e., 1996).
 .It Cm \%z
-an ISO 8601 or RFC-2822 timezone specification.
+an ISO 8601 or RFC-2822 time zone specification.
 This is one of the following:
 the offset from
 Coordinated Universal Time
@@ -240,7 +240,7 @@ specified as:
 or
 .Dq Z
 .Pq Ql Zulu Time ;
-a three character US timezone specified as:
+a three character US time zone specified as:
 .Dq EDT ,
 .Dq EST ,
 .Dq CDT ,
@@ -271,7 +271,7 @@ or
 .Ql Standard
 .Pq Dq S
 time;
-a single letter military timezone specified as:
+a single letter military time zone specified as:
 .Dq A
 through
 .Dq I
@@ -285,7 +285,7 @@ A
 extension.
 .Pc
 .It Cm \%Z
-timezone name or no characters when time zone information is unavailable.
+time zone name or no characters when time zone information is unavailable.
 .Po
 A
 .Nx
@@ -333,11 +333,11 @@ function conforms to
 .Sh BUGS
 The
 .Cm \%Z
-format specifier only accepts timezone
-abbreviations of the local timezone,
+format specifier only accepts time zone
+abbreviations of the local time zone,
 or the value
 .Dq GMT .
 This limitation is caused by the ambiguity
-of overloaded timezone abbreviations,
+of overloaded time zone abbreviations,
 for example EST is both Eastern Standard
 Time and Eastern Australia Summer Time.



CVS commit: src/lib/libc/time

2015-03-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 24 20:01:18 UTC 2015

Modified Files:
src/lib/libc/time: Makefile NEWS Theory localtime.c private.h

Log Message:
merge 2015b


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libc/time/Makefile
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/NEWS
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/Theory
cvs rdiff -u -r1.93 -r1.94 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/private.h

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.26 src/lib/libc/time/Makefile:1.27
--- src/lib/libc/time/Makefile:1.26	Sat Jan 31 13:55:17 2015
+++ src/lib/libc/time/Makefile	Tue Mar 24 16:01:18 2015
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2015a
+VERSION=	2015b
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -486,8 +486,7 @@ check_character_set: $(ENCHILADA)
 
 check_white_space: $(ENCHILADA)
 		! grep -En ' '$(TAB_CHAR)|$$(printf '[\f\r\v]') $(ENCHILADA)
-		! grep -n '[[:space:]]$$' \
-			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
+		! grep -n '[[:space:]]$$' $(ENCHILADA)
 
 CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i=n; i++) print a[1], a[i]; }
 

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.9 src/lib/libc/time/NEWS:1.10
--- src/lib/libc/time/NEWS:1.9	Sat Jan 31 13:55:17 2015
+++ src/lib/libc/time/NEWS	Tue Mar 24 16:01:18 2015
@@ -1,5 +1,53 @@
 News for the tz database
 
+Release 2015b - 2015-03-19 23:28:11 -0700
+
+  Changes affecting future time stamps
+
+Mongolia will start observing DST again this year, from the last
+Saturday in March at 02:00 to the last Saturday in September at 00:00.
+(Thanks to Ganbold Tsagaankhuu.)
+
+Palestine will start DST on March 28, not March 27.  Also,
+correct the fall 2014 transition from September 26 to October 24.
+Adjust future predictions accordingly.  (Thanks to Steffen Thorsen.)
+
+  Changes affecting past time stamps
+
+The 1982 zone shift in Pacific/Easter has been corrected, fixing a 2015a
+regression.  (Thanks to Stuart Bishop for reporting the problem.)
+
+Some more zones have been turned into links, when they differed
+from existing zones only for older time stamps.  As usual,
+these changes affect UTC offsets in pre-1970 time stamps only.
+Their old contents have been moved to the 'backzone' file.
+The affected zones are: America/Antigua, America/Cayman,
+Pacific/Midway, and Pacific/Saipan.
+
+  Changes affecting time zone abbreviations
+
+Correct the 1992-2010 DST abbreviation in Volgograd from MSK to MSD.
+(Thanks to Hank W.)
+
+  Changes affecting code
+
+Fix integer overflow bug in reference 'mktime' implementation.
+(Problem reported by Jörg Richter.)
+
+Allow -Dtime_tz=time_t compilations, and allow -Dtime_tz=... libraries
+to be used in the same executable as standard-library time_t functions.
+(Problems reported by Bradley White.)
+
+  Changes affecting commentary
+
+Cite the recent Mexican decree changing Quintana Roo's time zone.
+(Thanks to Carlos Raúl Perasso.)
+
+Likewise for the recent Chilean decree.  (Thanks to Eduardo Romero Urra.)
+
+Update info about Mars time.
+
+
 Release 2015a - 2015-01-29 22:35:20 -0800
 
   Changes affecting future time stamps

Index: src/lib/libc/time/Theory
diff -u src/lib/libc/time/Theory:1.16 src/lib/libc/time/Theory:1.17
--- src/lib/libc/time/Theory:1.16	Tue Oct  7 17:51:03 2014
+++ src/lib/libc/time/Theory	Tue Mar 24 16:01:18 2015
@@ -717,9 +717,11 @@ Mittelalters und der Neuzeit_, herausgeg
 
 - Time and time zones on Mars -
 
-Some people have adjusted their work schedules to fit Mars time.
-Dozens of special Mars watches were built for Jet Propulsion
-Laboratory workers who kept Mars time during the Mars Exploration
+Some people's work schedules use Mars time.  Jet Propulsion Laboratory
+(JPL) coordinators have kept Mars time on and off at least since 1997
+for the Mars Pathfinder mission.  Some of their family members have
+also adapted to Mars time.  Dozens of special Mars watches were built
+for JPL workers who kept Mars time during the Mars Exploration
 Rovers mission (2004).  These timepieces look like normal Seikos and
 Citizens but use Mars seconds rather than terrestrial seconds.
 
@@ -760,6 +762,8 @@ Jia-Rui Chong, Workdays Fit for a Marti
 http://articles.latimes.com/2004/jan/14/science/sci-marstime14
 (2004-01-14), pp A1, A20-A21.
 
+Tom Chmielewski, Jet Lag Is Worse on Mars, The Atlantic (2015-02-26)
+http://www.theatlantic.com/technology/archive/2015/02/jet-lag-is-worse-on-mars/386033/
 
 -
 Local Variables:

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.93 src/lib/libc/time/localtime.c:1.94
--- 

CVS commit: src/lib/libc/time

2015-01-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 31 18:55:17 UTC 2015

Modified Files:
src/lib/libc/time: Makefile NEWS localtime.c tz-art.htm tz-link.htm
tzselect.ksh

Log Message:
merge tzcode2015a:

tzalloc now scrubs time zone abbreviations compatibly with the way
that tzset always has, by replacing invalid bytes with '_' and by
shortening too-long abbreviations.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/time/Makefile
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/NEWS src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.92 -r1.93 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/tzselect.ksh

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.25 src/lib/libc/time/Makefile:1.26
--- src/lib/libc/time/Makefile:1.25	Mon Nov 17 20:58:59 2014
+++ src/lib/libc/time/Makefile	Sat Jan 31 13:55:17 2015
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2014j
+VERSION=	2015a
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -360,7 +360,7 @@ TABDATA=	iso3166.tab leapseconds $(ZONET
 LEAP_DEPS=	leapseconds.awk leap-seconds.list
 DATA=		$(YDATA) $(NDATA) backzone $(TABDATA) \
 			leap-seconds.list yearistype.sh
-AWK_SCRIPTS=	checktab.awk leapseconds.awk
+AWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk
 MISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
 ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
 
@@ -469,7 +469,7 @@ tzselect:	tzselect.ksh
 			$? $@
 		chmod +x $@
 
-check:		check_character_set check_white_space check_sorted \
+check:		check_character_set check_white_space check_links check_sorted \
 		  check_tables check_web
 
 check_character_set: $(ENCHILADA)
@@ -485,9 +485,9 @@ check_character_set: $(ENCHILADA)
 		! grep -Env $(VALID_LINE) $(ENCHILADA)
 
 check_white_space: $(ENCHILADA)
-		! grep -n ' '$(TAB_CHAR) $(ENCHILADA)
-		! grep -n '[[:space:]]$$' $(ENCHILADA)
-		! grep -n $$(printf '[\f\r\v]\n') $(ENCHILADA)
+		! grep -En ' '$(TAB_CHAR)|$$(printf '[\f\r\v]') $(ENCHILADA)
+		! grep -n '[[:space:]]$$' \
+			$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
 
 CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i=n; i++) print a[1], a[i]; }
 
@@ -501,6 +501,9 @@ check_sorted: backward backzone iso3166.
 		$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
 		  LC_ALL=C sort -cu
 
+check_links:	checklinks.awk $(TDATA)
+		$(AWK) -f checklinks.awk $(TDATA)
+
 check_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
 		for tab in $(ZONETABLES); do \
 		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
@@ -663,7 +666,8 @@ zic.o:		private.h tzfile.h version.h
 .KEEP_STATE:
 
 .PHONY: ALL INSTALL all
-.PHONY: check check_character_set check_public check_sorted check_tables
+.PHONY: check check_character_set check_links
+.PHONY: check_public check_sorted check_tables
 .PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc
 .PHONY: install maintainer-clean names posix_packrat posix_only posix_right
 .PHONY: public right_only right_posix signatures tarballs typecheck

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.8 src/lib/libc/time/NEWS:1.9
--- src/lib/libc/time/NEWS:1.8	Mon Nov 17 20:58:59 2014
+++ src/lib/libc/time/NEWS	Sat Jan 31 13:55:17 2015
@@ -1,5 +1,57 @@
 News for the tz database
 
+Release 2015a - 2015-01-29 22:35:20 -0800
+
+  Changes affecting future time stamps
+
+The Mexican state of Quintana Roo, represented by America/Cancun,
+will shift from Central Time with DST to Eastern Time without DST
+on 2015-02-01 at 02:00.  (Thanks to Steffen Thorsen and Gwillim Law.)
+
+Chile will not change clocks in April or thereafter; its new standard time
+will be its old daylight saving time.  This affects America/Santiago,
+Pacific/Easter, and Antarctica/Palmer.  (Thanks to Juan Correa.)
+
+New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49.
+(Thanks to Tim Parenti.)
+
+  Changes affecting past time stamps
+
+Iceland observed DST in 1919 and 1921, and its 1939 fallback
+transition was Oct. 29, not Nov. 29.  Remove incorrect data from
+Shanks about time in Iceland between 1837 and 1908.
+
+Some more zones have been turned into links, when they differed
+from existing zones only for older time stamps.  As usual,
+these changes affect UTC offsets in pre-1970 time stamps only.
+Their old contents have been moved to the 'backzone' file.
+The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait,
+and Asia/Muscat.
+
+  Changes affecting code
+
+tzalloc now scrubs time zone abbreviations compatibly with the way
+that tzset always has, by replacing invalid bytes with '_' and by
+shortening too-long 

CVS commit: src/lib/libc/time

2014-11-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 18 01:59:00 UTC 2014

Modified Files:
src/lib/libc/time: Makefile NEWS tz-link.htm

Log Message:
welcome to 2014j


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/time/Makefile
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/time/NEWS
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/tz-link.htm

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.24 src/lib/libc/time/Makefile:1.25
--- src/lib/libc/time/Makefile:1.24	Thu Oct 23 14:45:58 2014
+++ src/lib/libc/time/Makefile	Mon Nov 17 20:58:59 2014
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2014i
+VERSION=	2014j
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.7 src/lib/libc/time/NEWS:1.8
--- src/lib/libc/time/NEWS:1.7	Thu Oct 23 14:45:58 2014
+++ src/lib/libc/time/NEWS	Mon Nov 17 20:58:59 2014
@@ -1,5 +1,36 @@
 News for the tz database
 
+Release 2014j - 2014-11-10 17:37:11 -0800
+
+  Changes affecting current and future time stamps
+
+Turks  Caicos' switch from US eastern time to UTC-4 year-round
+did not occur on 2014-11-02 at 02:00.  It's currently scheduled
+for 2015-11-01 at 02:00.  (Thanks to Chris Walton.)
+
+  Changes affecting past time stamps
+
+Many pre-1989 time stamps have been corrected for Asia/Seoul and
+Asia/Pyongyang, based on sources for the Korean-language Wikipedia
+entry for time in Korea.  (Thanks to Sanghyuk Jung.)  Also, no
+longer guess that Pyongyang mimicked Seoul time after World War II,
+as this is politically implausible.
+
+Some more zones have been turned into links, when they differed
+from existing zones only for older time stamps.  As usual,
+these changes affect UTC offsets in pre-1970 time stamps only.
+Their old contents have been moved to the 'backzone' file.
+The affected zones are: Africa/Addis_Ababa, Africa/Asmara,
+Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala,
+Africa/Mogadishu, Indian/Antananarivo, Indian/Comoro, and
+Indian/Mayotte.
+
+  Changes affecting commentary
+
+The commentary is less enthusiastic about Shanks as a source,
+and is more careful to distinguish UT from UTC.
+
+
 Release 2014i - 2014-10-21 22:04:57 -0700
 
   Changes affecting future time stamps
@@ -133,6 +164,7 @@ Release 2014g - 2014-08-28 12:31:23 -070
 
 Turks  Caicos is switching from US eastern time to UTC-4 year-round,
 modeled as a switch from EST/EDT to AST on 2014-11-02 at 02:00.
+[As noted in 2014j, this switch was later delayed.]
 
   Changes affecting past time stamps
 

Index: src/lib/libc/time/tz-link.htm
diff -u src/lib/libc/time/tz-link.htm:1.19 src/lib/libc/time/tz-link.htm:1.20
--- src/lib/libc/time/tz-link.htm:1.19	Thu Oct 23 14:45:58 2014
+++ src/lib/libc/time/tz-link.htm	Mon Nov 17 20:58:59 2014
@@ -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=2014-10-21
+meta name=DC.Date content=2014-11-09
 meta name=DC.Description
  content=Sources of information about time zones and daylight saving time
 meta name=DC.Identifier
@@ -26,10 +26,8 @@ that represent the history of local time
 for many representative locations around the globe.
 It is updated periodically to reflect changes made by political bodies
 to a href=http://en.wikipedia.org/wiki/Time_zone;time zone/a
-boundaries, a
-href=http://en.wikipedia.org/wiki/Coordinated_Universal_Time;abbr
-title=Coordinated Universal TimeUTC/abbr/a offsets, and
-a href=http://en.wikipedia.org/wiki/Daylight_saving;daylight-saving/a
+boundaries and
+a href=http://en.wikipedia.org/wiki/Daylight_saving_time;daylight-saving/a
 rules.
 This database (often called codezoneinfo/code or
 codeabbrtz/abbr/code)
@@ -38,15 +36,15 @@ including
 a href=http://www.gnu.org/software/libc/;the
 abbr title=GNU's Not UnixGNU/abbr
 C Library/a (used in
-a href=http://www.linux.org/;abbrGNU/abbr/Linux/a),
-a href=http://www.android.com/;Android/a,
-a href=https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS;Firefox
+a href=http://en.wikipedia.org/wiki/Linux;abbrGNU/abbr/Linux/a),
+a href=http://www.android.com;Android/a,
+a href=https://developer.mozilla.org/en-US/Firefox_OS;Firefox
 abbr title=Operating SystemOS/abbr/a,
-a href=http://www.freebsd.org/;Freeabbr
+a href=https://www.freebsd.org;Freeabbr
 title=Berkeley Software DistributionBSD/abbr/a,
-a href=http://netbsd.org/;NetabbrBSD/abbr/a,
-a href=http://openbsd.org/;OpenabbrBSD/abbr/a,
-a href=http://cygwin.com/;Cygwin/a,
+a href=http://netbsd.org;NetabbrBSD/abbr/a,
+a href=http://openbsd.org;OpenabbrBSD/abbr/a,
+a 

CVS commit: src/lib/libc/time

2014-11-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 11 18:46:54 UTC 2014

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
localtime did not set tm-tm_zone properly making pkgsrc emacs core-dump.
Thanks to Masanori Kanaoka.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/lib/libc/time/localtime.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/localtime.c
diff -u src/lib/libc/time/localtime.c:1.91 src/lib/libc/time/localtime.c:1.92
--- src/lib/libc/time/localtime.c:1.91	Thu Oct 23 14:45:58 2014
+++ src/lib/libc/time/localtime.c	Tue Nov 11 13:46:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.91 2014/10/23 18:45:58 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.92 2014/11/11 18:46:54 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.91 2014/10/23 18:45:58 christos Exp $);
+__RCSID($NetBSD: localtime.c,v 1.92 2014/11/11 18:46:54 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -290,6 +290,27 @@ settzname_z(timezone_t sp)
 	}
 }
 
+static char *
+setzone(const struct state *sp, const struct ttinfo *ttisp, int_fast32_t offset)
+{
+	char *zn = __UNCONST(sp-chars[ttisp-tt_abbrind]);
+	if (offset) {
+#ifdef USG_COMPAT
+		if (ttisp-tt_isdst)
+			daylight = 1;
+		if (!ttisp-tt_isdst)
+			timezone = -(ttisp-tt_gmtoff);
+#endif /* defined USG_COMPAT */
+#ifdef ALTZONE
+		if (ttisp-tt_isdst)
+			altzone = -(ttisp-tt_gmtoff);
+#endif /* defined ALTZONE */
+	}
+
+	tzname[ttisp-tt_isdst] = zn;
+	return zn;
+}
+
 static void
 settzname(void)
 {
@@ -312,21 +333,9 @@ settzname(void)
 	/*
 	** And to get the latest zone names into tzname. . .
 	*/
-	for (i = 0; i  sp-typecnt; ++i) {
-		const struct ttinfo * const	ttisp = sp-ttis[i];
+	for (i = 0; i  sp-typecnt; ++i)
+		setzone(sp, sp-ttis[i], -1);
 
-		tzname[ttisp-tt_isdst] = sp-chars[ttisp-tt_abbrind];
-#ifdef USG_COMPAT
-		if (ttisp-tt_isdst)
-			daylight = 1;
-		if (!ttisp-tt_isdst)
-			timezone = -(ttisp-tt_gmtoff);
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
-		if (ttisp-tt_isdst)
-			altzone = -(ttisp-tt_gmtoff);
-#endif /* defined ALTZONE */
-	}
 	settzname_z(sp);
 }
 
@@ -1428,23 +1437,11 @@ localsub(struct state const *sp, time_t 
 	*/
 	result = timesub(t, ttisp-tt_gmtoff, sp, tmp);
 	if (result) {
-		bool tm_isdst = ttisp-tt_isdst;
-		char *tm_zone = __UNCONST(sp-chars[ttisp-tt_abbrind]);
-		result-tm_isdst = tm_isdst;
-		if (offset) {
-		/* Always set the tzname etc. vars whose values can easily
-		   be determined, as it's too much trouble to tell whether
-		   tzset has already done it correctly.  */
-			tzname[tm_isdst] = tm_zone;
-#ifdef USG_COMPAT
-			if (!tm_isdst)
-timezone = - ttisp-tt_gmtoff;
-#endif
-#ifdef ALTZONE
-			if (tm_isdst)
-altzone = - ttisp-tt_gmtoff;
-#endif
-		}
+		char *zn = setzone(sp, ttisp, offset);
+		result-tm_isdst = ttisp-tt_isdst;
+#ifdef TM_ZONE
+		result-TM_ZONE = zn;
+#endif /* defined TM_ZONE */
 	}
 	return result;
 }



CVS commit: src/lib/libc/time

2014-10-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 23 18:45:58 UTC 2014

Modified Files:
src/lib/libc/time: Makefile NEWS asctime.c localtime.c private.h
tz-art.htm tz-link.htm tzset.3 zdump.8 zdump.c

Log Message:
merge 2014i


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/time/Makefile
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/time/NEWS
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/asctime.c
cvs rdiff -u -r1.90 -r1.91 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/private.h
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/time/tz-art.htm
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/tz-link.htm
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/time/tzset.3
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/zdump.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.23 src/lib/libc/time/Makefile:1.24
--- src/lib/libc/time/Makefile:1.23	Tue Oct  7 17:51:03 2014
+++ src/lib/libc/time/Makefile	Thu Oct 23 14:45:58 2014
@@ -5,7 +5,7 @@
 PACKAGE=	tzcode
 
 # Version numbers of the code and data distributions.
-VERSION=	2014h
+VERSION=	2014i
 
 # Email address for bug reports.
 BUGEMAIL=	t...@iana.org
@@ -129,6 +129,7 @@ LDLIBS=
 #  -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1
 #	if you do not want run time warnings about formats that may cause
 #	year 2000 grief
+#  -Dssize_t=long on ancient hosts that lack ssize_t
 #  -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires;
 #	not needed by the main-program tz code, which is single-threaded.
 #	Append other compiler flags as needed, e.g., -pthread on GNU/Linux.

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.6 src/lib/libc/time/NEWS:1.7
--- src/lib/libc/time/NEWS:1.6	Tue Oct  7 17:51:03 2014
+++ src/lib/libc/time/NEWS	Thu Oct 23 14:45:58 2014
@@ -1,5 +1,71 @@
 News for the tz database
 
+Release 2014i - 2014-10-21 22:04:57 -0700
+
+  Changes affecting future time stamps
+
+Pacific/Fiji will observe DST from 2014-11-02 02:00 to 2015-01-18 03:00.
+(Thanks to Ken Rylander for the heads-up.)  Guess that future
+years will use a similar pattern.
+
+A new Zone Pacific/Bougainville, for the part of Papua New Guinea
+that plans to switch from UTC+10 to UTC+11 on 2014-12-28 at 02:00.
+(Thanks to Kiley Walbom for the heads-up.)
+
+  Changes affecting time zone abbreviations
+
+Since Belarus is not changing its clocks even though Moscow is,
+the time zone abbreviation in Europe/Minsk is changing from FET
+to its more-traditional value MSK on 2014-10-26 at 01:00.
+(Thanks to Alexander Bokovoy for the heads-up about Belarus.)
+
+The new abbreviation IDT stands for the pre-1976 use of UT+8 in
+Indochina, to distinguish it better from ICT (UT+7).
+
+  Changes affecting past time stamps
+
+Many time stamps have been corrected for Asia/Ho_Chi_Minh before 1976
+(thanks to Trần Ngọc Quân for an indirect pointer to Trần Tiến Bình's
+authoritative book).  Asia/Ho_Chi_Minh has been added to
+zone1970.tab, to give tzselect users in Vietnam two choices,
+since north and south Vietnam disagreed after our 1970 cutoff.
+
+Asia/Phnom_Penh and Asia/Vientiane have been turned into links, as
+they differed from existing zones only for older time stamps.  As
+usual, these changes affect pre-1970 time stamps only.  Their old
+contents have been moved to the 'backzone' file.
+
+  Changes affecting code
+
+The time-related library functions now set errno on failure, and
+some crashes in the new tzalloc-related library functions have
+been fixed.  (Thanks to Christos Zoulas for reporting most of
+these problems and for suggesting fixes.)
+
+If USG_COMPAT is defined and the requested time stamp is standard time,
+the tz library's localtime and mktime functions now set the extern
+variable timezone to a value appropriate for that time stamp; and
+similarly for ALTZONE, daylight saving time, and the altzone variable.
+This change is a companion to the tzname change in 2014h, and is
+designed to make timezone and altzone more compatible with tzname.
+
+The tz library's functions now set errno to EOVERFLOW if they fail
+because the result cannot be represented.  ctime and ctime_r now
+return NULL and set errno when a time stamp is out of range, rather
+than having undefined behavior.
+
+Some bugs associated with the new 2014g functions have been fixed.
+This includes a bug that largely incapacitated the new functions
+time2posix_z and posix2time_z.  (Thanks to Christos Zoulas.)
+It also includes some uses of uninitialized variables after tzalloc.
+The new code uses the standard type 'ssize_t', which the Makefile
+now gives porting advice 

CVS commit: src/lib/libc/time

2014-10-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct 23 21:19:53 UTC 2014

Modified Files:
src/lib/libc/time: zdump.c

Log Message:
remove stray endif


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/zdump.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/zdump.c
diff -u src/lib/libc/time/zdump.c:1.39 src/lib/libc/time/zdump.c:1.40
--- src/lib/libc/time/zdump.c:1.39	Thu Oct 23 14:45:58 2014
+++ src/lib/libc/time/zdump.c	Thu Oct 23 17:19:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: zdump.c,v 1.39 2014/10/23 18:45:58 christos Exp $	*/
+/*	$NetBSD: zdump.c,v 1.40 2014/10/23 21:19:53 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.39 2014/10/23 18:45:58 christos Exp $);
+__RCSID($NetBSD: zdump.c,v 1.40 2014/10/23 21:19:53 christos Exp $);
 #endif /* !defined lint */
 
 /*
@@ -860,7 +860,6 @@ delta(struct tm *newp, struct tm *oldp)
 	result += newp-tm_sec - oldp-tm_sec;
 	return result;
 }
-#endif
 
 #ifndef TM_GMTOFF
 /* Return A-tm_yday, adjusted to compare it fairly to B-tm_yday.



  1   2   >