CVS commit: src/lib/libc/time

2024-03-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 18 16:15:24 UTC 2024

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

Log Message:
strptime(3): Declare digit d as time_t.

This doesn't make a semantic difference -- d can only take on the ten
values {0,1,2,3,4,5,6,7,8,9}, and the arithmetic with it later all
comes out the same whether the type is unsigned or time_t, even if
time_t were int32_t instead of int64_t.

But it pacifies overzealous compilers used by downstream users of
this code.  And while it's silly to use a much wider type (64-bit
signed) than is needed here to store a single digit, it doesn't
really hurt either (32-bit unsigned is much larger than needed too).

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.



CVS commit: src/lib/libc/time

2024-03-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 18 16:15:24 UTC 2024

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

Log Message:
strptime(3): Declare digit d as time_t.

This doesn't make a semantic difference -- d can only take on the ten
values {0,1,2,3,4,5,6,7,8,9}, and the arithmetic with it later all
comes out the same whether the type is unsigned or time_t, even if
time_t were int32_t instead of int64_t.

But it pacifies overzealous compilers used by downstream users of
this code.  And while it's silly to use a much wider type (64-bit
signed) than is needed here to store a single digit, it doesn't
really hurt either (32-bit unsigned is much larger than needed too).

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.65 src/lib/libc/time/strptime.c:1.66
--- src/lib/libc/time/strptime.c:1.65	Sat Mar 16 00:16:21 2024
+++ src/lib/libc/time/strptime.c	Mon Mar 18 16:15:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh Exp $	*/
+/*	$NetBSD: strptime.c,v 1.66 2024/03/18 16:15:24 riastradh 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.65 2024/03/16 00:16:21 riastradh Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.66 2024/03/18 16:15:24 riastradh Exp $");
 #endif
 
 #include "namespace.h"
@@ -348,8 +348,7 @@ literal:
 
 		case 's': {	/* seconds since the epoch */
 			const time_t TIME_MAX = __type_max(time_t);
-			time_t sse;
-			unsigned d;
+			time_t sse, d;
 
 			if (*bp < '0' || *bp > '9') {
 bp = NULL;



CVS commit: src/lib/libc/time

2024-03-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 16 00:16:21 UTC 2024

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

Log Message:
strptime(3): Reduce unnecessary indentation.

Post-fix tidying.

No functional change intended.

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.



CVS commit: src/lib/libc/time

2024-03-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 16 00:16:21 UTC 2024

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

Log Message:
strptime(3): Reduce unnecessary indentation.

Post-fix tidying.

No functional change intended.

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.64 src/lib/libc/time/strptime.c:1.65
--- src/lib/libc/time/strptime.c:1.64	Sat Mar 16 00:06:45 2024
+++ src/lib/libc/time/strptime.c	Sat Mar 16 00:16:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 riastradh Exp $	*/
+/*	$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh 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.64 2024/03/16 00:06:45 riastradh Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.65 2024/03/16 00:16:21 riastradh Exp $");
 #endif
 
 #include "namespace.h"
@@ -346,41 +346,40 @@ literal:
 			LEGAL_ALT(ALT_O);
 			continue;
 
-		case 's':	/* seconds since the epoch */
-			{
-const time_t TIME_MAX = __type_max(time_t);
-time_t sse;
-unsigned d;
+		case 's': {	/* seconds since the epoch */
+			const time_t TIME_MAX = __type_max(time_t);
+			time_t sse;
+			unsigned d;
 
-if (*bp < '0' || *bp > '9') {
-	bp = NULL;
-	continue;
-}
+			if (*bp < '0' || *bp > '9') {
+bp = NULL;
+continue;
+			}
 
-sse = *bp++ - '0';
-while (*bp >= '0' && *bp <= '9') {
-	d = *bp++ - '0';
-	if (sse > TIME_MAX/10) {
-		bp = NULL;
-		break;
-	}
-	sse *= 10;
-	if (sse > TIME_MAX - d) {
-		bp = NULL;
-		break;
-	}
-	sse += d;
+			sse = *bp++ - '0';
+			while (*bp >= '0' && *bp <= '9') {
+d = *bp++ - '0';
+if (sse > TIME_MAX/10) {
+	bp = NULL;
+	break;
 }
-if (bp == NULL)
-	continue;
-
-if (localtime_r(, tm) == NULL)
+sse *= 10;
+if (sse > TIME_MAX - d) {
 	bp = NULL;
-else
-	state |= S_YDAY | S_WDAY |
-	S_MON | S_MDAY | S_YEAR;
+	break;
+}
+sse += d;
 			}
+			if (bp == NULL)
+continue;
+
+			if (localtime_r(, tm) == NULL)
+bp = NULL;
+			else
+state |= S_YDAY | S_WDAY |
+S_MON | S_MDAY | S_YEAR;
 			continue;
+		}
 
 		case 'U':	/* The week of year, beginning on sunday. */
 		case 'W':	/* The week of year, beginning on monday. */



CVS commit: src/lib/libc/time

2024-03-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 16 00:06:46 UTC 2024

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

Log Message:
strptime(3): Avoid arithmetic overflow.

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/lib/libc/time/strptime.c:1.64
--- src/lib/libc/time/strptime.c:1.63	Mon Sep 21 15:31:54 2020
+++ src/lib/libc/time/strptime.c	Sat Mar 16 00:06:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.63 2020/09/21 15:31:54 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 riastradh 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.63 2020/09/21 15:31:54 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.64 2024/03/16 00:06:45 riastradh Exp $");
 #endif
 
 #include "namespace.h"
@@ -346,30 +346,33 @@ literal:
 			LEGAL_ALT(ALT_O);
 			continue;
 
-#ifndef TIME_MAX
-#define TIME_MAX	INT64_MAX
-#endif
 		case 's':	/* seconds since the epoch */
 			{
-time_t sse = 0;
-uint64_t rulim = TIME_MAX;
+const time_t TIME_MAX = __type_max(time_t);
+time_t sse;
+unsigned d;
 
 if (*bp < '0' || *bp > '9') {
 	bp = NULL;
 	continue;
 }
 
-do {
+sse = *bp++ - '0';
+while (*bp >= '0' && *bp <= '9') {
+	d = *bp++ - '0';
+	if (sse > TIME_MAX/10) {
+		bp = NULL;
+		break;
+	}
 	sse *= 10;
-	sse += *bp++ - '0';
-	rulim /= 10;
-} while ((sse * 10 <= TIME_MAX) &&
-	 rulim && *bp >= '0' && *bp <= '9');
-
-if (sse < 0 || (uint64_t)sse > TIME_MAX) {
-	bp = NULL;
-	continue;
+	if (sse > TIME_MAX - d) {
+		bp = NULL;
+		break;
+	}
+	sse += d;
 }
+if (bp == NULL)
+	continue;
 
 if (localtime_r(, tm) == NULL)
 	bp = NULL;



CVS commit: src/lib/libc/time

2024-03-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Mar 16 00:06:46 UTC 2024

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

Log Message:
strptime(3): Avoid arithmetic overflow.

PR lib/58041


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.



CVS commit: src/lib/libc/time

2024-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 23:03:35 UTC 2024

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

Log Message:
add casts for compat code where time_t is 32 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 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.



CVS commit: src/lib/libc/time

2024-03-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 11 23:03:35 UTC 2024

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

Log Message:
add casts for compat code where time_t is 32 bits.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 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.142 src/lib/libc/time/localtime.c:1.143
--- src/lib/libc/time/localtime.c:1.142	Thu Mar  7 15:42:04 2024
+++ src/lib/libc/time/localtime.c	Mon Mar 11 19:03:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.142 2024/03/07 20:42:04 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.143 2024/03/11 23:03:35 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.142 2024/03/07 20:42:04 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.143 2024/03/11 23:03:35 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1871,7 +1871,7 @@ timesub(const time_t *timep, int_fast32_
 	   for localtime values before 1970 when time_t is unsigned.  */
 	dayrem = (int)(tdays % DAYSPERREPEAT);
 	dayrem += dayoff % DAYSPERREPEAT;
-	y = (EPOCH_YEAR - YEARSPERREPEAT
+	y = (time_t)(EPOCH_YEAR - YEARSPERREPEAT
 	 + ((1 + dayoff / DAYSPERREPEAT + dayrem / DAYSPERREPEAT
 		 - ((dayrem % DAYSPERREPEAT) < 0)
 		 + tdays / DAYSPERREPEAT)
@@ -1884,7 +1884,7 @@ timesub(const time_t *timep, int_fast32_
 	while (year_lengths[isleap(y)] <= idays) {
 		int_fast32_t tdelta = idays / DAYSPERLYEAR;
 		int_fast32_t ydelta = tdelta + !tdelta;
-		time_t newy = y + ydelta;
+		time_t newy = (time_t)(y + ydelta);
 		register int	leapdays;
 		leapdays = (int)(leaps_thru_end_of(newy - 1) -
 			leaps_thru_end_of(y - 1));



CVS commit: src/lib/libc/time

2024-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 20:42:04 UTC 2024

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

Log Message:
pass lint on sparc64 where int_fast32_t is long.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 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.141 src/lib/libc/time/localtime.c:1.142
--- src/lib/libc/time/localtime.c:1.141	Sat Feb 17 09:54:47 2024
+++ src/lib/libc/time/localtime.c	Thu Mar  7 15:42:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.141 2024/02/17 14:54:47 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.142 2024/03/07 20:42:04 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.141 2024/02/17 14:54:47 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.142 2024/03/07 20:42:04 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -569,10 +569,10 @@ tzloadbody(char const *name, struct stat
 		   && (ttisutcnt == typecnt || ttisutcnt == 0)))
 		  return EINVAL;
 
-		sp->leapcnt = leapcnt;
-		sp->timecnt = timecnt;
-		sp->typecnt = typecnt;
-		sp->charcnt = charcnt;
+		sp->leapcnt = (int)leapcnt;
+		sp->timecnt = (int)timecnt;
+		sp->typecnt = (int)typecnt;
+		sp->charcnt = (int)charcnt;
 
 		/* Read transitions, discarding those out of time_t range.
 		   But pretend the last transition before TIME_T_MIN
@@ -605,7 +605,7 @@ tzloadbody(char const *name, struct stat
 			if (sp->types[i])
 sp->types[timecnt++] = typ;
 		}
-		sp->timecnt = timecnt;
+		sp->timecnt = (int)timecnt;
 		for (i = 0; i < sp->typecnt; ++i) {
 			register struct ttinfo *	ttisp;
 			unsigned char isdst, desigidx;
@@ -660,7 +660,7 @@ tzloadbody(char const *name, struct stat
 		leapcnt++;
 		  }
 		}
-		sp->leapcnt = leapcnt;
+		sp->leapcnt = (int)leapcnt;
 
 		for (i = 0; i < sp->typecnt; ++i) {
 			register struct ttinfo *	ttisp;
@@ -725,7 +725,7 @@ tzloadbody(char const *name, struct stat
 			  size_t tsabbrlen = strlen(tsabbr);
 			  if (j + tsabbrlen < TZ_MAX_CHARS) {
 strcpy(sp->chars + j, tsabbr);
-charcnt = (int_fast32_t)(j + tsabbrlen + 1);
+charcnt = (int)(j + tsabbrlen + 1);
 ts->ttis[i].tt_desigidx = j;
 gotabbr++;
 			  }
@@ -1878,11 +1878,11 @@ timesub(const time_t *timep, int_fast32_
 		* YEARSPERREPEAT));
 	/* idays = (tdays + dayoff) mod DAYSPERREPEAT, sans overflow.  */
 	idays = (int)(tdays % DAYSPERREPEAT);
-	idays += dayoff % DAYSPERREPEAT + 2 * DAYSPERREPEAT;
+	idays += (dayoff % DAYSPERREPEAT + 2 * DAYSPERREPEAT);
 	idays %= DAYSPERREPEAT;
 	/* Increase Y and decrease IDAYS until IDAYS is in range for Y.  */
 	while (year_lengths[isleap(y)] <= idays) {
-		int tdelta = idays / DAYSPERLYEAR;
+		int_fast32_t tdelta = idays / DAYSPERLYEAR;
 		int_fast32_t ydelta = tdelta + !tdelta;
 		time_t newy = y + ydelta;
 		register int	leapdays;
@@ -1910,7 +1910,7 @@ timesub(const time_t *timep, int_fast32_
 	  return NULL;
 	}
 #endif
-	tmp->tm_yday = idays;
+	tmp->tm_yday = (int)idays;
 	/*
 	** The "extra" mods below avoid overflow problems.
 	*/
@@ -1925,8 +1925,8 @@ timesub(const time_t *timep, int_fast32_
 		tmp->tm_wday += DAYSPERWEEK;
 	tmp->tm_hour = (int) (rem / SECSPERHOUR);
 	rem %= SECSPERHOUR;
-	tmp->tm_min = rem / SECSPERMIN;
-	tmp->tm_sec = rem % SECSPERMIN;
+	tmp->tm_min = (int)(rem / SECSPERMIN);
+	tmp->tm_sec = (int)(rem % SECSPERMIN);
 
 	/* Use "... ??:??:60" at the end of the localtime minute containing
 	   the second just before the positive leap second.  */
@@ -1935,7 +1935,7 @@ timesub(const time_t *timep, int_fast32_
 	ip = mon_lengths[isleap(y)];
 	for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon))
 		idays -= ip[tmp->tm_mon];
-	tmp->tm_mday = idays + 1;
+	tmp->tm_mday = (int)(idays + 1);
 	tmp->tm_isdst = 0;
 #ifdef TM_GMTOFF
 	tmp->TM_GMTOFF = offset;



CVS commit: src/lib/libc/time

2024-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar  7 20:42:04 UTC 2024

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

Log Message:
pass lint on sparc64 where int_fast32_t is long.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 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.



CVS commit: src/lib/libc/time

2024-02-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Feb 18 12:47:08 UTC 2024

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

Log Message:
Revert this part:

strftime %s now uses tm_gmtoff if available.  (Problem and draft
patch reported by Dag-Erling Smørgrav.)

of the tzcode2924a update.   It is bogus.   The "problem" is/was a simple
misunderstanding of what strftime(%s) is intended to output.  The "fix"
breaks it.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 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.54 src/lib/libc/time/strftime.c:1.55
--- src/lib/libc/time/strftime.c:1.54	Sat Feb 17 14:54:47 2024
+++ src/lib/libc/time/strftime.c	Sun Feb 18 12:47:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strftime.c,v 1.54 2024/02/17 14:54:47 christos Exp $	*/
+/*	$NetBSD: strftime.c,v 1.55 2024/02/18 12:47:08 kre 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.54 2024/02/17 14:54:47 christos Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.55 2024/02/18 12:47:08 kre Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -381,15 +381,11 @@ label:
 	tm.tm_mday = t->tm_mday;
 	tm.tm_mon = t->tm_mon;
 	tm.tm_year = t->tm_year;
-#ifdef TM_GMTOFF
-	mkt = timeoff(, t->TM_GMTOFF);
-#else
 	tm.tm_isdst = t->tm_isdst;
 #if defined TM_GMTOFF && ! UNINIT_TRAP
 	tm.TM_GMTOFF = t->TM_GMTOFF;
 #endif
 	mkt = mktime_z(sp, );
-#endif
 	/* If mktime fails, %s expands to the
 	   value of (time_t) -1 as a failure
 	   marker; this is better in practice



CVS commit: src/lib/libc/time

2024-02-18 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Feb 18 12:47:08 UTC 2024

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

Log Message:
Revert this part:

strftime %s now uses tm_gmtoff if available.  (Problem and draft
patch reported by Dag-Erling Smørgrav.)

of the tzcode2924a update.   It is bogus.   The "problem" is/was a simple
misunderstanding of what strftime(%s) is intended to output.  The "fix"
breaks it.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 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.



CVS commit: src/lib/libc/time

2023-12-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 23 20:48:38 UTC 2023

Modified Files:
src/lib/libc/time: Makefile NEWS README localtime.c private.h
tz-art.html tz-link.html

Log Message:
Import tzcode 2023d:

localtime.c no longer mishandles TZif files that contain a single
transition into a DST regime.  Previously, it incorrectly assumed
DST was in effect before the transition too.  (Thanks to Alois
Treindl for debugging help.)

localtime.c's timeoff no longer collides with OpenBSD 7.4.

The C code now uses _Generic only if __STDC_VERSION__ says the
compiler is C11 or later.

tzselect now optionally reads zonenow.tab, to simplify when
configuring only for timestamps dated from now on.

tzselect no longer creates temporary files.

tzselect no longer mishandles the following:

  Spaces and most other special characters in BUGEMAIL, PACKAGE,
  TZDIR, and VERSION.

  TZ strings when using mawk 1.4.3, which mishandles regular
  expressions of the form /X{2,}/.

  ISO 6709 coordinates when using an awk that lacks the GNU
  extension of newlines in -v option-arguments.

  Non UTF-8 locales when using an iconv command that lacks the GNU
  //TRANSLIT extension.

zic no longer mishandles data for Palestine after the year 2075.
Previously, it incorrectly omitted post-2075 transitions that are
predicted for just before and just after Ramadan.  (Thanks to Ken
Murchison for debugging help.)

zic now works again on Linux 2.6.16 and 2.6.17 (2006).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/time/Makefile
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/NEWS
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/README
cvs rdiff -u -r1.138 -r1.139 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.66 -r1.67 src/lib/libc/time/private.h
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/tz-link.html

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.55 src/lib/libc/time/Makefile:1.56
--- src/lib/libc/time/Makefile:1.55	Sat Sep 16 14:40:26 2023
+++ src/lib/libc/time/Makefile	Sat Dec 23 15:48:38 2023
@@ -1,7 +1,25 @@
 # Make and install tzdb code and data.
-
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
+# Request POSIX conformance; this must be the first non-comment line.
+.POSIX:
+# On older platforms you may need to scrounge for a POSIX-conforming 'make'.
+# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or
+# /usr/xpg4/bin/make, not /usr/ccs/bin/make.
+
+# To affect how this Makefile works, you can run a shell script like this:
+#
+#	#!/bin/sh
+#	make CC='gcc -std=gnu11' "$@"
+#
+# This example script is appropriate for a pre-2017 GNU/Linux system
+# where a non-default setting is needed to support this package's use of C99.
+#
+# Alternatively, you can simply edit this Makefile to tailor the following
+# macro definitions.
+
+###
+# Start of macros that one plausibly might want to tailor.
 
 # Package name for the code distribution.
 PACKAGE=	tzcode
@@ -191,8 +209,9 @@ UTF8_LOCALE=	en_US.utf8
 # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
 LDLIBS=
 
-# Add the following to the end of the "CFLAGS=" line as needed to override
-# defaults specified in the source code.  "-DFOO" is equivalent to "-DFOO=1".
+# Add the following to an uncommented "CFLAGS=" line as needed
+# to override defaults specified in the source code or by the system.
+# "-DFOO" is equivalent to "-DFOO=1".
 #  -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
 #	formats that generate only the last two digits of year numbers
 #  -DEPOCH_LOCAL if the 'time' function returns local time not UT
@@ -234,11 +253,16 @@ LDLIBS=
 #  -DHAVE_UNISTD_H=0 if  does not work*
 #  -DHAVE_UTMPX_H=0 if  does not work*
 #  -Dlocale_t=XXX if your system uses XXX instead of locale_t
-#  -DPORT_TO_C89 if tzcode should also run on C89 platforms+
+#  -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
+#	Typically it is better to use a later standard.  For example,
+#	with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
+#	Even with -DPORT_TO_C89, the code needs at least one C99
+#	feature (integers at least 64 bits wide) and maybe more.
 #  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
 #	with external linkage, e.g., applications cannot define 'localtime'.
 #  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
 #  -DSUPPORT_C89 if the tzcode library should support C89 callers+
+#	However, this might trigger latent bugs in C99-or-later callers.
 #  -DSUPPRESS_TZDIR to not prepend TZDIR to file 

CVS commit: src/lib/libc/time

2023-12-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 23 20:48:38 UTC 2023

Modified Files:
src/lib/libc/time: Makefile NEWS README localtime.c private.h
tz-art.html tz-link.html

Log Message:
Import tzcode 2023d:

localtime.c no longer mishandles TZif files that contain a single
transition into a DST regime.  Previously, it incorrectly assumed
DST was in effect before the transition too.  (Thanks to Alois
Treindl for debugging help.)

localtime.c's timeoff no longer collides with OpenBSD 7.4.

The C code now uses _Generic only if __STDC_VERSION__ says the
compiler is C11 or later.

tzselect now optionally reads zonenow.tab, to simplify when
configuring only for timestamps dated from now on.

tzselect no longer creates temporary files.

tzselect no longer mishandles the following:

  Spaces and most other special characters in BUGEMAIL, PACKAGE,
  TZDIR, and VERSION.

  TZ strings when using mawk 1.4.3, which mishandles regular
  expressions of the form /X{2,}/.

  ISO 6709 coordinates when using an awk that lacks the GNU
  extension of newlines in -v option-arguments.

  Non UTF-8 locales when using an iconv command that lacks the GNU
  //TRANSLIT extension.

zic no longer mishandles data for Palestine after the year 2075.
Previously, it incorrectly omitted post-2075 transitions that are
predicted for just before and just after Ramadan.  (Thanks to Ken
Murchison for debugging help.)

zic now works again on Linux 2.6.16 and 2.6.17 (2006).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/time/Makefile
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/NEWS
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/README
cvs rdiff -u -r1.138 -r1.139 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.66 -r1.67 src/lib/libc/time/private.h
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/tz-link.html

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



Re: CVS commit: src/lib/libc/time

2023-12-07 Thread Steffen Nurpmeso
Valery Ushakov wrote in
 :
 |On Fri, Dec 08, 2023 at 01:32:49 +0300, Valery Ushakov wrote:
 |
 |> On Thu, Dec 07, 2023 at 20:13:37 +, Robert Elz wrote:
 |>
 |>> While here, consistemntly use minus when minus is meant, rather that
 |>> just using a hyphen.
 |>
 |> One has to be careful with this.
 |
 |And to have this on record for refernce: https://lwn.net/Articles/947941/

'Could be you like that:

  https://lists.gnu.org/archive/html/groff/2022-09/msg00048.html

(or these

  https://lists.gnu.org/archive/html/groff/2022-09/msg00053.html
  https://lists.gnu.org/archive/html/groff/2022-09/msg00057.html

heck i could vomit all thread long. :-)

 |-uwe
 --End of 

Ciao.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
|
| Only in December: lightful Dubai COP28 Narendra Modi quote:
|  A small part of humanity has ruthlessly exploited nature.
|  But the entire humanity is bearing the cost of it,
|  especially the inhabitants of the Global South.
|  The selfishness of a few will lead the world into darkness,
|  not just for themselves but for the entire world.


Re: CVS commit: src/lib/libc/time

2023-12-07 Thread Valery Ushakov
On Fri, Dec 08, 2023 at 01:32:49 +0300, Valery Ushakov wrote:

> On Thu, Dec 07, 2023 at 20:13:37 +, Robert Elz wrote:
>
> > While here, consistemntly use minus when minus is meant, rather that
> > just using a hyphen.
>
> One has to be careful with this.

And to have this on record for refernce: https://lwn.net/Articles/947941/

-uwe


CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 23:42:28 UTC 2023

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

Log Message:
Fix yet another wording (editing) botch noticed by uwe@


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

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.8
diff -u src/lib/libc/time/zic.8:1.48 src/lib/libc/time/zic.8:1.49
--- src/lib/libc/time/zic.8:1.48	Thu Dec  7 23:21:21 2023
+++ src/lib/libc/time/zic.8	Thu Dec  7 23:42:28 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.48 2023/12/07 23:21:21 uwe Exp $
+.\" $NetBSD: zic.8,v 1.49 2023/12/07 23:42:28 kre Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -883,7 +883,7 @@ and Swiss daylight saving rules (defined
 .Qq "Rule Swiss"
 apply.
 From 1981 to the present, EU daylight saving rules have
-From 1981 to the present, EU daylight saving rules have
+applied, and the UTC offset has remained at one hour.
 .Pp
 In 1941 and 1942, daylight saving time applied from the first Monday
 in May at 01:00 to the first Monday in October at 02:00.



CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 23:42:28 UTC 2023

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

Log Message:
Fix yet another wording (editing) botch noticed by uwe@


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

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

2023-12-07 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Dec  7 23:21:21 UTC 2023

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

Log Message:
zic(8): missed a .Ql


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/time/zic.8

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.8
diff -u src/lib/libc/time/zic.8:1.47 src/lib/libc/time/zic.8:1.48
--- src/lib/libc/time/zic.8:1.47	Thu Dec  7 20:13:37 2023
+++ src/lib/libc/time/zic.8	Thu Dec  7 23:21:21 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.47 2023/12/07 20:13:37 kre Exp $
+.\" $NetBSD: zic.8,v 1.48 2023/12/07 23:21:21 uwe Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -126,7 +126,7 @@ are possibly signed decimal counts of se
 (1970-01-01 00:00:00 UTC).
 Omitted counts default to extreme values.
 The output files use UT offset 0 and abbreviation
-.Qq \&\-00
+.Ql \&\-00
 in place of the omitted timestamp data.
 For example,
 .Pp



CVS commit: src/lib/libc/time

2023-12-07 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Dec  7 23:21:21 UTC 2023

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

Log Message:
zic(8): missed a .Ql


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libc/time/zic.8

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



Re: CVS commit: src/lib/libc/time

2023-12-07 Thread Valery Ushakov
On Thu, Dec 07, 2023 at 20:13:37 +, Robert Elz wrote:

> While here, consistemntly use minus when minus is meant, rather that
> just using a hyphen.

One has to be careful with this.  In the literal context (Ql, Li, etc)
the ascii minus-hyphen in the input is preserved as such.  In other
contexts you will get a math minus sign in PS/PDF output, or groff
UTF-8 text output, which makes man page not copy-pastable.  And wide
(about the size of en-dash) minus sign looks rather ugly in non math
contexts like 02:00 CST (−06) in PS/PDF.

-uwe


CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 20:13:37 UTC 2023

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

Log Message:
Fix a wording botch noticed by uwe@ (and one more smaller one), and
a few more markup issues.   While here, consistemntly use minus when
minus is meant, rather that just using a hyphen.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/zic.8

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.8
diff -u src/lib/libc/time/zic.8:1.46 src/lib/libc/time/zic.8:1.47
--- src/lib/libc/time/zic.8:1.46	Thu Dec  7 16:16:03 2023
+++ src/lib/libc/time/zic.8	Thu Dec  7 20:13:37 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.46 2023/12/07 16:16:03 uwe Exp $
+.\" $NetBSD: zic.8,v 1.47 2023/12/07 20:13:37 kre Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -11,8 +11,8 @@
 .Nd timezone compiler
 .Sh SYNOPSIS
 .Nm
-.Op Fl \-version
-.Op Fl \-help
+.Op Fl Fl version
+.Op Fl Fl help
 .Op Fl b
 .Op Fl d Ar directory
 .Op Fl L Ar leapsecondfilename
@@ -32,7 +32,7 @@ specified in this input.
 If a
 .Ar file
 is
-.Ql \&- ,
+.Ql \&\- ,
 standard input is read.
 .Ss Options
 .Bl -tag -width Fl
@@ -79,7 +79,7 @@ will act as if the input contained a lin
 If
 .Ar timezone
 is
-.Ql - ,
+.Ql \&\- ,
 any already-existing link is removed.
 .It Fl L Ar leapsecondfilename
 Read leap second information from the file with the given name.
@@ -89,7 +89,7 @@ no leap second information appears in ou
 Use
 .Ar timezone Ap s
 rules when handling POSIX-format TZ strings like
-.Ql EET-2EEST
+.Ql EET\-2EEST
 that lack transition rules.
 .Nm
 will act as if the input contained a link line of the form
@@ -99,7 +99,7 @@ will act as if the input contained a lin
 Unless
 .Ar timezone
 is
-.Ql - ,
+.Ql \&\- ,
 this option is obsolete and poorly supported.
 Among other things it should not be used for timestamps after the year 2037,
 and it should not be combined with
@@ -110,7 +110,7 @@ transitions are at standard time or Univ
 If
 .Ar timezone
 is
-.Ql - ,
+.Ql \&\- ,
 any already-existing link is removed.
 .It Fl r Op Cm @ Ns Ar lo Ns Op Cm /@ Ns Ar hi
 Limit the applicability of output files
@@ -126,7 +126,7 @@ are possibly signed decimal counts of se
 (1970-01-01 00:00:00 UTC).
 Omitted counts default to extreme values.
 The output files use UT offset 0 and abbreviation
-.Qq "\*-00"
+.Qq \&\-00
 in place of the omitted timestamp data.
 For example,
 .Pp
@@ -256,13 +256,13 @@ POSIX requires at least 3, and requires 
 at least 6.
 .It
 An output file name contains a byte that is not an ASCII letter,
-.Ql - ,
+.Ql \&\- ,
 .Ql / ,
 or
 .Ql _ ;
 or it contains a file name component that contains more than 14 bytes
 or that starts with
-.Ql - .
+.Ql \&\- .
 .El
 .El
 .\"
@@ -328,13 +328,13 @@ A
 has the form
 .Pp
 .Bl -column -compact -offset indent "Rule" "NAME" "FROM" "1995" "\&*" "Apr" "lastSun" "2:00w" "1:00d" "LETTER/S"
-.It Rule	NAME	FROM	TO	\&-	IN	ON	AT	SAVE	LETTER/S
+.It Rule	NAME	FROM	TO	\&\-	IN	ON	AT	SAVE	LETTER/S
 .El
 .Pp
 For example:
 .Pp
 .Bl -column -compact -offset indent "Rule" "NAME" "FROM" "1995" "\&*" "Apr" "lastSun" "2:00w" "1:00d" "LETTER/S"
-.It Rule	US	1967	1973	\&-	Apr	lastSun	2:00w	1:00d	D
+.It Rule	US	1967	1973	\&\-	Apr	lastSun	2:00w	1:00d	D
 .El
 .Pp
 The fields that make up a rule line are:
@@ -345,7 +345,7 @@ Gives the name of the rule set that cont
 The name must start with a character that is neither an
 .Tn ASCII
 digit nor
-.Ql -
+.Ql \&\-
 nor
 .Ql + .
 To allow for future extensions,
@@ -380,16 +380,16 @@ may be used to repeat the value of the
 .Ar FROM
 field.
 .\"
-.It Cm \&-
-should be
-.Ql \&-
+.It Cm \&\-
+should always be
+.Ql \&\-
 for compatibility with older versions of
 .Nm .
 It was previously known as the
 .Ar TYPE
 field, which could contain values to allow a
 separate script to further restrict in which
-.Em types
+.Qq types
 of years the rule would apply.
 .\"
 .It Ar IN
@@ -458,9 +458,9 @@ midday, 12 hours after 00:00
 end of day, 24 hours after 00:00
 .It Li 260:00
 260 hours after 00:00
-.It Li -2:30
+.It Li \-2:30
 2.5 hours before 00:00
-.It Li -
+.It Li \-
 equivalent to 0
 .El
 .Pp
@@ -500,8 +500,7 @@ Gives the amount of time to be added to 
 effect, and whether the resulting time is standard or daylight saving.
 This field has the same format as the
 .Ar AT
-field
-.\" XXX: edito?
+field, except with a different set of suffix letters:
 .Ql s
 for standard time and
 .Ql d
@@ -534,7 +533,7 @@ or
 .Ql EDT )
 of time zone abbreviations to be used when this rule is in effect.
 If this field is
-.Ql - ,
+.Ql \&\- ,
 the variable part is null.
 .El
 .\"
@@ -585,7 +584,7 @@ alternatively, a field in the same forma
 column, giving the amount of time to be added to local standard time
 and whether the resulting time is standard or daylight saving.
 If 

CVS commit: src/lib/libc/time

2023-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 20:13:37 UTC 2023

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

Log Message:
Fix a wording botch noticed by uwe@ (and one more smaller one), and
a few more markup issues.   While here, consistemntly use minus when
minus is meant, rather that just using a hyphen.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libc/time/zic.8

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

2023-12-07 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Dec  7 16:16:03 UTC 2023

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

Log Message:
zic(8): more markup fixes

Still need to go over the tables.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/time/zic.8

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

2023-12-07 Thread Valery Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Dec  7 16:16:03 UTC 2023

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

Log Message:
zic(8): more markup fixes

Still need to go over the tables.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/time/zic.8

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.8
diff -u src/lib/libc/time/zic.8:1.45 src/lib/libc/time/zic.8:1.46
--- src/lib/libc/time/zic.8:1.45	Wed Dec  6 21:42:01 2023
+++ src/lib/libc/time/zic.8	Thu Dec  7 16:16:03 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.45 2023/12/06 21:42:01 kre Exp $
+.\" $NetBSD: zic.8,v 1.46 2023/12/07 16:16:03 uwe Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -22,7 +22,7 @@
 .Op Fl t Ar file
 .Op Fl v
 .Op Fl y Ar command
-.Op Ar Filename ...
+.Op Ar
 .Sh DESCRIPTION
 The
 .Nm
@@ -30,16 +30,15 @@ program reads text from the file(s) name
 and creates the timezone information format (TZif) files
 specified in this input.
 If a
-.Ar filename
+.Ar file
 is
-.Ar \&- ,
+.Ql \&- ,
 standard input is read.
-.Pp
-.Sh OPTIONS
-.Bl -tag -width XX -compact
-.It Fl \-version
+.Ss Options
+.Bl -tag -width Fl
+.It Fl Fl version
 Output version information and exit.
-.It Fl \-help
+.It Fl Fl help
 Output short usage message and exit.
 .It Fl b Ar bloat
 Output backward-compatibility data as specified by
@@ -47,37 +46,40 @@ Output backward-compatibility data as sp
 If
 .Ar bloat
 is
-.Dv fat ,
+.Ql fat ,
 generate additional data entries that work around potential bugs or
 incompatibilities in older software, such as software that mishandles
 the 64-bit generated data.
 If
 .Ar bloat
 is
-.Dv slim ,
+.Ql slim ,
 keep the output files small; this can help check for the bugs
 and incompatibilities.
 The default is
-.Dv slim ,
+.Ql slim ,
 as software that mishandles 64-bit data typically
 mishandles timestamps after the year 2038 anyway.
 Also see the
 .Fl r
 option for another way to alter output size.
 .It Fl d Ar directory
-Create time conversion information files in the named directory rather than
-in the standard directory named below.
+Create time conversion information files in the named
+.Ar directory
+rather than in the standard directory named below.
 .It Fl l Ar timezone
-Use the 
+Use the
 .Ar timezone
 as local time.
 .Nm
 will act as if the input contained a link line of the form
-.Dl Link	timezone	localtime
+.Pp
+.D1 Li Link Ar timezone Li localtime
+.Pp
 If
 .Ar timezone
 is
-.Dv \&- ,
+.Ql - ,
 any already-existing link is removed.
 .It Fl L Ar leapsecondfilename
 Read leap second information from the file with the given name.
@@ -85,32 +87,32 @@ If this option is not used,
 no leap second information appears in output files.
 .It Fl p Ar timezone
 Use
-.Ar timezone's
-rules when handling POSIX-format
-TZ strings like 
-.Qq EET\&-2EEST
+.Ar timezone Ap s
+rules when handling POSIX-format TZ strings like
+.Ql EET-2EEST
 that lack transition rules.
 .Nm
 will act as if the input contained a link line of the form
-.Dl Link	timezone	posixrules
+.Pp
+.D1 Li Link Ar timezone Li posixrules
 .Pp
 Unless
 .Ar timezone
 is
-.Dq \&- ,
+.Ql - ,
 this option is obsolete and poorly supported.
 Among other things it should not be used for timestamps after the year 2037,
 and it should not be combined with
-.Fl b Ar slim
+.Fl b Cm slim
 if
-.Va timezone's
+.Ar timezone Ap s
 transitions are at standard time or Universal Time (UT) instead of local time.
 If
 .Ar timezone
 is
-.Dv \&- ,
+.Ql - ,
 any already-existing link is removed.
-.It Fl r Op Ar @lo / Op Ar @hi
+.It Fl r Op Cm @ Ns Ar lo Ns Op Cm /@ Ns Ar hi
 Limit the applicability of output files
 to timestamps in the range from
 .Ar lo
@@ -127,36 +129,36 @@ The output files use UT offset 0 and abb
 .Qq "\*-00"
 in place of the omitted timestamp data.
 For example,
-.Bd -literal
-zic -r @0
-.Ed
+.Pp
+.Dl zic -r @0
+.Pp
 omits data intended for negative timestamps (i.e., before the Epoch), and
-.Bd -literal
-zic -r @0/@2147483648
-.Ed
+.Pp
+.Dl zic -r @0/@2147483648
+.Pp
 outputs data intended only for nonnegative timestamps that fit into
 31-bit signed integers.
-Or using 
+Or using
 .Xr date 1 ,
-.Bd -literal
-zic -r @$(date +%s)
-.Ed
+.Pp
+.Dl zic -r @$(date +%s)
+.Pp
 omits data intended for past timestamps.
 Although this option typically reduces the output file's size,
 the size can increase due to the need to represent the timestamp range
 boundaries, particularly if
 .Ar hi
 causes a TZif file to contain explicit entries for
-.Ar pre- hi
+.No pre- Ns Ar hi
 transitions rather than concisely representing them
 with an extended POSIX TZ string.
 Also see the
-.Fl b Ar slim
+.Fl b Cm slim
 option for another way to shrink output size.
-.It Fl R Ar @hi
+.It Fl R Cm @ Ns Ar hi
 Generate redundant trailing explicit transitions for timestamps
 

CVS commit: src/lib/libc/time

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:45:11 UTC 2023

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

Log Message:
A couple more (relatively minor) markup fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/time/zdump.8

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.8
diff -u src/lib/libc/time/zdump.8:1.24 src/lib/libc/time/zdump.8:1.25
--- src/lib/libc/time/zdump.8:1.24	Wed Dec  6 20:01:44 2023
+++ src/lib/libc/time/zdump.8	Wed Dec  6 21:45:11 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zdump.8,v 1.24 2023/12/06 20:01:44 christos Exp $
+.\" $NetBSD: zdump.8,v 1.25 2023/12/06 21:45:11 kre Exp $
 .\" @(#)zdump.8	8.2
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -48,9 +48,9 @@ For each
 on the command line,
 print the times at the two extreme time values,
 the times (if present) at and just beyond the boundaries of years that
-.BR localtime (3)
+.Xr localtime 3
 and
-.BR gmtime (3)
+.Xr gmtime 3
 can represent, and
 the times both one second before and exactly at
 each detected time discontinuity.



CVS commit: src/lib/libc/time

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:45:11 UTC 2023

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

Log Message:
A couple more (relatively minor) markup fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/time/zdump.8

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

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:42:01 UTC 2023

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

Log Message:
More markup fixes.This man page remains exceedingly ugly (particularly
relating to vertical space - which often is missing where it would be
better if it weren't, or is present and wasteful/ugly).


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/zic.8

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.8
diff -u src/lib/libc/time/zic.8:1.44 src/lib/libc/time/zic.8:1.45
--- src/lib/libc/time/zic.8:1.44	Wed Dec  6 20:01:44 2023
+++ src/lib/libc/time/zic.8	Wed Dec  6 21:42:01 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: zic.8,v 1.44 2023/12/06 20:01:44 christos Exp $
+.\" $NetBSD: zic.8,v 1.45 2023/12/06 21:42:01 kre Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
@@ -124,7 +124,7 @@ are possibly signed decimal counts of se
 (1970-01-01 00:00:00 UTC).
 Omitted counts default to extreme values.
 The output files use UT offset 0 and abbreviation
-.q "\*-00"
+.Qq "\*-00"
 in place of the omitted timestamp data.
 For example,
 .Bd -literal
@@ -441,7 +441,7 @@ equivalent to 0
 .El
 .Pp
 Although
-.I zic
+.Nm
 rounds times to the nearest integer second
 (breaking ties to the even integer), the fractions may be useful
 to other applications requiring greater precision.
@@ -464,7 +464,7 @@ in the absence of an indicator,
 local (wall clock) time is assumed.
 These forms ignore leap seconds; for example,
 if a leap second occurs at 00:59:60 local time,
-.q "1:00"
+.Qq "1:00"
 stands for 3601 seconds after local midnight instead of the usual 3600 seconds.
 The intent is that a rule line describes the instants when a
 clock/calendar set to the type of time specified in the
@@ -615,14 +615,14 @@ continuation.
 If a zone changes at the same instant that a rule would otherwise take
 effect in the earlier zone or continuation line, the rule is ignored.
 A zone or continuation line
-.I L
+.Em L
 with a named rule set starts with standard time by default:
 that is, any of
-.IR L 's
+.Em L Ns 's
 timestamps preceding
-.IR L 's
+.Em L Ns 's
 earliest rule use the rule in effect after
-.IR L 's
+.Em L Ns 's
 first transition into standard time.
 In a single zone it is an error if two rules take effect at the same
 instant, or if two zone changes take effect at the same instant.



CVS commit: src/lib/libc/time

2023-12-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Dec  6 21:42:01 UTC 2023

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

Log Message:
More markup fixes.This man page remains exceedingly ugly (particularly
relating to vertical space - which often is missing where it would be
better if it weren't, or is present and wasteful/ugly).


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/zic.8

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

2023-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec  6 20:01:44 UTC 2023

Modified Files:
src/lib/libc/time: zdump.8 zic.8

Log Message:
PR/57757: Izumi Tsutsui: Fix markup errors


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/time/zic.8

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.8
diff -u src/lib/libc/time/zdump.8:1.23 src/lib/libc/time/zdump.8:1.24
--- src/lib/libc/time/zdump.8:1.23	Wed Jul 26 05:17:20 2023
+++ src/lib/libc/time/zdump.8	Wed Dec  6 15:01:44 2023
@@ -1,9 +1,9 @@
-.\" $NetBSD: zdump.8,v 1.23 2023/07/26 09:17:20 rin Exp $
+.\" $NetBSD: zdump.8,v 1.24 2023/12/06 20:01:44 christos Exp $
 .\" @(#)zdump.8	8.2
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
 .\" .TH zdump 8
-.Dd October 22, 2021
+.Dd December 6, 2023
 .Dt ZDUMP 8
 .Os
 .Sh NAME
@@ -26,7 +26,7 @@ The
 program prints the current time in each
 .Ar timezone
 named on the command line.
-.SH OPTIONS
+.Sh OPTIONS
 .Bl -tag -width X -compact
 .It Fl \-version
 Output version information and exit.

Index: src/lib/libc/time/zic.8
diff -u src/lib/libc/time/zic.8:1.43 src/lib/libc/time/zic.8:1.44
--- src/lib/libc/time/zic.8:1.43	Sat Sep 16 14:40:26 2023
+++ src/lib/libc/time/zic.8	Wed Dec  6 15:01:44 2023
@@ -1,9 +1,9 @@
-.\" $NetBSD: zic.8,v 1.43 2023/09/16 18:40:26 christos Exp $
+.\" $NetBSD: zic.8,v 1.44 2023/12/06 20:01:44 christos Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
 .\" .TH zic 8
-.Dd September 16, 2023
+.Dd December 6, 2023
 .Dt ZIC 8
 .Os
 .Sh NAME
@@ -313,11 +313,15 @@ abbreviation must be unambiguous in cont
 .Pp
 A rule line has the form
 .Pp
-.Dl Rule	NAME	FROM	TO	\&-	IN	ON		AT		SAVE		LETTER/S
+.Bl -column -compact -offset indent "Rule" "NAME" "FROM" "1995" "\&*" "Apr" "lastSun" "2:00w" "1:00d" "LETTER/S"
+.It Rule	NAME	FROM	TO	\&-	IN	ON	AT	SAVE	LETTER/S
+.El
 .Pp
 For example:
 .Pp
-.Dl Rule	US	1967	1973	\&-	Apr	lastSun	2:00w	1:00d	D
+.Bl -column -compact -offset indent "Rule" "NAME" "FROM" "1995" "\&*" "Apr" "lastSun" "2:00w" "1:00d" "LETTER/S"
+.It Rule	US	1967	1973	\&-	Apr	lastSun	2:00w	1:00d	D
+.El
 .Pp
 The fields that make up a rule line are:
 .Bl -tag -width "LETTER/S"
@@ -507,13 +511,17 @@ If this field is
 the variable part is null.
 .El
 .Pp
-A zone line has the form
+A zone line has the form:
 .Pp
-.Dl Zone	NAME			STDOFF	RULES/SAVE	FORMAT	[UNTIL]
+.Bl -column -compact -offset indent "Zone" "Asia/Amman" "STDOFF" "RULES/SAVE" "FORMAT" "[UNTIL]"
+Zone	NAME	STDOFF	RULES/SAVE	FORMAT	[UNTIL]
+.El
 .Pp
 For example:
 .Pp
-.Dl Zone	Asia/Amman	2:00	Jordan	EE%sT	2017 Oct 27 1:00
+.Bl -column -compact -offset indent "Zone" "Asia/Amman" "STDOFF" "RULES/SAVE" "FORMAT" "[UNTIL"]
+Zone	Asia/Amman	2:00	Jordan	EE%sT	2017 Oct 27 1:00
+.El
 .Pp
 The fields that make up a zone line are:
 .Bl -tag -width "RULES/SAVE"
@@ -632,13 +640,15 @@ that would otherwise take effect in the 
 seconds is instead assumed to take effect simultaneously.
 For example:
 .Pp
-.Bl -column -compact -offset indent "# Rule" "Swiss" "FROM" "1995" "\&*" "Oct" "lastSun" "1:00u" "SAVE" "LETTER/S"
+.Bl -column -compact -offset indent "# Rule" "NAME" "FROM" "2006" "\&-" "Oct" "lastSun" "1:00" "SAVE" "LETTER/S"
 .It # Rule	NAME	FROM	TO	\&-	IN	ON	AT	SAVE	LETTER/S
 .It Rule	US	1967	2006	\&-	Oct	lastSun	2:00	0	S
 .It Rule	US	1967	1973	\&-	Apr	lastSun	2:00	1:00	D
-.It # Zone	NAMESTDOFF	RULES	FORMAT	[UNTIL]
+.El
+.Bl -column -compact -offset indent "# Zone" "America/Menominee" "STDOFF" "RULES" "FORMAT" "[UNTIL]"
+.It # Zone	NAME	STDOFF	RULES	FORMAT	[UNTIL]
 .It Zone	America/Menominee	\&-5:00	\&-	EST	1973 Apr 29 2:00
-.It		\&-6:00	US	C%sT
+.It \&	\&	\&-6:00	US	C%sT
 .El
 .Pp
 Here, an incorrect reading would be there were two clock changes on 1973-04-29,
@@ -651,11 +661,15 @@ interprets this more sensibly as a singl
 .Pp
 A link line has the form
 .Pp
-.Dl Link	TARGET			LINK-NAME
+.Bl -column -compact -offset indent "Link" "Europe/Istanbul" "Asia/Istanbul"
+.It Link	TARGET	LINK-NAME
+.El
 .Pp
 For example:
 .Pp
-.Dl Link	Europe/Istanbul	Asia/Istanbul
+.Bl -column -compact -offset indent "Link" "Europe/Istanbul" "Asia/Istanbul"
+.It Link	Europe/Istanbul	Asia/Istanbul
+.El
 .Pp
 The
 .Em TARGET
@@ -675,12 +689,12 @@ Links can chain together, although the b
 chain of one or more links does not terminate in a Zone name.
 A link line can appear before the line that defines the link target.
 For example:
-.Bl -column -offset indent ".Sy Link" ".Sy Greenwich" ".Sy G_M_T"
-.It Sy Link Ta Sy Greenwich Ta Sy G_M_T
-.It 
-.It Link Ta Sy Etc/GMT Ta Sy Greenwich
-.It Zone Ta Sy Etc/GMT 0 Ta Sy Ta Sy \*- GMT
+.Bl -column -offset indent "Link" "Greenwich" "Greenwich"
+.It Link	Greenwich	G_M_T
+.It Link	Etc/GMT	

CVS commit: src/lib/libc/time

2023-12-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec  6 20:01:44 UTC 2023

Modified Files:
src/lib/libc/time: zdump.8 zic.8

Log Message:
PR/57757: Izumi Tsutsui: Fix markup errors


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.43 -r1.44 src/lib/libc/time/zic.8

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

2023-09-12 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep 12 21:56:05 UTC 2023

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

Log Message:
ctime.3: fix merge mistake

The paragraphs about the *_r and *_z/rz functions belong at the end of
the section (or somewhere like that), not affixed to the description of
difftime in the middle of the list of functions.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 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.69 src/lib/libc/time/ctime.3:1.70
--- src/lib/libc/time/ctime.3:1.69	Sun Dec 11 17:57:23 2022
+++ src/lib/libc/time/ctime.3	Tue Sep 12 21:56:05 2023
@@ -1,9 +1,9 @@
-.\" $NetBSD: ctime.3,v 1.69 2022/12/11 17:57:23 christos Exp $
+.\" $NetBSD: ctime.3,v 1.70 2023/09/12 21:56:05 dholland Exp $
 .\"
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
 .\"
-.Dd October 22, 2022
+.Dd September 12, 2023
 .Dt CTIME 3
 .Os
 .Sh NAME
@@ -139,40 +139,6 @@ The
 function returns the difference between two calendar times,
 .Fa ( time1 No - Fa time0 ) ,
 expressed in seconds.
-.Pp
-The
-.Fn ctime_r ,
-.Fn localtime_r ,
-.Fn gmtime_r ,
-and
-.Fn asctime_r
-functions
-are like their unsuffixed counterparts, except that they accept an
-additional argument specifying where to store the result if successful.
-.Pp
-The
-.Fn ctime_rz ,
-.Fn localtime_rz ,
-and
-.Fn mktime_z
-functions
-are like their unsuffixed counterparts, except that they accept an
-extra initial
-.Ar zone
-argument specifying the timezone to be used for conversion.
-If
-.Fa zone
-is
-.Dv NULL ,
-UT is used; otherwise,
-.Fa zone
-should have been allocated by
-.Fn tzalloc
-and should not be freed until after all uses (e.g., by calls to
-.Fn strftime )
-of the filled-in
-.Fn tm_zone
-fields.
 .It Fn gmtime "clock"
 The
 .Fn gmtime
@@ -415,6 +381,40 @@ variable is optional; also, there is no 
 .Dv tzname
 will
 continue to exist in this form in future releases of this code.
+.Pp
+The
+.Fn ctime_r ,
+.Fn localtime_r ,
+.Fn gmtime_r ,
+and
+.Fn asctime_r
+functions
+are like their unsuffixed counterparts, except that they accept an
+additional argument specifying where to store the result if successful.
+.Pp
+The
+.Fn ctime_rz ,
+.Fn localtime_rz ,
+and
+.Fn mktime_z
+functions
+are like their unsuffixed counterparts, except that they accept an
+extra initial
+.Ar zone
+argument specifying the timezone to be used for conversion.
+If
+.Fa zone
+is
+.Dv NULL ,
+UT is used; otherwise,
+.Fa zone
+should have been allocated by
+.Fn tzalloc
+and should not be freed until after all uses (e.g., by calls to
+.Fn strftime )
+of the filled-in
+.Fn tm_zone
+fields.
 .Sh RETURN VALUES
 .Bl -bullet
 .It



CVS commit: src/lib/libc/time

2023-09-12 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep 12 21:56:05 UTC 2023

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

Log Message:
ctime.3: fix merge mistake

The paragraphs about the *_r and *_z/rz functions belong at the end of
the section (or somewhere like that), not affixed to the description of
difftime in the middle of the list of functions.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 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.



CVS commit: src/lib/libc/time

2023-07-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 26 09:17:20 UTC 2023

Modified Files:
src/lib/libc/time: zdump.8 zic.8

Log Message:
Fix formatting corruption for manpages from tzcode.

Comment out .TH macros, that cause mandoc(1) to run into man(7) mode.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/time/zic.8

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.8
diff -u src/lib/libc/time/zdump.8:1.22 src/lib/libc/time/zdump.8:1.23
--- src/lib/libc/time/zdump.8:1.22	Sun Dec 11 17:57:23 2022
+++ src/lib/libc/time/zdump.8	Wed Jul 26 09:17:20 2023
@@ -1,8 +1,8 @@
-.\" $NetBSD: zdump.8,v 1.22 2022/12/11 17:57:23 christos Exp $
+.\" $NetBSD: zdump.8,v 1.23 2023/07/26 09:17:20 rin Exp $
 .\" @(#)zdump.8	8.2
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
-.TH zdump 8
+.\" .TH zdump 8
 .Dd October 22, 2021
 .Dt ZDUMP 8
 .Os

Index: src/lib/libc/time/zic.8
diff -u src/lib/libc/time/zic.8:1.41 src/lib/libc/time/zic.8:1.42
--- src/lib/libc/time/zic.8:1.41	Sun Dec 11 17:57:23 2022
+++ src/lib/libc/time/zic.8	Wed Jul 26 09:17:20 2023
@@ -1,8 +1,8 @@
-.\" $NetBSD: zic.8,v 1.41 2022/12/11 17:57:23 christos Exp $
+.\" $NetBSD: zic.8,v 1.42 2023/07/26 09:17:20 rin Exp $
 .\" @(#)zic.8	8.6
 .\" This file is in the public domain, so clarified as of
 .\" 2009-05-17 by Arthur David Olson.
-.TH zic 8
+.\" .TH zic 8
 .Dd August 24, 2022
 .Dt ZIC 8
 .Os



CVS commit: src/lib/libc/time

2023-07-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 26 09:17:20 UTC 2023

Modified Files:
src/lib/libc/time: zdump.8 zic.8

Log Message:
Fix formatting corruption for manpages from tzcode.

Comment out .TH macros, that cause mandoc(1) to run into man(7) mode.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.41 -r1.42 src/lib/libc/time/zic.8

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

2023-01-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 17 13:18:03 UTC 2023

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

Log Message:
put attributes first for c23 compliance.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 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.88 src/lib/libc/time/zic.c:1.89
--- src/lib/libc/time/zic.c:1.88	Sun Jan 15 13:12:37 2023
+++ src/lib/libc/time/zic.c	Tue Jan 17 08:18:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.88 2023/01/15 18:12:37 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.89 2023/01/17 13:18:03 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -11,7 +11,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.88 2023/01/15 18:12:37 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.89 2023/01/17 13:18:03 christos Exp $");
 #endif /* !defined lint */
 
 /* Use the system 'time' function, instead of any private replacement.
@@ -3754,14 +3754,14 @@ getfields(char *cp, char **array, int ar
 	return nsubs;
 }
 
-static ATTRIBUTE_NORETURN void
+ATTRIBUTE_NORETURN static void
 time_overflow(void)
 {
 	error(_("time overflow"));
 	exit(EXIT_FAILURE);
 }
 
-static ATTRIBUTE_REPRODUCIBLE zic_t
+ATTRIBUTE_REPRODUCIBLE static zic_t
 oadd(zic_t t1, zic_t t2)
 {
 #ifdef ckd_add



CVS commit: src/lib/libc/time

2023-01-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 17 13:18:03 UTC 2023

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

Log Message:
put attributes first for c23 compliance.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 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.



CVS commit: src/lib/libc/time

2023-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 15 18:12:37 UTC 2023

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

Log Message:
Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance.
Requested by Jan-Benedict Glaw.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/NEWS
cvs rdiff -u -r1.136 -r1.137 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.64 -r1.65 src/lib/libc/time/private.h
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.87 -r1.88 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.



CVS commit: src/lib/libc/time

2023-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 15 18:12:37 UTC 2023

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

Log Message:
Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance.
Requested by Jan-Benedict Glaw.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/NEWS
cvs rdiff -u -r1.136 -r1.137 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.64 -r1.65 src/lib/libc/time/private.h
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.87 -r1.88 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.40 src/lib/libc/time/NEWS:1.41
--- src/lib/libc/time/NEWS:1.40	Sun Dec 11 12:57:23 2022
+++ src/lib/libc/time/NEWS	Sun Jan 15 13:12:37 2023
@@ -85,6 +85,11 @@ Release 2022g - 2022-11-29 08:58:31 -080
 lines are in the file 'backward'.  (Inspired by a suggestion from
 Stephen Colebourne.)
 
+On C23-compatible platforms tzcode no longer uses syntax like
+'static [[noreturn]] void usage(void);'.  Instead, it uses
+'[[noreturn]] static void usage(void);' as strict C23 requires.
+(Problem reported by Houge Langley.)
+
 
 Release 2022f - 2022-10-28 18:04:57 -0700
 

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.136 src/lib/libc/time/localtime.c:1.137
--- src/lib/libc/time/localtime.c:1.136	Sun Dec 11 12:57:23 2022
+++ src/lib/libc/time/localtime.c	Sun Jan 15 13:12:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.136 2022/12/11 17:57:23 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.137 2023/01/15 18:12:37 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.136 2022/12/11 17:57:23 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.137 2023/01/15 18:12:37 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -894,7 +894,7 @@ is_digit(char c)
 ** Return a pointer to that character.
 */
 
-static ATTRIBUTE_REPRODUCIBLE const char *
+ATTRIBUTE_REPRODUCIBLE static const char *
 getzname(register const char *strp)
 {
 	register char	c;
@@ -915,7 +915,7 @@ getzname(register const char *strp)
 ** We don't do any checking here; checking is done later in common-case code.
 */
 
-static ATTRIBUTE_REPRODUCIBLE const char *
+ATTRIBUTE_REPRODUCIBLE static const char *
 getqzname(register const char *strp, const int delim)
 {
 	register int	c;

Index: src/lib/libc/time/private.h
diff -u src/lib/libc/time/private.h:1.64 src/lib/libc/time/private.h:1.65
--- src/lib/libc/time/private.h:1.64	Sun Dec 11 12:57:23 2022
+++ src/lib/libc/time/private.h	Sun Jan 15 13:12:37 2023
@@ -1,6 +1,6 @@
 /* Private header for tzdb code.  */
 
-/*	$NetBSD: private.h,v 1.64 2022/12/11 17:57:23 christos Exp $	*/
+/*	$NetBSD: private.h,v 1.65 2023/01/15 18:12:37 christos Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -646,7 +646,7 @@ char *asctime(struct tm const *);
 char *asctime_r(struct tm const *restrict, char *restrict);
 char *ctime(time_t const *);
 char *ctime_r(time_t const *, char *);
-double difftime(time_t, time_t) ATTRIBUTE_UNSEQUENCED;
+ATTRIBUTE_UNSEQUENCED double difftime(time_t, time_t);
 size_t strftime(char *restrict, size_t, char const *restrict,
 		struct tm const *restrict);
 # if HAVE_STRFTIME_L
@@ -762,10 +762,10 @@ timezone_t tzalloc(char const *);
 void tzfree(timezone_t);
 # ifdef STD_INSPIRED
 #  if TZ_TIME_T || !defined posix2time_z
-time_t posix2time_z(timezone_t __restrict, time_t) ATTRIBUTE_REPRODUCIBLE;
+ATTRIBUTE_REPRODUCIBLE time_t posix2time_z(timezone_t __restrict, time_t);
 #  endif
 #  if TZ_TIME_T || !defined time2posix_z
-time_t time2posix_z(timezone_t __restrict, time_t) ATTRIBUTE_REPRODUCIBLE;
+ATTRIBUTE_REPRODUCIBLE time_t time2posix_z(timezone_t __restrict, time_t);
 #  endif
 # endif
 #endif

Index: src/lib/libc/time/zdump.c
diff -u src/lib/libc/time/zdump.c:1.60 src/lib/libc/time/zdump.c:1.61
--- src/lib/libc/time/zdump.c:1.60	Tue Dec 13 14:08:42 2022
+++ src/lib/libc/time/zdump.c	Sun Jan 15 13:12:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $	*/
+/*	$NetBSD: zdump.c,v 1.61 2023/01/15 18:12:37 christos Exp $	*/
 /* Dump time zone data in a textual format.  */
 
 /*
@@ -8,7 +8,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $");
+__RCSID("$NetBSD: zdump.c,v 1.61 2023/01/15 18:12:37 christos Exp $");
 #endif /* !defined lint */
 
 #ifndef NETBSD_INSPIRED
@@ -94,7 +94,7 @@ static bool	warned;
 static bool	errout;
 
 static char const *abbr(struct tm const *);
-static intmax_t	delta(struct tm *, struct tm *) ATTRIBUTE_REPRODUCIBLE;
+ATTRIBUTE_REPRODUCIBLE static intmax_t delta(struct tm *, struct tm *);
 static void 

CVS commit: src/lib/libc/time

2022-12-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 13 19:08:42 UTC 2022

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

Log Message:
Handle the case the code originally intended to handle; systems where:
SIZE_MAX < PTRDIFF_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.86 -r1.87 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/zdump.c
diff -u src/lib/libc/time/zdump.c:1.59 src/lib/libc/time/zdump.c:1.60
--- src/lib/libc/time/zdump.c:1.59	Sun Dec 11 12:57:23 2022
+++ src/lib/libc/time/zdump.c	Tue Dec 13 14:08:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: zdump.c,v 1.59 2022/12/11 17:57:23 christos Exp $	*/
+/*	$NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $	*/
 /* Dump time zone data in a textual format.  */
 
 /*
@@ -8,7 +8,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zdump.c,v 1.59 2022/12/11 17:57:23 christos Exp $");
+__RCSID("$NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $");
 #endif /* !defined lint */
 
 #ifndef NETBSD_INSPIRED
@@ -144,10 +144,10 @@ sumsize(size_t a, size_t b)
 {
 #ifdef ckd_add
   ptrdiff_t sum;
-  if (!ckd_add(, a, b) && sum <= PTRDIFF_MAX)
+  if (!ckd_add(, a, b) && sum <= (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX))
 return sum;
 #else
-  ptrdiff_t sum_max = min(PTRDIFF_MAX, SIZE_MAX);
+  ptrdiff_t sum_max = (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX);
   if (a <= sum_max && b <= sum_max - a)
 return a + b;
 #endif
@@ -269,7 +269,7 @@ tzalloc(char const *val)
 	  || SIZE_MAX < initial_envptrs)
 	size_overflow();
 #  else
-  if (initial_nenvptrs == min(PTRDIFF_MAX, SIZE_MAX) / sizeof *environ)
+  if (initial_nenvptrs == (ptrdiff_t)(min(PTRDIFF_MAX, SIZE_MAX) / sizeof *environ))
 	size_overflow();
   initial_nenvptrs++;
 #  endif

Index: src/lib/libc/time/zic.c
diff -u src/lib/libc/time/zic.c:1.86 src/lib/libc/time/zic.c:1.87
--- src/lib/libc/time/zic.c:1.86	Sun Dec 11 12:57:23 2022
+++ src/lib/libc/time/zic.c	Tue Dec 13 14:08:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.86 2022/12/11 17:57:23 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.87 2022/12/13 19:08:42 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -11,7 +11,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.86 2022/12/11 17:57:23 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.87 2022/12/13 19:08:42 christos Exp $");
 #endif /* !defined lint */
 
 /* Use the system 'time' function, instead of any private replacement.
@@ -490,10 +490,10 @@ size_sum(size_t a, size_t b)
 {
 #ifdef ckd_add
   ptrdiff_t sum;
-  if (!ckd_add(, a, b) && sum <= PTRDIFF_MAX)
+  if (!ckd_add(, a, b) && sum <= (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX))
 return sum;
 #else
-  ptrdiff_t sum_max = min(PTRDIFF_MAX, SIZE_MAX);
+  ptrdiff_t sum_max = (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX);
   if (a <= sum_max && b <= sum_max - a)
 return a + b;
 #endif
@@ -505,10 +505,10 @@ size_product(ptrdiff_t nitems, ptrdiff_t
 {
 #ifdef ckd_mul
   ptrdiff_t product;
-  if (!ckd_mul(, nitems, itemsize) && product <= PTRDIFF_MAX)
+  if (!ckd_mul(, nitems, itemsize) && product <= (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX))
 return product;
 #else
-  ptrdiff_t nitems_max = min(PTRDIFF_MAX, SIZE_MAX) / itemsize;
+  ptrdiff_t nitems_max = (ptrdiff_t)(min(PTRDIFF_MAX, SIZE_MAX) / itemsize);
   if (nitems <= nitems_max)
 return nitems * itemsize;
 #endif
@@ -564,10 +564,11 @@ grow_nitems_alloc(ptrdiff_t *nitems_allo
 #if defined ckd_add && defined ckd_mul
   ptrdiff_t product;
   if (!ckd_add(nitems_alloc, *nitems_alloc, addend)
-  && !ckd_mul(, *nitems_alloc, itemsize) && product <= PTRDIFF_MAX)
+  && !ckd_mul(, *nitems_alloc, itemsize)
+  && product <= (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX))
 return product;
 #else
-  ptrdiff_t amax = min(PTRDIFF_MAX, SIZE_MAX);
+  ptrdiff_t amax = (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX);
   if (*nitems_alloc <= ((amax - 1) / 3 * 2) / itemsize) {
 *nitems_alloc += addend;
 return *nitems_alloc * itemsize;
@@ -1413,7 +1414,7 @@ static char *
 relname(char const *target, char const *linkname)
 {
   size_t i, taillen, dir_len = 0, dotdots = 0;
-  ptrdiff_t dotdotetcsize, linksize = min(PTRDIFF_MAX, SIZE_MAX);
+  ptrdiff_t dotdotetcsize, linksize = (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX);
   char const *f = target;
   char *result = NULL;
   if (*linkname == '/') {
@@ -1688,7 +1689,7 @@ infile(int fnum, char const *name)
 	wantcont = false;
 	for (num = 1; ; ++num) {
 		enum { bufsize_bound
-		  = (min(INT_MAX, min(PTRDIFF_MAX, SIZE_MAX))
+		  = (min(INT_MAX, (ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX))
 		 / FORMAT_LEN_GROWTH_BOUND) };
 		char buf[min(_POSIX2_LINE_MAX, bufsize_bound)];
 		int nfields;



CVS commit: src/lib/libc/time

2022-12-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 13 19:08:42 UTC 2022

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

Log Message:
Handle the case the code originally intended to handle; systems where:
SIZE_MAX < PTRDIFF_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.86 -r1.87 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.



CVS commit: src/lib/libc/time

2022-12-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 11 17:57:23 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS ctime.3 localtime.c private.h
strftime.c theory.html time2posix.3 tzfile.5 tzselect.8 tzset.3
version zdump.8 zdump.c zic.8 zic.c

Log Message:
Merge in 2022g:

Although tzcode still works with C89, bugs found in recent routine
maintenance indicate that bitrot has set in and that in practice
C89 is no longer used to build tzcode.  As it is a maintenance
burden, support for C89 is planned to be removed soon.  Instead,
please use compilers compatible with C99, C11, C17, or C23.

timegm, which tzcode implemented in 1989, will finally be
standardized 34 years later as part of C23, so timegm is now
supported even if STD_INSPIRED is not defined.

Fix bug in zdump's tzalloc emulation on hosts that lack tm_zone.
(Problem reported by Đoàn Trần Công Danh.)

Fix bug in zic on hosts where malloc(0) yields NULL on success.
(Problem reported by Tim McBrayer for AIX 6.1.)

Fix zic configuration to avoid linkage failures on some platforms.
(Problems reported by Gilmore Davidson and Igor Ivanov.)

Work around MS-Windows nmake incompatibility with POSIX.
(Problem reported by Manuela Friedrich.)

Port mktime and strftime to debugging platforms where accessing
uninitialized data has undefined behavior (strftime problem
reported by Robert Elz).

Check more carefully for unlikely integer overflows, preferring
C23  to overflow checking by hand, as the latter has
had obscure bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/time/Makefile
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/NEWS
cvs rdiff -u -r1.68 -r1.69 src/lib/libc/time/ctime.3
cvs rdiff -u -r1.135 -r1.136 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.63 -r1.64 src/lib/libc/time/private.h
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/theory.html
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/time2posix.3 \
src/lib/libc/time/version
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/tzset.3
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.58 -r1.59 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/zic.8
cvs rdiff -u -r1.85 -r1.86 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.53 src/lib/libc/time/Makefile:1.54
--- src/lib/libc/time/Makefile:1.53	Sat Oct 29 09:55:50 2022
+++ src/lib/libc/time/Makefile	Sun Dec 11 12:57:23 2022
@@ -196,6 +196,7 @@ PACKRATLIST=
 UTF8_LOCALE=	en_US.utf8
 
 # Non-default libraries needed to link.
+# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0.
 LDLIBS=
 
 # Add the following to the end of the "CFLAGS=" line as needed to override
@@ -208,14 +209,18 @@ LDLIBS=
 #	For example, N is 252460800 on AmigaOS.
 #  -DHAVE_DECL_ASCTIME_R=0 if  does not declare asctime_r
 #  -DHAVE_DECL_ENVIRON if  declares 'environ'
+#  -DHAVE_DECL_TIMEGM=0 if  does not declare timegm
 #  -DHAVE_DIRECT_H if mkdir needs  (MS-Windows)
-#  -DHAVE_GENERIC=0 if _Generic does not work
-#  -DHAVE_GETRANDOM if getgrandom works (e.g., GNU/Linux)*
-#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)*
+#  -DHAVE_GENERIC=0 if _Generic does not work*
+#  -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux),
+#	-DHAVE_GETRANDOM=0 to avoid using getrandom
+#  -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris),
+#	where LDLIBS also needs to contain -lintl on some hosts;
+#	-DHAVE_GETTEXT=0 to avoid using gettext
 #  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
 #	ctime_r and asctime_r incompatibly with the POSIX standard
 #	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
-#  -DHAVE_INTTYPES_H if you have a non-C99 compiler with 
+#  -DHAVE_INTTYPES_H=0 if  does not work*
 #  -DHAVE_LINK=0 if your system lacks a link function
 #  -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function
 #  -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz
@@ -225,15 +230,17 @@ LDLIBS=
 #	functions like 'link' or variables like 'tzname' required by POSIX
 #  -DHAVE_SETENV=0 if your system lacks the setenv function
 #  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
-#  -DHAVE_STDINT_H if you have a non-C99 compiler with *
+#  -DHAVE_STDCKDINT_H=0 if neither  nor substitutes like
+#	__builtin_add_overflow work*
+#  -DHAVE_STDINT_H=0 if  does not work*
 #  -DHAVE_STRFTIME_L if  declares locale_t and strftime_l
 #  -DHAVE_STRDUP=0 if your system lacks the strdup function
 #  -DHAVE_STRTOLL=0 if your system lacks the 

CVS commit: src/lib/libc/time

2022-12-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 11 17:57:23 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS ctime.3 localtime.c private.h
strftime.c theory.html time2posix.3 tzfile.5 tzselect.8 tzset.3
version zdump.8 zdump.c zic.8 zic.c

Log Message:
Merge in 2022g:

Although tzcode still works with C89, bugs found in recent routine
maintenance indicate that bitrot has set in and that in practice
C89 is no longer used to build tzcode.  As it is a maintenance
burden, support for C89 is planned to be removed soon.  Instead,
please use compilers compatible with C99, C11, C17, or C23.

timegm, which tzcode implemented in 1989, will finally be
standardized 34 years later as part of C23, so timegm is now
supported even if STD_INSPIRED is not defined.

Fix bug in zdump's tzalloc emulation on hosts that lack tm_zone.
(Problem reported by Đoàn Trần Công Danh.)

Fix bug in zic on hosts where malloc(0) yields NULL on success.
(Problem reported by Tim McBrayer for AIX 6.1.)

Fix zic configuration to avoid linkage failures on some platforms.
(Problems reported by Gilmore Davidson and Igor Ivanov.)

Work around MS-Windows nmake incompatibility with POSIX.
(Problem reported by Manuela Friedrich.)

Port mktime and strftime to debugging platforms where accessing
uninitialized data has undefined behavior (strftime problem
reported by Robert Elz).

Check more carefully for unlikely integer overflows, preferring
C23  to overflow checking by hand, as the latter has
had obscure bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/time/Makefile
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/NEWS
cvs rdiff -u -r1.68 -r1.69 src/lib/libc/time/ctime.3
cvs rdiff -u -r1.135 -r1.136 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.63 -r1.64 src/lib/libc/time/private.h
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/time/theory.html
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/time/time2posix.3 \
src/lib/libc/time/version
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/time/tzset.3
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/zdump.8
cvs rdiff -u -r1.58 -r1.59 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/time/zic.8
cvs rdiff -u -r1.85 -r1.86 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.



CVS commit: src/lib/libc/time

2022-11-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Nov 17 17:35:25 UTC 2022

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

Log Message:
Simply set HAVE_GETRANDOM to false on __APPLE__.

Addresses PR 57083.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.62 src/lib/libc/time/private.h:1.63
--- src/lib/libc/time/private.h:1.62	Wed Nov 16 19:38:08 2022
+++ src/lib/libc/time/private.h	Thu Nov 17 17:35:25 2022
@@ -1,6 +1,6 @@
 /* Private header for tzdb code.  */
 
-/*	$NetBSD: private.h,v 1.62 2022/11/16 19:38:08 christos Exp $	*/
+/*	$NetBSD: private.h,v 1.63 2022/11/17 17:35:25 jakllsch Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -75,7 +75,10 @@
 # define HAVE_GENERIC (201112 <= __STDC_VERSION__)
 #endif
 
-#if !defined HAVE_GETRANDOM && !defined __APPLE__ && defined __has_include
+#if defined __APPLE__
+# define HAVE_GETRANDOM false
+#endif
+#if !defined HAVE_GETRANDOM && defined __has_include
 # if __has_include()
 #  define HAVE_GETRANDOM true
 # else



CVS commit: src/lib/libc/time

2022-11-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Nov 17 17:35:25 UTC 2022

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

Log Message:
Simply set HAVE_GETRANDOM to false on __APPLE__.

Addresses PR 57083.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.



CVS commit: src/lib/libc/time

2022-11-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 16 19:38:08 UTC 2022

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

Log Message:
PR/57083: Jiaxun Yang: Fix build on MacOS/X which has  but no
getrandom(3).


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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.61 src/lib/libc/time/private.h:1.62
--- src/lib/libc/time/private.h:1.61	Sat Oct 29 09:55:50 2022
+++ src/lib/libc/time/private.h	Wed Nov 16 14:38:08 2022
@@ -1,6 +1,6 @@
 /* Private header for tzdb code.  */
 
-/*	$NetBSD: private.h,v 1.61 2022/10/29 13:55:50 christos Exp $	*/
+/*	$NetBSD: private.h,v 1.62 2022/11/16 19:38:08 christos Exp $	*/
 
 #ifndef PRIVATE_H
 #define PRIVATE_H
@@ -75,7 +75,7 @@
 # define HAVE_GENERIC (201112 <= __STDC_VERSION__)
 #endif
 
-#if !defined HAVE_GETRANDOM && defined __has_include
+#if !defined HAVE_GETRANDOM && !defined __APPLE__ && defined __has_include
 # if __has_include()
 #  define HAVE_GETRANDOM true
 # else



CVS commit: src/lib/libc/time

2022-11-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 16 19:38:08 UTC 2022

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

Log Message:
PR/57083: Jiaxun Yang: Fix build on MacOS/X which has  but no
getrandom(3).


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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.



CVS commit: src/lib/libc/time

2022-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  2 12:49:10 UTC 2022

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

Log Message:
Cleaner to use if/then/else rather than a ton of casts in the ternary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 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.84 src/lib/libc/time/zic.c:1.85
--- src/lib/libc/time/zic.c:1.84	Sat Oct 29 09:55:50 2022
+++ src/lib/libc/time/zic.c	Wed Nov  2 08:49:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: zic.c,v 1.84 2022/10/29 13:55:50 christos Exp $	*/
+/*	$NetBSD: zic.c,v 1.85 2022/11/02 12:49:10 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -11,7 +11,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.84 2022/10/29 13:55:50 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.85 2022/11/02 12:49:10 christos Exp $");
 #endif /* !defined lint */
 
 /* Use the system 'time' function, instead of any private replacement.
@@ -1204,7 +1204,10 @@ get_rand_u64(void)
   s = getrandom(entropy_buffer, sizeof entropy_buffer, 0);
 while (s < 0 && errno == EINTR);
 
-nwords = s < 0 ? (size_t)-1 : s / sizeof *entropy_buffer;
+if (s < 0)
+  nwords = -1;
+else
+  nwords = s / sizeof *entropy_buffer;
   }
   if (0 < nwords)
 return entropy_buffer[--nwords];



CVS commit: src/lib/libc/time

2022-11-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  2 12:49:10 UTC 2022

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

Log Message:
Cleaner to use if/then/else rather than a ton of casts in the ternary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 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.



CVS commit: src/lib/libc/time

2022-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 29 13:55:50 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS localtime.c private.h theory.html
version zdump.c zic.8 zic.c

Log Message:
Update to tzcode2022f

  Changes to code

zic now supports links to links regardless of input line order.
For example, if Australia/Sydney is a Zone, the lines
  Link Australia/Canberra Australia/ACT
  Link Australia/Sydney Australia/Canberra
now work correctly, even though the shell commands
  ln Australia/Canberra Australia/ACT
  ln Australia/Sydney Australia/Canberra
would fail because the first command attempts to use a link
Australia/Canberra that does not exist until after the second
command is executed.  Previously, zic had unspecified behavior if
a Link line's target was another link, and zic often misbehaved if
a Link line's target was a later Link line.

Fix line number in zic's diagnostic for a link to a link.

Fix a bug that caused localtime to mishandle timestamps starting
in the year 2438 when reading data generated by 'zic -b fat' when
distant-future DST transitions occur at times given in standard
time or in UT, not the usual case of local time.  This occurs when
the corresponding .zi Rule lines specify DST transitions with TO
columns of 'max' and AT columns that end in 's' or 'u'.  The
number 2438 comes from the 32-bit limit in the year 2038, plus the
400-year Gregorian cycle.  (Problem reported by Bradley White.)

On glibc 2.34 and later, which optionally supports 64-bit time_t
on platforms like x86 where time_t was traditionally 32 bits,
default time_t to 64 instead of 32 bits.  This lets functions like
localtime support timestamps after the year 2038, and fixes
year-2038 problems in zic when accessing files dated after 2038.
To continue to limit time_t to 32 bits on these platforms, use
"make CFLAGS='-D_TIME_BITS=32'".

In C code, do not enable large-file support on platforms like AIX
and macOS that no longer need it now that tzcode does not use
off_t or related functions like 'stat'.  Large-file support is
still enabled by default on GNU/Linux, as it is needed for 64-bit
time_t support.

In C code, prefer C23 keywords to pre-C23 macros for alignof,
bool, false, and true.  Also, use the following C23 features if
available: __has_include, unreachable.

zic no longer works around Qt bug 53071, as the relevant Qt
releases have been out of support since 2019.  This change affects
only fat TZif files, as thin files never had the workaround.

zdump no longer modifies the environ vector when compiled on
platforms lacking tm_zone or when compiled with -DUSE_LTZ=0.
This avoid undefined behavior on POSIX platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/time/Makefile
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/NEWS
cvs rdiff -u -r1.134 -r1.135 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/time/private.h
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/theory.html
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/version
cvs rdiff -u -r1.57 -r1.58 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/zic.8
cvs rdiff -u -r1.83 -r1.84 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.52 src/lib/libc/time/Makefile:1.53
--- src/lib/libc/time/Makefile:1.52	Tue Aug 16 07:07:40 2022
+++ src/lib/libc/time/Makefile	Sat Oct 29 09:55:50 2022
@@ -210,7 +210,8 @@ LDLIBS=
 #  -DHAVE_DECL_ENVIRON if  declares 'environ'
 #  -DHAVE_DIRECT_H if mkdir needs  (MS-Windows)
 #  -DHAVE_GENERIC=0 if _Generic does not work
-#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)
+#  -DHAVE_GETRANDOM if getgrandom works (e.g., GNU/Linux)*
+#  -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris)*
 #  -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
 #	ctime_r and asctime_r incompatibly with the POSIX standard
 #	(Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
@@ -222,16 +223,17 @@ LDLIBS=
 #  -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure.
 #  -DHAVE_POSIX_DECLS=0 if your system's include files do not declare
 #	functions like 'link' or variables like 'tzname' required by POSIX
+#  -DHAVE_SETENV=0 if your system lacks the setenv function
 #  -DHAVE_SNPRINTF=0 if your system lacks the snprintf function
-#  -DHAVE_STDBOOL_H if you have a non-C99 compiler with 
-#  -DHAVE_STDINT_H if you have a non-C99 compiler with 
+#  -DHAVE_STDINT_H if you have a non-C99 compiler with *
 #  -DHAVE_STRFTIME_L if  declares locale_t and strftime_l
 #  -DHAVE_STRDUP=0 if your system lacks the strdup function
 #  -DHAVE_STRTOLL=0 if 

CVS commit: src/lib/libc/time

2022-10-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 29 13:55:50 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS localtime.c private.h theory.html
version zdump.c zic.8 zic.c

Log Message:
Update to tzcode2022f

  Changes to code

zic now supports links to links regardless of input line order.
For example, if Australia/Sydney is a Zone, the lines
  Link Australia/Canberra Australia/ACT
  Link Australia/Sydney Australia/Canberra
now work correctly, even though the shell commands
  ln Australia/Canberra Australia/ACT
  ln Australia/Sydney Australia/Canberra
would fail because the first command attempts to use a link
Australia/Canberra that does not exist until after the second
command is executed.  Previously, zic had unspecified behavior if
a Link line's target was another link, and zic often misbehaved if
a Link line's target was a later Link line.

Fix line number in zic's diagnostic for a link to a link.

Fix a bug that caused localtime to mishandle timestamps starting
in the year 2438 when reading data generated by 'zic -b fat' when
distant-future DST transitions occur at times given in standard
time or in UT, not the usual case of local time.  This occurs when
the corresponding .zi Rule lines specify DST transitions with TO
columns of 'max' and AT columns that end in 's' or 'u'.  The
number 2438 comes from the 32-bit limit in the year 2038, plus the
400-year Gregorian cycle.  (Problem reported by Bradley White.)

On glibc 2.34 and later, which optionally supports 64-bit time_t
on platforms like x86 where time_t was traditionally 32 bits,
default time_t to 64 instead of 32 bits.  This lets functions like
localtime support timestamps after the year 2038, and fixes
year-2038 problems in zic when accessing files dated after 2038.
To continue to limit time_t to 32 bits on these platforms, use
"make CFLAGS='-D_TIME_BITS=32'".

In C code, do not enable large-file support on platforms like AIX
and macOS that no longer need it now that tzcode does not use
off_t or related functions like 'stat'.  Large-file support is
still enabled by default on GNU/Linux, as it is needed for 64-bit
time_t support.

In C code, prefer C23 keywords to pre-C23 macros for alignof,
bool, false, and true.  Also, use the following C23 features if
available: __has_include, unreachable.

zic no longer works around Qt bug 53071, as the relevant Qt
releases have been out of support since 2019.  This change affects
only fat TZif files, as thin files never had the workaround.

zdump no longer modifies the environ vector when compiled on
platforms lacking tm_zone or when compiled with -DUSE_LTZ=0.
This avoid undefined behavior on POSIX platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/time/Makefile
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/NEWS
cvs rdiff -u -r1.134 -r1.135 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/time/private.h
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/time/theory.html
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/time/version
cvs rdiff -u -r1.57 -r1.58 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/time/zic.8
cvs rdiff -u -r1.83 -r1.84 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.



CVS commit: src/lib/libc/time

2022-10-26 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Wed Oct 26 23:22:54 UTC 2022

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

Log Message:
rephrase / clarify explanation of struct tm member normalization


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 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.



CVS commit: src/lib/libc/time

2022-10-26 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Wed Oct 26 23:22:54 UTC 2022

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

Log Message:
rephrase / clarify explanation of struct tm member normalization


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 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.67 src/lib/libc/time/ctime.3:1.68
--- src/lib/libc/time/ctime.3:1.67	Fri Oct 21 12:28:43 2022
+++ src/lib/libc/time/ctime.3	Wed Oct 26 23:22:54 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.67 2022/10/21 12:28:43 uwe Exp $
+.\" $NetBSD: ctime.3,v 1.68 2022/10/26 23:22:54 jschauma Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -255,15 +255,56 @@ components of the structure are ignored,
 and the original values of the other components are not restricted
 to their normal ranges and will be normalized,
 if need be.
+.Pp
 For example,
-October 40 is changed into November 9, a
-.Fa tm_hour
-of \-1 means 1 hour before midnight,
+consider a
+.Fa struct tm
+initialized with
+.Fa tm_year
+= 122,
+.Fa tm_mon
+= 10,
 .Fa tm_mday
-of 0 means the day preceding the current month, and
+= 30,
+.Fa tm_hour
+= 22,
+.Fa tm_min
+= 57,
+and
+.Fa tm_sec
+= 0.
+Incrementing
+.Fa tm_min
+by 13 and calling
+.Fn mktime
+would lead to
+.Fa tm_hour
+= 23 and
+.Fa tm_min
+= 10.
+.Pp
+This normalizing can lead to cascading changes:
+Again using a
+.Fa struct tm
+initialized as in the above example but with
+.Fa tm_hour
+= 23,
+the same change would lead to
 .Fa tm_mon
-of \-2 means 2 months before January of
-.Fa tm_year .
+= 11,
+.Fa tm_mday
+= 1,
+.Fa tm_hour
+= 0, and
+.Fa tm_min
+= 10.
+.Pp
+Negative values may also be normalized with similar
+cascading effect such that e.g.,
+a
+.Fa tm_hour
+of \-1 means 1 hour before midnight on the previous
+day and so on.
 .It
 A positive or zero value for
 .Fa tm_isdst



Re: CVS commit: src/lib/libc/time

2022-10-26 Thread Robert Elz
Date:Wed, 26 Oct 2022 10:42:15 -0400
From:Jan Schaumann 
Message-ID:  

  | New proposal:

That looks better (it needs some minor wording changes,
there are too many indefinite articles ('a') which aren't
needed, and there midnight should be just that, no hyphen
or space -- but that's all trivia).

kre



Re: CVS commit: src/lib/libc/time

2022-10-26 Thread Jan Schaumann
Robert Elz  wrote:
> Date:Sun, 23 Oct 2022 13:53:01 -0400
> From:Jan Schaumann 
> Message-ID:  
> 
>   | Hmm, maybe something like this?
> 
> I think there is still too much there, you don't have
> to explain everything (or almost anything), but it is
> in the right direction I think.

New proposal:

---

[...] components are not restricted to their normal
ranges and will be normalized, if need be.

For example, consider a struct tm initialized with a
tm_year = 122, tm_mon = 10, tm_mday = 30, tm_hour =
22, tm_min = 57, and a tm_sec = 0.  Incrementing
tm_min by 13 and calling mktime() would lead to a
tm_hour = 23 and tm_min = 10.

This normalizing can lead to cascading changes: Again
using a struct tm initialized as in the above example
but with a tm_hour = 23, the same change would lead to
a tm_mon = 11, tm_mday = 1, tm_hour = 0, and tm_min =
10.

Negative values may also be normalized with similar
cascading effect such that e.g., a tm_hour of −1 means
1 hour before mid‐ night on the previous day and so
on.

---

?

-Jan


CVS commit: src/lib/libc/time

2022-10-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 25 08:07:08 UTC 2022

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

Log Message:
Fix a merge or conversion problem (probably) - a .SH BUGS
(meaningless macro in mdoc) followed by the first line of the
real BUGS section somehow ended up inserted after the first
word of the STANDARDS section.   Delete the noise.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.36 src/lib/libc/time/strftime.3:1.37
--- src/lib/libc/time/strftime.3:1.36	Fri Oct  9 18:38:48 2020
+++ src/lib/libc/time/strftime.3	Tue Oct 25 08:07:07 2022
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)strftime.3	5.12 (Berkeley) 6/29/91
-.\"	$NetBSD: strftime.3,v 1.36 2020/10/09 18:38:48 christos Exp $
+.\"	$NetBSD: strftime.3,v 1.37 2022/10/25 08:07:07 kre Exp $
 .\"
 .Dd October 9, 2020
 .Dt STRFTIME 3
@@ -264,8 +264,6 @@ in a
 .Xr tm 3
 .Sh STANDARDS
 The
-.SH BUGS
-There is no conversion specification for the phase of the moon.
 .Fn strftime
 function
 conforms to



CVS commit: src/lib/libc/time

2022-10-25 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 25 08:07:08 UTC 2022

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

Log Message:
Fix a merge or conversion problem (probably) - a .SH BUGS
(meaningless macro in mdoc) followed by the first line of the
real BUGS section somehow ended up inserted after the first
word of the STANDARDS section.   Delete the noise.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.



CVS commit: src/lib/libc/time

2022-10-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Oct 24 23:18:31 UTC 2022

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

Log Message:
strptime(3): make the fact that %z is an extension more prominent

Mention it near the format itself, not on the next screen (with an
awkward indentation too).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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.37 src/lib/libc/time/strptime.3:1.38
--- src/lib/libc/time/strptime.3:1.37	Sun Feb 24 11:51:05 2019
+++ src/lib/libc/time/strptime.3	Mon Oct 24 23:18:31 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strptime.3,v 1.37 2019/02/24 11:51:05 maya Exp $
+.\"	$NetBSD: strptime.3,v 1.38 2022/10/24 23:18:31 uwe Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -222,6 +222,11 @@ with \&%C, specifies the year [0,99] wit
 the year, including the century (i.e., 1996).
 .It Cm \&%z
 an ISO 8601, RFC-2822, or RFC-3339 time zone specification.
+.Po
+A
+.Nx
+extension.
+.Pc
 This is one of the following:
 .Bl -dash -offset indent -compact
 .It
@@ -312,11 +317,6 @@ through
 .It
 An arbitrary timezone name that can be loaded from the database.
 .El
-.Po
-A
-.Nx
-extension.
-.Pc
 .It Cm \&%Z
 time zone name or no characters when time zone information is unavailable.
 .Po



CVS commit: src/lib/libc/time

2022-10-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Oct 24 23:18:31 UTC 2022

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

Log Message:
strptime(3): make the fact that %z is an extension more prominent

Mention it near the format itself, not on the next screen (with an
awkward indentation too).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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.



Re: CVS commit: src/lib/libc/time

2022-10-24 Thread Steffen Nurpmeso
Taylor R Campbell wrote in
 <20221023170035.2542f60...@jupiter.mumble.net>:
 ...
 |If you use a monotonic timer to sample the POSIX clock before and
 |after a leap second, the POSIX clock will appear to have taken twice
 |as long as it should to pass the leap second.

Just to note that the next leap second could be a negative one.

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: CVS commit: src/lib/libc/time

2022-10-24 Thread Robert Elz
Date:Sun, 23 Oct 2022 13:53:01 -0400
From:Jan Schaumann 
Message-ID:  

  | Hmm, maybe something like this?

I think there is still too much there, you don't have
to explain everything (or almost anything), but it is
in the right direction I think.

  | For example, consider a struct tm initialized with a
  | tm_year = 122, tm_mon = 11, tm_mday = 30, tm_hour =
  | 22, tm_min = 57, and a tm_sec = 0, using UTC,
  | representing 2022‐12‐31T22:57:00Z.

That last bit (the ISO format spec of the time) isn't
really needed, but doesn't hurt either - but I would avoid
an example that touches anywhere near midnight Dec 31, UTC,
(which this one does later, if not here) as that's exactly
where leap seconds start to appear, and (as illustrated in
the side-discussion in this thread) that's where things get messy.
Best to just avoid that  (Avoid June 30 for the same reason.)

  | Incrementing
  | tm_min by 13 and calling mktime() would yield a time_t
  | with value 1672528200,

That's irrelevant, the time_t returned isn't what's really
interesting here, and its binary value is way too much (useless)
information, it is the modification made to the tm that matters.
It is already clear enough in the doc (I think) that the result
from mktime() is the time_t for the normalised tm.

  | representing 2022‐12‐31T23:10:00Z,

this, or just give the adjusted tm_min and tm_hour
values, there's no need for both, and

  | as the tm_min = 70 was
  | normalized to an increment of tm_hour by one and
  | tm_min = 10.

no need for the explanation of how it was done.

  | This normalizing can lead to cascading changes: Again
  | using a struct tm initialized as in the above example
  | but with a tm_hour = 23, the same change would yield a
  | time_t with value 1672531800, representing
  | 2023‐01‐01T00:10:00Z

That's the adjustment we want to avoid, as it gets right into
what happens if we're observing leap seconds, and one was to
happen in that period.There's no need to show the year being
incremented, showing the month going up would be enough, readers
ought to be able to deduce that if the month changes from Dec to
Jan then the year would be incremented by one.

  | the normalization of tm_min incremented tm_hour,

This explanation is not needed, but if it were, that
would be correct, but

  | which lead to a normalization of tm_mday, which in
  | turn caused tm_mon to be normalized,

but not those.   Those fields (in this example) were
already within the appropriate range, they don't need
to be normalised, they're simply adjusted, or as in
this (or tm_hour above):

  | which in turn lead to the increment of tm_year.

  | In addition,

That's perhaps poor wording here, "addition" followed
immediately by "negative", it could be "Also" which
avoids this, but this lead in clause is not really
needed at all, just begin like:

  | negative values may also be normalized,
  | such that e.g., a tm_hour of −1 means 1 hour before
  | midnight, tm_mday of 0 means the day preceding the
  | current month, and tm_mon of −2 means 2 months before
  | January of tm_year.

Again, too much there, we don't need examples of everything.

I still feel though that an example with more than one adjustment
to a tm returned by localtime (though how it was originally
created is irrelevant) and which would affect Feb 29 were
it a leap year, would be worth giving (in both the leap
year and non leap year cases) so we get Feb 29 in one
case and Mar 1 in the other, from an adjustment that
affects months (and days, either directly, or as a flow on
from hours, mins, or secs) - like going back a month from
Mar 28, then forward to the next day, and sometimes still
being in Mar.

  | The fact that mktime(2) returns a time_t makes the
  | phrasing even more awkward,

Yes, as above.

  | and I suppose we could
  | leave out the actual value and say "would yield a
  | time_t representing..."?

No, nothing about the result returned at all, this should
all just be about what normalising the tm causes to happen.
Those values are not just internal, the tm passed (via ref)
is modified if needed before mktime returns.

kre



Re: CVS commit: src/lib/libc/time

2022-10-23 Thread Warner Losh
On Sun, Oct 23, 2022 at 11:00 AM Taylor R Campbell <
campbell+netbsd-source-change...@mumble.net> wrote:

> > Date: Sun, 23 Oct 2022 07:39:25 -0600
> > From: Warner Losh 
> >
> > I guess a more accurate way of saying this is that leap seconds simply
> > aren't reliable, cannot be made reliable, and this affects normalization
> > in ways too numerous to mention due to the details of the tz files, bugs
> > in the system, and lack of others to implement them correctly.
>
> I think you mean `POSIX clocks simply aren't reliable'.  They _could_
> be made reliable, though, by fixing the the calendar arithmetic
> formula in POSIX for mapping time_t to and from UTC -- just like POSIX
> already fixed the bug in its Gregorian leap year formula.
>

Except they can't, at least not practically enough to be a standard. The
Gregorian Leap Year formula is a mathematical formula that needs no
further data other than the broken down time to compute. It's not an
observational calendar, but a computational or arithmetic one. UTC is an
observational calendar. We barely know if there's going to be a leap
second in the coming months, and have nothing more than a vague notion
of when the one after that might be. You must have a table of all past
leap seconds to do any kind of sensible mapping. And you also must
have some way to keep that up to date, even when machines are
powered off, or installed from not really that old media (anything older
than 6 months can't possibly have the right leap table, except by
chance). And then the question becomes how do you get it, do you
assume connectivity, some standard media format, some standard file
format, etc. All of these details means POSIX can't really fix this. And
even if they do, the current formula has been around so long there's a
lot of dusty decks of code that will likely silently break. You can
ameliorate
that somewhat by inventing new interfaces, but issues like the one you go
into below will still persist.


> > > The code works with either set of tzdata files, POSIX stretchy secs,
> > > or UTC with leap secs - claiming that one doesn't happen, or cannot
> > > happen, isn't really correct.
> >
> > Yea, and even 'posix stretchy sec' is really a misnomer. POSIX simply
> > counts time without leap seconds. Each second is the same length,
>
> Not at all.
>
> If you use a monotonic timer to sample the POSIX clock before and
> after a leap second, the POSIX clock will appear to have taken twice
> as long as it should to pass the leap second.
>
> Of course, it's worse.  If sampled at _subsecond_ intervals, a POSIX
> clock behaves _erratically_: it spontaneously rewinds itself!
>
> Suppose we have a machine with a monotonic clock that counts SI
> seconds as well as a POSIX clock:
>
> SI monotonicPOSIX
> 123.25  1483228799.00
> 123.50  1483228799.25
> 123.75  1483228799.50  # t0 = boottime + 123.75
> 124.00  1483228799.75
> 124.25  1483228800.00  # leap second begins at 2016-12-31T23:59:60Z
> 124.50  1483228800.25
> 124.75  1483228800.50
> 125.00  1483228800.75  # t1 = boottime + 125.00
> 125.25  1483228800.00  # POSIX clock rewinds at
> 2017-01-01T00:00:00Z!
> 125.50  1483228800.25
> 125.75  1483228800.50  # t2 = boottime + 125.75
> 126.00  1483228800.75
>
> At supersecond resolution, t2 - t0 is a duration of 2 SI seconds, but
> a POSIX clock reports a time difference POSIX(t2) - POSIX(t0) of 1, so
> `POSIX seconds' are not always SI seconds -- it is not the case that
> `each [POSIX] second is the same length', even ignoring physical clock
> sampling error.
>

Right. Except during that brief interval around a leap second, all the
seconds
are the same size. They aren't expanded or contracted by running the clock
at a different frequency that was done between approx 1960-1972 which is
often referred to as the rubber leap second era. It was more on that basis
that
I was objecting to the turn of phrase because that sort of thing isn't
happening.


> And, of course, at subsecond resolution, the POSIX clock rewinds.  The
> monotonic clock correctly has t1 < t2, but POSIX(t1) > POSIX(t2).  And
> this erratic behaviour is much worse than a typical NTP-driven clock
> adjustment at random times, because by design this erratic behaviour
> happens on ~every computer on the planet simultaneously!
>

Yea, if NTP knows about the leap, it can deal with it. The problem as you
say comes in when the stratum 1 servers don't announce the leap second
far enough in advance for the implementations to cope. It then devolves to
the 'when, exactly, do you step the time back' problem since there's a
couple
of choices, unless you have the 'leap smear' ntp servers which do it over
a few hours.


> There's no need for this nonsense except insistence on the formula
> that says every UTC day is counted by 86400 `POSIX seconds'.  POSIX
> could be revised to fix this bug in the clock by just not doing civil
> calendar 

Re: CVS commit: src/lib/libc/time

2022-10-23 Thread Taylor R Campbell
> Date: Sun, 23 Oct 2022 12:19:37 -0600
> From: Warner Losh 
> 
>  You must have a table of all past
> leap seconds to do any kind of sensible mapping. And you also must
> have some way to keep that up to date, [...]

It's the same for all civil calendar matters with political changes
around summer time, but at a smaller scale: with an outdated tzdb,
where localtime might be off for an hour, mktime might be off by a few
seconds.

> > And, of course, at subsecond resolution, the POSIX clock rewinds.  The
> > monotonic clock correctly has t1 < t2, but POSIX(t1) > POSIX(t2).  And
> > this erratic behaviour is much worse than a typical NTP-driven clock
> > adjustment at random times, because by design this erratic behaviour
> > happens on ~every computer on the planet simultaneously!
> 
> Yea, if NTP knows about the leap, it can deal with it. The problem as you
> say comes in when the stratum 1 servers don't announce the leap second
> far enough in advance for the implementations to cope. It then devolves to
> the 'when, exactly, do you step the time back' problem since there's a
> couple
> of choices, unless you have the 'leap smear' ntp servers which do it over
> a few hours.

I mentioned NTP-driven clock adjustments as an example of _other_
times that a POSIX clock might rewind.  Such adjustments arise from
local clock drift and so occur randomly, in contrast to the rewinding
on leap seconds that is globally coordinated as a deliberate design
decision of POSIX leading to simultaneous worldwide computer system
failures.

NTP doesn't have to know about leap seconds at all, nor does POSIX.
They could both just report the number of SI seconds (averaged in the
usual TAI way) since an appropriate epoch, and all the leap second
adjustment logic could be ripped out and moved to tzdb and mktime just
like time zones and summer time.

The fundamental problem with a POSIX clock -- and to a lesser extent
NTP, although NTP at least transmits additional information to work
around it during a leap second transition unlike POSIX programs -- is
that it goes out of its way to step back the _internal concept of
timecounting_ (tick-tick-tick, counting what everyone expects to be SI
seconds) just to deal with an _external civil calendar presentation_,
like the summer time change.  And it makes sure to do so
simultaneously on all computers worldwide.  That's a spectacularly bad
design leading to tremendously costly mistakes.  Leap seconds aren't a
big deal; the erratic design of POSIX clocks is.


Re: CVS commit: src/lib/libc/time

2022-10-23 Thread Jan Schaumann
Robert Elz  wrote:
> Date:Sat, 22 Oct 2022 13:42:54 -0400
> From:Jan Schaumann 
> Message-ID:  
> 
>   | A full set of examples strikes me as too much here
> 
> A full set would be yes, but I think we could handle 3.

Hmm, maybe something like this?


...and will be normalized, if need be.

For example, consider a struct tm initialized with a
tm_year = 122, tm_mon = 11, tm_mday = 30, tm_hour =
22, tm_min = 57, and a tm_sec = 0, using UTC,
representing 2022‐12‐31T22:57:00Z.  Incrementing
tm_min by 13 and calling mktime() would yield a time_t
with value 1672528200, representing
2022‐12‐31T23:10:00Z, as the tm_min = 70 was
normalized to an increment of tm_hour by one and
tm_min = 10.

This normalizing can lead to cascading changes: Again
using a struct tm initialized as in the above example
but with a tm_hour = 23, the same change would yield a
time_t with value 1672531800, representing
2023‐01‐01T00:10:00Z: the normalization of tm_min
incremented tm_hour, which lead to a normalization
of tm_mday, which in turn caused tm_mon to be
normalized, which in turn lead to the increment of
tm_year.

In addition, negative values may also be normalized,
such that e.g., a tm_hour of −1 means 1 hour before
midnight, tm_mday of 0 means the day preceding the
current month, and tm_mon of −2 means 2 months before
January of tm_year.
---

The fact that mktime(2) returns a time_t makes the
phrasing even more awkward, and I suppose we could
leave out the actual value and say "would yield a
time_t representing..."?

Other ideas to improve this?

-Jan


Re: CVS commit: src/lib/libc/time

2022-10-23 Thread Taylor R Campbell
> Date: Sun, 23 Oct 2022 07:39:25 -0600
> From: Warner Losh 
> 
> I guess a more accurate way of saying this is that leap seconds simply
> aren't reliable, cannot be made reliable, and this affects normalization
> in ways too numerous to mention due to the details of the tz files, bugs
> in the system, and lack of others to implement them correctly.

I think you mean `POSIX clocks simply aren't reliable'.  They _could_
be made reliable, though, by fixing the the calendar arithmetic
formula in POSIX for mapping time_t to and from UTC -- just like POSIX
already fixed the bug in its Gregorian leap year formula.

> > The code works with either set of tzdata files, POSIX stretchy secs,
> > or UTC with leap secs - claiming that one doesn't happen, or cannot
> > happen, isn't really correct.
> 
> Yea, and even 'posix stretchy sec' is really a misnomer. POSIX simply
> counts time without leap seconds. Each second is the same length,

Not at all.

If you use a monotonic timer to sample the POSIX clock before and
after a leap second, the POSIX clock will appear to have taken twice
as long as it should to pass the leap second.

Of course, it's worse.  If sampled at _subsecond_ intervals, a POSIX
clock behaves _erratically_: it spontaneously rewinds itself!

Suppose we have a machine with a monotonic clock that counts SI
seconds as well as a POSIX clock:

SI monotonicPOSIX
123.25  1483228799.00
123.50  1483228799.25
123.75  1483228799.50  # t0 = boottime + 123.75
124.00  1483228799.75
124.25  1483228800.00  # leap second begins at 2016-12-31T23:59:60Z
124.50  1483228800.25
124.75  1483228800.50
125.00  1483228800.75  # t1 = boottime + 125.00
125.25  1483228800.00  # POSIX clock rewinds at 2017-01-01T00:00:00Z!
125.50  1483228800.25
125.75  1483228800.50  # t2 = boottime + 125.75
126.00  1483228800.75

At supersecond resolution, t2 - t0 is a duration of 2 SI seconds, but
a POSIX clock reports a time difference POSIX(t2) - POSIX(t0) of 1, so
`POSIX seconds' are not always SI seconds -- it is not the case that
`each [POSIX] second is the same length', even ignoring physical clock
sampling error.

And, of course, at subsecond resolution, the POSIX clock rewinds.  The
monotonic clock correctly has t1 < t2, but POSIX(t1) > POSIX(t2).  And
this erratic behaviour is much worse than a typical NTP-driven clock
adjustment at random times, because by design this erratic behaviour
happens on ~every computer on the planet simultaneously!

There's no need for this nonsense except insistence on the formula
that says every UTC day is counted by 86400 `POSIX seconds'.  POSIX
could be revised to fix this bug in the clock by just not doing civil
calendar adjustments in the basic clock that goes tick-tick-tick for
counting what most people think are going to be SI seconds.  For the
time_t<->UTC conversion in libc, machines with out-of-date tzdb would
just be off by a few seconds sometimes, no worse than being off by an
hour in the time_t<->localtime conversion with an out-of-date tzdb
across an updated summer time change.


Re: CVS commit: src/lib/libc/time

2022-10-23 Thread Warner Losh
On Sat, Oct 22, 2022 at 10:55 PM Robert Elz  wrote:

> Date:Sat, 22 Oct 2022 20:17:57 -0600
> From:Warner Losh 
> Message-ID:  <
> canczdfqhkz0xs7lf6lmjveontc5dgsonons_ug6fzsf30og...@mail.gmail.com>
>
>
>   | On the other hand, adding a caveat that leap seconds don't exist in a
> POSIX
>   | time_t and that's necessarily reflected in the normalization wouldn't
> be
>   | bad.
>
> The problem with doing that is that while we don't install it this
> way, it is possible to install tzdata such that leap seconds do occur
> (despite that not being posix) either unconditionally, or installing
> both and leaving it up to the user by their choice of timezone to use
> (which makes rather a mess).
>

That's true. In the default "UTC system time" clock, leap seconds simply
do no work at all. With the tzdata with leap seconds, they work for a
limited
subset of things, but not quite everything because you can't completely
close the gap due to time_t not having an encoding for them. Having tried
to deploy systems that needed to present a pedantically-correct UTC
time to the outside world shows many hole (most of which self correct
and are mostly right not near leap seconds).

I guess a more accurate way of saying this is that leap seconds simply
aren't reliable, cannot be made reliable, and this affects normalization
in ways too numerous to mention due to the details of the tz files, bugs
in the system, and lack of others to implement them correctly.


> The code works with either set of tzdata files, POSIX stretchy secs,
> or UTC with leap secs - claiming that one doesn't happen, or cannot
> happen, isn't really correct.
>

Yea, and even 'posix stretchy sec' is really a misnomer. POSIX simply
counts time without leap seconds. Each second is the same length,
and it doesn't make them longer or shorter. It just assumes some
ad-hoc, beyond the standard method for synchronization. The quality
of these ad-hoc methods ranges from terrible to halfway-decent, but
none are perfect.

OK. I've got my annual leap seconds rant out of the way. Even 15 years
after shipping these systems, the almost (but not completely) right nature
of how computers implement them still has my knee jerking just a little
too much...

Warner


Re: CVS commit: src/lib/libc/time

2022-10-23 Thread Warner Losh
On Sat, Oct 22, 2022, 8:05 PM Robert Elz  wrote:

> Date:Sat, 22 Oct 2022 13:42:54 -0400
> From:Jan Schaumann 
> Message-ID:  
>
>   | A full set of examples strikes me as too much here
>
> A full set would be yes, but I think we could handle 3.
> They don't need to be C code examples, just something
> like
> if tm_year==2022 tm_mon==10 tm_mday==19
>tm_hour==23 tm_min==58 tm_sec==17 and tm_dst==-1
>
> and tm_min was incremented as tm_min+=180, and then
> mktime() called upon the result, the struct tm would
> now have tm_min==1 tm_hour==24 and tm_mday==20, with
> tm_isdst 0 or 1 depending upon the local time zone.
> The other fields shown would not be altered in this
> example, the fields of struct tm not show here would
> (tm_wday, ...) would be filled in with appropriate values.
>

That sounds like a good idea...

[Using tm_min rather than tm_sec to avoid needing to include
> caveats about possible leap seconds, which, at least currently,
> could never happen in November, but all of that is too much
> to bother with.]
>

On the other hand, adding a caveat that leap seconds don't exist in a POSIX
time_t and that's necessarily reflected in the normalization wouldn't be
bad. It's a quite common misconception that somehow they do because they
exist in UTC... while you can encode any valid UTC time, they are always
normalized away.

The other examples could be even shorter, no need to repeat
> the final sentence about the other field changes or otherwise.
>
>   | Perhaps:
>   |
>   | This normalization is done in order from tm_sec up to
>   | tm_year,
>
> No, that is what you cannot say, because it is wrong.
>
> We do not always start from tm_sec, and tm_mon is *always*
> normalised (with its possible flow on to tm_year) before
> tm_mday - nothing else makes sense.   tm_year isn't
> "normalized" at all, though it might be adjusted.
>
> But all of this is what we already agreed is too much
> to explain.   And no matter how simple it makes things,
> the man pages cannot (deliberately) lie.
>

Agreed. These nuances are important.

  | possibly leading to cascading values.  That
>   | is, a tm_sec value of e.g., 185 with a tm_min value of
>   | 58 could lead to an increment of tm_min by three, and
>   | thus further incrementing tm_hour by one, and so on.
>
> This is more explaining how it works, which if we do at all,
> we need to do correctly.   That's where a few examples can
> be better, they allow the reader to deduce what probably
> happens, the weird one is there to show that the results
> will not always be what is expected at first glance, but
> that they always are correct.
>
>   | As with most things relating to
>   | time, dates, and calendars, the full details of these
>   | side effects are often non‐obvious, and it may be best
>   | to avoid such scenarios.
>
> And that part is just useless, unless you mean that non-normalised
> values should never be used, perhaps just in some fields (and it
> isn't that anyway, a big enough increment of tm_sec is the same
> as an increment of tm_mday or tm_mon) in which case we should just
> say that.   If not that, then hinting that it is sometimes odd,
> and those cases, which ones we refuse to tell you, should be
> avoided is a complete waste of time.   Which scenarios should be
> avoided?   The answer really is none of them, the answer is
> always correct, it just might not be what the user expected.
>


All good points.

Warner

> kre
>
>


Re: CVS commit: src/lib/libc/time

2022-10-22 Thread Robert Elz
Date:Sat, 22 Oct 2022 20:17:57 -0600
From:Warner Losh 
Message-ID:  



  | On the other hand, adding a caveat that leap seconds don't exist in a POSIX
  | time_t and that's necessarily reflected in the normalization wouldn't be
  | bad.

The problem with doing that is that while we don't install it this
way, it is possible to install tzdata such that leap seconds do occur
(despite that not being posix) either unconditionally, or installing
both and leaving it up to the user by their choice of timezone to use
(which makes rather a mess).

The code works with either set of tzdata files, POSIX stretchy secs,
or UTC with leap secs - claiming that one doesn't happen, or cannot
happen, isn't really correct.

kre




Re: CVS commit: src/lib/libc/time

2022-10-22 Thread Robert Elz
Date:Sun, 23 Oct 2022 08:33:18 +0700
From:Robert Elz 
Message-ID:  <7638.1666488...@jacaranda.noi.kre.to>

  | and tm_min was incremented as tm_min+=180, and then
  | mktime() called upon the result, the struct tm would
  | now have tm_min==1 tm_hour==24 and tm_mday==20, with

That is nonsense of course, but I think you get the idea
(and being nonsense shows why the examples should be
tested )

kre


Re: CVS commit: src/lib/libc/time

2022-10-22 Thread Robert Elz
Date:Sat, 22 Oct 2022 13:42:54 -0400
From:Jan Schaumann 
Message-ID:  

  | A full set of examples strikes me as too much here

A full set would be yes, but I think we could handle 3.
They don't need to be C code examples, just something
like
if tm_year==2022 tm_mon==10 tm_mday==19
   tm_hour==23 tm_min==58 tm_sec==17 and tm_dst==-1

and tm_min was incremented as tm_min+=180, and then
mktime() called upon the result, the struct tm would
now have tm_min==1 tm_hour==24 and tm_mday==20, with
tm_isdst 0 or 1 depending upon the local time zone.
The other fields shown would not be altered in this
example, the fields of struct tm not show here would
(tm_wday, ...) would be filled in with appropriate values.

[Using tm_min rather than tm_sec to avoid needing to include
caveats about possible leap seconds, which, at least currently,
could never happen in November, but all of that is too much
to bother with.]

The other examples could be even shorter, no need to repeat
the final sentence about the other field changes or otherwise.

  | Perhaps:
  |
  | This normalization is done in order from tm_sec up to
  | tm_year,

No, that is what you cannot say, because it is wrong.

We do not always start from tm_sec, and tm_mon is *always*
normalised (with its possible flow on to tm_year) before
tm_mday - nothing else makes sense.   tm_year isn't
"normalized" at all, though it might be adjusted.

But all of this is what we already agreed is too much
to explain.   And no matter how simple it makes things,
the man pages cannot (deliberately) lie.

  | possibly leading to cascading values.  That
  | is, a tm_sec value of e.g., 185 with a tm_min value of
  | 58 could lead to an increment of tm_min by three, and
  | thus further incrementing tm_hour by one, and so on.

This is more explaining how it works, which if we do at all,
we need to do correctly.   That's where a few examples can
be better, they allow the reader to deduce what probably
happens, the weird one is there to show that the results
will not always be what is expected at first glance, but
that they always are correct.

  | As with most things relating to
  | time, dates, and calendars, the full details of these
  | side effects are often non‐obvious, and it may be best
  | to avoid such scenarios.

And that part is just useless, unless you mean that non-normalised
values should never be used, perhaps just in some fields (and it
isn't that anyway, a big enough increment of tm_sec is the same
as an increment of tm_mday or tm_mon) in which case we should just
say that.   If not that, then hinting that it is sometimes odd,
and those cases, which ones we refuse to tell you, should be
avoided is a complete waste of time.   Which scenarios should be
avoided?   The answer really is none of them, the answer is
always correct, it just might not be what the user expected.

kre



Re: CVS commit: src/lib/libc/time

2022-10-22 Thread Jan Schaumann
Robert Elz  wrote:
> jo...@bec.de said:
>   | I'd actually weasle out a bit
> 
> Yes, I would too, but

A full set of examples strikes me as too much here
still, and I do like the idea of weaseling out.

Perhaps:

This normalization is done in order from tm_sec up to
tm_year, possibly leading to cascading values.  That
is, a tm_sec value of e.g., 185 with a tm_min value of
58 could lead to an increment of tm_min by three, and
thus further incrementing tm_hour by one, and so on.
Likewise, negative values can lead to decrementing
other tm(3) fields.  As with most things relating to
time, dates, and calendars, the full details of these
side effects are often non‐obvious, and it may be best
to avoid such scenarios.

?

-Jan


Re: CVS commit: src/lib/libc/time

2022-10-22 Thread Robert Elz
Date:Fri, 21 Oct 2022 15:00:41 -0400
From:Jan Schaumann 
Message-ID:  

  | I believe that it's useful for people to know that
  | values outside the normal ranges are normalized,

Agreed.

  | as well as what that might look like.

The problem with trying to specify that, as we have
discovered, is that it is not easy.   The problem with
only doing half of the job here, is that sometime later
someone will read it, see what it says happens, and
what it doesn't say, and then expect the code to do
that - when it probably doesn't.

I'll come back to the rest of your message a bit lower,
but first a brief interlude ...

jo...@bec.de said:
  | I'd actually weasle out a bit

Yes, I would too, but

jo...@bec.de continued:
  | and just declare that normalisation is best effort and we
  | don't guarantee behavior for values that are very much outside
  | the range of the corresponding field. E.g. anything where
  | numerical overflow can happen in a component.

that isn't really the problem.  tzcode is very careful with arithmetic
to avoid those kinds of problems - if there's anywhere that it isn't
(which is still possible) that would be fixed if pointed out.

The problem is just the complexity of specifying what does happen,
in a way that fits the manual page in a way that is easier to
follow that simply reading the source (which isn't all that easy).

Now we return to the originally scheduelled e-mail:

jscha...@netmeister.org said:
  | That helps a lot when trying to determine _why_ the
  | output of mktime(3) [...]

  | Noting that values may cascade is useful [...]

I wonder if rather than attempting to specify what happens,
it might be better in this case to give examples of using
struct tm alterations, followed by mktime(), to alter the time,
and what the results are.

I'm not generally much in favour of examples in man pages,
I prefer specification, and leave it up to the reader to
determine how to use things to achieve the desired result,
as while giving an example or two (or three) of what can be
done is great for people who want to do one of those exact
things (and so can just copy the example) but is useless for
someone whose needs are different than any of the examples,
and is left trying to guess what will happen.

But here a two or three good examples of what happens might
just be a sane solution, perhaps two fairly simple ones, but
which demonstrate what happens with addition, and subtraction
- using just one field modification, but having that result in
a cascade through a few of the other fields - perhaps the 180
seconds forward, starting at 23:58 on the last day of some
month, and 32 hours backwards starting at 01:15 on the second
of a month.Those should both produce entirely reasonable
and understandable results.

The third should show multiple modifications, in a way that produces,
or can do, a surprising result, perhaps 14 days forward, also
2 months forward, and some irrelevant small number of minutes backward
(that just to show that multiple fields can be altered, and they don't
need to all go in the same direction) starting at 13:27 on Dec 15 - where
the result can be Feb 29, or Mar 1 (at something a bit earlier than 13:27,
perhaps even make the number of minutes subtracted > 27 in that example)
depending upon whether the year is a leap year or not.   (Or make it
6 months forward (plus...) starting from August).  This one should be
one full example, with something like "if the starting year had been
 then the result would have been" added to show the difference
between leap years and others.

If this is done, the examples should all be tested to verify the
claimed results, but the man page should not need a lot of explanation
of why the result shown is achieved, just the input, the modification
made, and the result.

kre



Re: CVS commit: src/lib/libc/time

2022-10-21 Thread Joerg Sonnenberger
Am Fri, Oct 21, 2022 at 02:06:32PM +0700 schrieb Robert Elz:
> Date:Fri, 21 Oct 2022 03:05:15 +
> From:"Jan Schaumann" 
> Message-ID:  <20221021030515.cdc9df...@cvs.netbsd.org>
> 
>   | Note normalizing behavior of mktime(3) using language from FreeBSD.
> 
> If we are going to start specifying what happens (how the struct tm
> is normalised) then we really also need to specify in which order
> the fields are corrected.   It makes a difference.

I'd actually weasle out a bit and just declare that normalisation is
best effort and we don't guarantee behavior for values that are very
much outside the range of the corresponding field. E.g. anything where
numerical overflow can happen in a component.

Joerg


Re: CVS commit: src/lib/libc/time

2022-10-21 Thread Jan Schaumann
Robert Elz  wrote:
> Date:Fri, 21 Oct 2022 11:54:08 -0400
> From:Jan Schaumann 
> Message-ID:  
> 
>   | Right, but all that strikes me as too much to put into
>   | the manual page here.
> 
> I agree, which is why I wondered if we should be giving any
> details about how it is done at all.

I believe that it's useful for people to know that
values outside the normal ranges are normalized, as
well as what that might look like.

That helps a lot when trying to determine _why_ the
output of mktime(3) with a tm_sec = 180 yields no
error and a value of tm_min += 3.  I don't think many
people would want to go and dig up the sources to make
sense of this.

Noting that values may cascade is useful (because
that, too, is not obvious), but seems to me the limit
of detail desired here, while still being useful.

-Jan


Re: CVS commit: src/lib/libc/time

2022-10-21 Thread Robert Elz
Date:Fri, 21 Oct 2022 11:54:08 -0400
From:Jan Schaumann 
Message-ID:  

  | Right, but all that strikes me as too much to put into
  | the manual page here.

I agree, which is why I wondered if we should be giving any
details about how it is done at all.

  | I think what matters in this context is that there is
  | an order and that there is a cascading effect.

Perhaps, but

  | "This normalization is done in order from tm_sec to
  | tm_mon (inclusive), possibly leading to cascading
  | values."

As a generic order, that's backwards.   Really we need to
go from year (which is always OK) to month (which can always
be corrected simply, assuming the Gregorian calendar is in
effect, which we assume it is, even for years before that
calendar was created).   Once we know the year and month,
but not before, the day of month can be corrected (which
might then affect the month and year, but only once).

The code doesn't do it in quite that order, it does the
secs mins hours first, but doing it that way ensures that
the hours correction cannot affect the day, after it has
been corrected, the day(of month) always gets set last
(leap seconds excepted).

It really is moderately complicated - trying to explain it
at all risks being simply wrong, or so vague as to be
completely useless.I'm not sure that what was there
before (no details at all, just (in other words) "it gets
fixed") wasn't as good as is reasonable to expect.

kre



Re: CVS commit: src/lib/libc/time

2022-10-21 Thread Jan Schaumann
Robert Elz  wrote:
> Date:Fri, 21 Oct 2022 10:36:23 -0400
> From:Jan Schaumann 
> Message-ID:  
> 
> 
>   | Perhaps like this?
> 
> Like that, yes, but as you wrote it isn't how it is actually
> done I believe.
> 
> The order looks to be secs, mins, hours, month, day(of month).
> 
> There's no normalisation of the year (no invalid values to correct)
> though the year can be adjusted when the month is adjusted.
> 
> That order is assuming that the system is using posix stretchy seconds,
> rather than UTC (with leap seconds), but almost all NetBSD systems
> work that way - if UTC is being used, then secs cannot be done first,
> as until the rest of the data/time is known, it is unknown whether
> the number of seconds permitted is 59 60 or 61.   With POSIX seconds
> the secs/mins/hours correction order doesn't really matter, as there
> are always 0..59 secs, 0..59 mins, and 0..23 hours, the rest of the
> fields have no impact at all.

Right, but all that strikes me as too much to put into
the manual page here.  I think what matters in this
context is that there is an order and that there is a
cascading effect.

"This normalization is done in order from tm_sec to
tm_mon (inclusive), possibly leading to cascading
values."

or

"This normalization is done in order from tm_sec up to
tm_year, possibly leading to cascading values."

provides sufficient information, I think?

-Jan


Re: CVS commit: src/lib/libc/time

2022-10-21 Thread Robert Elz
Date:Fri, 21 Oct 2022 10:36:23 -0400
From:Jan Schaumann 
Message-ID:  


  | Perhaps like this?

Like that, yes, but as you wrote it isn't how it is actually
done I believe.

The order looks to be secs, mins, hours, month, day(of month).

There's no normalisation of the year (no invalid values to correct)
though the year can be adjusted when the month is adjusted.

That order is assuming that the system is using posix stretchy seconds,
rather than UTC (with leap seconds), but almost all NetBSD systems
work that way - if UTC is being used, then secs cannot be done first,
as until the rest of the data/time is known, it is unknown whether
the number of seconds permitted is 59 60 or 61.   With POSIX seconds
the secs/mins/hours correction order doesn't really matter, as there
are always 0..59 secs, 0..59 mins, and 0..23 hours, the rest of the
fields have no impact at all.

kre



Re: CVS commit: src/lib/libc/time

2022-10-21 Thread Jan Schaumann
Robert Elz  wrote:
> Date:Fri, 21 Oct 2022 03:05:15 +
> From:"Jan Schaumann" 
> Message-ID:  <20221021030515.cdc9df...@cvs.netbsd.org>
> 
>   | Note normalizing behavior of mktime(3) using language from FreeBSD.
> 
> If we are going to start specifying what happens (how the struct tm
> is normalised) then we really also need to specify in which order
> the fields are corrected.   It makes a difference.

Perhaps like this?


Index: ctime.3
===
RCS file: /cvsroot/src/lib/libc/time/ctime.3,v
retrieving revision 1.65
diff -u -p -r1.65 ctime.3
--- ctime.3 21 Oct 2022 03:08:29 -  1.65
+++ ctime.3 21 Oct 2022 14:34:39 -
@@ -264,6 +264,11 @@ of 0 means the day preceding the current
 .Fa tm_mon
 of \-2 means 2 months before January of
 .Fa tm_year .
+This normalization is done in order from
+.Fa tm_sec
+to
+.Fa tm_year ,
+possibly leading to cascading values.
 (A positive or zero value for
 .Fa tm_isdst
 causes


CVS commit: src/lib/libc/time

2022-10-21 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct 21 12:28:43 UTC 2022

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

Log Message:
ctime(3): fix unbalanced paren introduced in 1.40


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 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.66 src/lib/libc/time/ctime.3:1.67
--- src/lib/libc/time/ctime.3:1.66	Fri Oct 21 12:11:29 2022
+++ src/lib/libc/time/ctime.3	Fri Oct 21 12:28:43 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.66 2022/10/21 12:11:29 uwe Exp $
+.\" $NetBSD: ctime.3,v 1.67 2022/10/21 12:28:43 uwe Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -264,7 +264,8 @@ of 0 means the day preceding the current
 .Fa tm_mon
 of \-2 means 2 months before January of
 .Fa tm_year .
-(A positive or zero value for
+.It
+A positive or zero value for
 .Fa tm_isdst
 causes
 .Fn mktime



CVS commit: src/lib/libc/time

2022-10-21 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct 21 12:28:43 UTC 2022

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

Log Message:
ctime(3): fix unbalanced paren introduced in 1.40


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 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.



CVS commit: src/lib/libc/time

2022-10-21 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct 21 12:11:29 UTC 2022

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

Log Message:
ctime(3): add missing leading slash in a pathname


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.65 src/lib/libc/time/ctime.3:1.66
--- src/lib/libc/time/ctime.3:1.65	Fri Oct 21 03:08:29 2022
+++ src/lib/libc/time/ctime.3	Fri Oct 21 12:11:29 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.65 2022/10/21 03:08:29 jschauma Exp $
+.\" $NetBSD: ctime.3,v 1.66 2022/10/21 12:11:29 uwe Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -454,7 +454,7 @@ function returns string containing the n
 local timezone file
 .It Pa /usr/share/zoneinfo
 timezone information directory
-.It Pa usr/share/zoneinfo/localtime
+.It Pa /usr/share/zoneinfo/localtime
 local timezone file
 .It Pa /usr/share/zoneinfo/posixrules
 used with POSIX-style TZ's



CVS commit: src/lib/libc/time

2022-10-21 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Oct 21 12:11:29 UTC 2022

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

Log Message:
ctime(3): add missing leading slash in a pathname


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.



Re: CVS commit: src/lib/libc/time

2022-10-21 Thread Robert Elz
Date:Fri, 21 Oct 2022 03:05:15 +
From:"Jan Schaumann" 
Message-ID:  <20221021030515.cdc9df...@cvs.netbsd.org>

  | Note normalizing behavior of mktime(3) using language from FreeBSD.

If we are going to start specifying what happens (how the struct tm
is normalised) then we really also need to specify in which order
the fields are corrected.   It makes a difference.

kre



CVS commit: src/lib/libc/time

2022-10-20 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Fri Oct 21 03:08:29 UTC 2022

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

Log Message:
escape mathematical minus so it doesn't get rendered as a dash


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.



CVS commit: src/lib/libc/time

2022-10-20 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Fri Oct 21 03:08:29 UTC 2022

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

Log Message:
escape mathematical minus so it doesn't get rendered as a dash


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.64 src/lib/libc/time/ctime.3:1.65
--- src/lib/libc/time/ctime.3:1.64	Fri Oct 21 03:05:15 2022
+++ src/lib/libc/time/ctime.3	Fri Oct 21 03:08:29 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: ctime.3,v 1.64 2022/10/21 03:05:15 jschauma Exp $
+.\" $NetBSD: ctime.3,v 1.65 2022/10/21 03:08:29 jschauma Exp $
 .\"
 .\" XXX: License missing?
 .\"
@@ -298,7 +298,7 @@ are determined.
 .Pp
 The function returns the specified calendar time;
 if the calendar time cannot be represented, it returns
-.Va "(time_t)-1" .
+.Va "(time_t)\-1" .
 This can happen either because the resulting conversion would not fit
 in a
 .Vt time_t



CVS commit: src/lib/libc/time

2022-10-20 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Fri Oct 21 03:05:15 UTC 2022

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

Log Message:
Note normalizing behavior of mktime(3) using language from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.



CVS commit: src/lib/libc/time

2022-10-20 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Fri Oct 21 03:05:15 UTC 2022

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

Log Message:
Note normalizing behavior of mktime(3) using language from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/lib/libc/time/ctime.3:1.64
--- src/lib/libc/time/ctime.3:1.63	Tue Aug 16 11:07:40 2022
+++ src/lib/libc/time/ctime.3	Fri Oct 21 03:05:15 2022
@@ -1,8 +1,8 @@
-.\" $NetBSD: ctime.3,v 1.63 2022/08/16 11:07:40 christos Exp $
+.\" $NetBSD: ctime.3,v 1.64 2022/10/21 03:05:15 jschauma Exp $
 .\"
 .\" XXX: License missing?
 .\"
-.Dd August 16, 2022
+.Dd October 22, 2022
 .Dt CTIME 3
 .Os
 .Sh NAME
@@ -253,7 +253,17 @@ and
 .Fa tm_yday
 components of the structure are ignored,
 and the original values of the other components are not restricted
-to their normal ranges.
+to their normal ranges and will be normalized,
+if need be.
+For example,
+October 40 is changed into November 9, a
+.Fa tm_hour
+of \-1 means 1 hour before midnight,
+.Fa tm_mday
+of 0 means the day preceding the current month, and
+.Fa tm_mon
+of \-2 means 2 months before January of
+.Fa tm_year .
 (A positive or zero value for
 .Fa tm_isdst
 causes



CVS commit: src/lib/libc/time

2022-10-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 15 18:57:37 UTC 2022

Modified Files:
src/lib/libc/time: NEWS tzselect.ksh version

Log Message:
update to 2022e; no real changes


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/NEWS
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/tzselect.ksh \
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.37 src/lib/libc/time/NEWS:1.38
--- src/lib/libc/time/NEWS:1.37	Tue Aug 16 07:07:40 2022
+++ src/lib/libc/time/NEWS	Sat Oct 15 14:57:37 2022
@@ -1,5 +1,48 @@
 News for the tz database
 
+Release 2022e - 2022-10-11 11:13:02 -0700
+
+  Briefly:
+Jordan and Syria switch from +02/+03 with DST to year-round +03.
+
+  Changes to future timestamps
+
+Jordan and Syria are abandoning the DST regime and are changing to
+permanent +03, so they will not fall back from +03 to +02 on
+2022-10-28.  (Thanks to Steffen Thorsen and Issam Al-Zuwairi.)
+
+  Changes to past timestamps
+
+On 1922-01-01 Tijuana adopted standard time at 00:00, not 01:00.
+
+  Changes to past time zone abbreviations and DST flags
+
+The temporary advancement of clocks in central Mexico in summer
+1931 is now treated as daylight saving time, instead of as two
+changes to standard time.
+
+
+Release 2022d - 2022-09-23 12:02:57 -0700
+
+  Briefly:
+Palestine transitions are now Saturdays at 02:00.
+Simplify three Ukraine zones into one.
+
+  Changes to future timestamps
+
+Palestine now springs forward and falls back at 02:00 on the
+first Saturday on or after March 24 and October 24, respectively.
+This means 2022 falls back 10-29 at 02:00, not 10-28 at 01:00.
+(Thanks to Heba Hamad.)
+
+  Changes to past timestamps
+
+Simplify three Ukraine zones to one, since the post-1970
+differences seem to have been imaginary.  Move Europe/Uzhgorod and
+Europe/Zaporozhye to 'backzone'; backward-compatibility links
+still work, albeit with different timestamps before October 1991.
+
+
 Release 2022c - 2022-08-15 17:47:18 -0700
 
   Briefly:

Index: src/lib/libc/time/tzselect.ksh
diff -u src/lib/libc/time/tzselect.ksh:1.20 src/lib/libc/time/tzselect.ksh:1.21
--- src/lib/libc/time/tzselect.ksh:1.20	Tue Aug 16 07:07:40 2022
+++ src/lib/libc/time/tzselect.ksh	Sat Oct 15 14:57:37 2022
@@ -3,7 +3,7 @@
 # Ask the user about the time zone, and output the resulting TZ value to stdout.
 # Interact with the user via stderr and stdin.
 #
-#	$NetBSD: tzselect.ksh,v 1.20 2022/08/16 11:07:40 christos Exp $
+#	$NetBSD: tzselect.ksh,v 1.21 2022/10/15 18:57:37 christos Exp $
 #
 PKGVERSION='(tzcode) '
 TZVERSION=see_Makefile
@@ -35,6 +35,7 @@ REPORT_BUGS_TO=t...@iana.org
 #
 #	Gawk (GNU awk) 
 #	mawk 
+#	nawk 
 
 
 # Specify default values for environment variables if they are unset.
Index: src/lib/libc/time/version
diff -u src/lib/libc/time/version:1.20 src/lib/libc/time/version:1.21
--- src/lib/libc/time/version:1.20	Tue Aug 16 07:07:40 2022
+++ src/lib/libc/time/version	Sat Oct 15 14:57:37 2022
@@ -1 +1 @@
-2022c
+2022e



CVS commit: src/lib/libc/time

2022-10-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 15 18:57:37 UTC 2022

Modified Files:
src/lib/libc/time: NEWS tzselect.ksh version

Log Message:
update to 2022e; no real changes


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/NEWS
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/tzselect.ksh \
src/lib/libc/time/version

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

2022-08-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 24 06:39:14 UTC 2022

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

Log Message:
add missing text.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/zic.8

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.8
diff -u src/lib/libc/time/zic.8:1.38 src/lib/libc/time/zic.8:1.39
--- src/lib/libc/time/zic.8:1.38	Tue Aug 16 06:56:21 2022
+++ src/lib/libc/time/zic.8	Wed Aug 24 02:39:14 2022
@@ -1,5 +1,5 @@
-.\"	$NetBSD: zic.8,v 1.38 2022/08/16 10:56:21 christos Exp $
-.Dd August 16, 2022
+.\"	$NetBSD: zic.8,v 1.39 2022/08/24 06:39:14 christos Exp $
+.Dd August 24, 2022
 .Dt ZIC 8
 .Os
 .Sh NAME
@@ -56,6 +56,7 @@ and incompatibilities.
 The default is
 .Dv slim ,
 as software that mishandles 64-bit data typically
+mishandles timestamps after the year 2038 anyway.
 Also see the
 .Fl r
 option for another way to alter output size.



CVS commit: src/lib/libc/time

2022-08-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 24 06:39:14 UTC 2022

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

Log Message:
add missing text.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/time/zic.8

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

2022-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 23 14:54:50 UTC 2022

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

Log Message:
Fix argument name


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 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.42 src/lib/libc/time/tzset.3:1.43
--- src/lib/libc/time/tzset.3:1.42	Wed Jul  3 11:50:16 2019
+++ src/lib/libc/time/tzset.3	Tue Aug 23 10:54:50 2022
@@ -1,5 +1,5 @@
-.\"	$NetBSD: tzset.3,v 1.42 2019/07/03 15:50:16 christos Exp $
-.Dd July 2, 2019
+.\"	$NetBSD: tzset.3,v 1.43 2022/08/23 14:54:50 christos Exp $
+.Dd Auguset 23, 2021
 .Dt TZSET 3
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@ and
 functions.
 .Pp
 If
-.Ar tz
+.Ar zone
 is not a valid timezone description, or if the object cannot be allocated,
 .Fn tzalloc
 returns a



CVS commit: src/lib/libc/time

2022-08-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 23 14:54:50 UTC 2022

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

Log Message:
Fix argument name


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 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.



CVS commit: src/lib/libc/time

2022-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 16 11:07:40 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS ctime.3 private.h theory.html
tz-art.html tz-link.html tzfile.5 tzselect.8 tzselect.ksh version
zic.c

Log Message:
Welcome to tzcode-2022c

Work around a bug in onetrueawk that broke commands like
'make traditional_tarballs' on FreeBSD, macOS, etc.
(Problem reported by Deborah Goldsmith.)

Add code to tzselect that uses experimental structured comments in
zone1970.tab to clarify whether Zones like Africa/Abidjan and
Europe/Istanbul cross continent or ocean boundaries.
(Inspired by a problem reported by Peter Krefting.)

Fix bug with 'zic -d /a/b/c' when /a is unwritable but the
directory /a/b already exists.

Remove zoneinfo2tdf.pl, as it was unused and triggered false
malware alarms on some email servers.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/lib/libc/time/Makefile
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/time/NEWS
cvs rdiff -u -r1.62 -r1.63 src/lib/libc/time/ctime.3
cvs rdiff -u -r1.59 -r1.60 src/lib/libc/time/private.h
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/theory.html
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/tzselect.ksh \
src/lib/libc/time/version
cvs rdiff -u -r1.82 -r1.83 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.



CVS commit: src/lib/libc/time

2022-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 16 11:07:40 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS ctime.3 private.h theory.html
tz-art.html tz-link.html tzfile.5 tzselect.8 tzselect.ksh version
zic.c

Log Message:
Welcome to tzcode-2022c

Work around a bug in onetrueawk that broke commands like
'make traditional_tarballs' on FreeBSD, macOS, etc.
(Problem reported by Deborah Goldsmith.)

Add code to tzselect that uses experimental structured comments in
zone1970.tab to clarify whether Zones like Africa/Abidjan and
Europe/Istanbul cross continent or ocean boundaries.
(Inspired by a problem reported by Peter Krefting.)

Fix bug with 'zic -d /a/b/c' when /a is unwritable but the
directory /a/b already exists.

Remove zoneinfo2tdf.pl, as it was unused and triggered false
malware alarms on some email servers.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/lib/libc/time/Makefile
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/time/NEWS
cvs rdiff -u -r1.62 -r1.63 src/lib/libc/time/ctime.3
cvs rdiff -u -r1.59 -r1.60 src/lib/libc/time/private.h
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/time/theory.html
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/time/tz-art.html
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/time/tzfile.5
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/tzselect.ksh \
src/lib/libc/time/version
cvs rdiff -u -r1.82 -r1.83 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.51 src/lib/libc/time/Makefile:1.52
--- src/lib/libc/time/Makefile:1.51	Tue Aug 16 06:56:21 2022
+++ src/lib/libc/time/Makefile	Tue Aug 16 07:07:40 2022
@@ -298,8 +298,9 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
 # guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
 # Similarly, if your system has a "zone abbreviation" field, define
 #	-DTM_ZONE=tm_zone
-# and define NO_TM_ZONE to suppress any guessing.  These two fields are not
-# required by POSIX, but are widely available on GNU/Linux and BSD systems.
+# and define NO_TM_ZONE to suppress any guessing.  Although these two fields
+# not required by POSIX, a future version of POSIX is planned to require them
+# and they are widely available on GNU/Linux and BSD systems.
 #
 # The next batch of options control support for external variables
 # exported by tzcode.  In practice these variables are less useful
@@ -538,7 +539,7 @@ DATA=		$(TDATA_TO_CHECK) backzone iso316
 			leapseconds $(ZONETABLES)
 AWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk \
 			ziguard.awk zishrink.awk
-MISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
+MISC=		$(AWK_SCRIPTS)
 TZS_YEAR=	2050
 TZS_CUTOFF_FLAG=	-c $(TZS_YEAR)
 TZS=		to$(TZS_YEAR).tzs
@@ -567,7 +568,7 @@ VERSION_DEPS= \
 		tzfile.5 tzfile.h tzselect.8 tzselect.ksh \
 		workman.sh zdump.8 zdump.c zic.8 zic.c \
 		ziguard.awk zishrink.awk \
-		zone.tab zone1970.tab zoneinfo2tdf.pl
+		zone.tab zone1970.tab
 
 # And for the benefit of csh users on systems that assume the user
 # shell should be used to handle commands in Makefiles. . .

Index: src/lib/libc/time/NEWS
diff -u src/lib/libc/time/NEWS:1.36 src/lib/libc/time/NEWS:1.37
--- src/lib/libc/time/NEWS:1.36	Tue Aug 16 06:56:21 2022
+++ src/lib/libc/time/NEWS	Tue Aug 16 07:07:40 2022
@@ -1,5 +1,29 @@
 News for the tz database
 
+Release 2022c - 2022-08-15 17:47:18 -0700
+
+  Briefly:
+Work around awk bug in FreeBSD, macOS, etc.
+Improve tzselect on intercontinental Zones.
+
+  Changes to code
+
+Work around a bug in onetrueawk that broke commands like
+'make traditional_tarballs' on FreeBSD, macOS, etc.
+(Problem reported by Deborah Goldsmith.)
+
+Add code to tzselect that uses experimental structured comments in
+zone1970.tab to clarify whether Zones like Africa/Abidjan and
+Europe/Istanbul cross continent or ocean boundaries.
+(Inspired by a problem reported by Peter Krefting.)
+
+Fix bug with 'zic -d /a/b/c' when /a is unwritable but the
+directory /a/b already exists.
+
+Remove zoneinfo2tdf.pl, as it was unused and triggered false
+malware alarms on some email servers.
+
+
 Release 2022b - 2022-08-10 15:38:32 -0700
 
   Briefly:
@@ -83,7 +107,7 @@ Release 2022b - 2022-08-10 15:38:32 -070
 
 zic no longer complains "can't determine time zone abbreviation to
 use just after until time" when a transition to a new standard
-time occurs simultanously with the first DST fallback transition.
+time occurs simultaneously with the first DST fallback transition.
 
   Changes to build procedure
 

Index: src/lib/libc/time/ctime.3
diff -u src/lib/libc/time/ctime.3:1.62 src/lib/libc/time/ctime.3:1.63
--- src/lib/libc/time/ctime.3:1.62	Tue Sep 28 02:45:08 2021
+++ 

CVS commit: src/lib/libc/time

2022-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 16 10:56:22 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS asctime.c calendars localtime.c
private.h strftime.c theory.html tz-how-to.html tz-link.html
tzselect.8 version zdump.c zic.8 zic.c

Log Message:
Welcome to 2022b:

zic has a new option '-R @N' to output explicit transitions < N.
(Need suggested by Almaz Mingaleev.)

'zic -r @N' no longer outputs bad data when N < first transition.
(Problem introduced in 2021d and reported by Peter Krefting.)

zic now checks its input for NUL bytes and unterminated lines, and
now supports input line lengths up to 2048 (not 512) bytes.

gmtime and related code now use the abbreviation "UTC" not "GMT".
POSIX is being revised to require this.

When tzset and related functions set vestigial static variables
like tzname, they now prefer specified timestamps to unspecified ones.
(Problem reported by Almaz Mingaleev.)

zic no longer complains "can't determine time zone abbreviation to
use just after until time" when a transition to a new standard
time occurs simultanously with the first DST fallback transition.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/time/Makefile
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/time/NEWS
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/asctime.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/calendars
cvs rdiff -u -r1.133 -r1.134 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.58 -r1.59 src/lib/libc/time/private.h
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/theory.html
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/tz-how-to.html
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/version
cvs rdiff -u -r1.56 -r1.57 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/zic.8
cvs rdiff -u -r1.81 -r1.82 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.50 src/lib/libc/time/Makefile:1.51
--- src/lib/libc/time/Makefile:1.50	Tue Mar 22 13:48:39 2022
+++ src/lib/libc/time/Makefile	Tue Aug 16 06:56:21 2022
@@ -33,7 +33,7 @@ DATAFORM=		main
 #	make zonenames
 # to get a list of the values you can use for LOCALTIME.
 
-LOCALTIME=	GMT
+LOCALTIME=	Factory
 
 # The POSIXRULES macro controls interpretation of nonstandard and obsolete
 # POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules.
@@ -176,12 +176,19 @@ TZDATA_TEXT=	leapseconds tzdata.zi
 
 BACKWARD=	backward
 
-# If you want out-of-scope and often-wrong data from the file 'backzone', use
+# If you want out-of-scope and often-wrong data from the file 'backzone',
+# but only for entries listed in the backward-compatibility file zone.tab, use
 #	PACKRATDATA=	backzone
+#	PACKRATLIST=	zone.tab
+# If you want all the 'backzone' data, use
+#	PACKRATDATA=	backzone
+#	PACKRATLIST=
 # To omit this data, use
 #	PACKRATDATA=
+#	PACKRATLIST=
 
 PACKRATDATA=
+PACKRATLIST=
 
 # The name of a locale using the UTF-8 encoding, used during self-tests.
 # The tests are skipped if the name does not appear to work on this system.
@@ -264,7 +271,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
   $(GCC_INSTRUMENT) \
   -Wall -Wextra \
   -Walloc-size-larger-than=10 -Warray-bounds=2 \
-  -Wbad-function-cast -Wcast-align=strict -Wdate-time \
+  -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
   -Wdeclaration-after-statement -Wdouble-promotion \
   -Wduplicated-branches -Wduplicated-cond \
   -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
@@ -278,7 +285,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
   -Wsuggest-attribute=const -Wsuggest-attribute=format \
   -Wsuggest-attribute=malloc \
   -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
-  -Wtrampolines -Wundef -Wuninitialized -Wunused-macros \
+  -Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
   -Wvariadic-macros -Wvla -Wwrite-strings \
   -Wno-address -Wno-format-nonliteral -Wno-sign-compare \
   -Wno-type-limits -Wno-unused-parameter
@@ -448,6 +455,9 @@ UNUSUAL_OK_IPA = u̯
 # useful in commentary.
 UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
 
+# Put this in a bracket expression to match spaces.
+s = [:space:]
+
 # OK_CHAR matches any character allowed in the distributed files.
 # This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
 # multibyte letters are also allowed so that commentary can contain a
@@ -521,8 +531,9 @@ TDATA=		$(YDATA) $(NDATA) $(BACKWARD)
 ZONETABLES=	zone1970.tab zone.tab
 TABDATA=	iso3166.tab $(TZDATA_TEXT) $(ZONETABLES)
 LEAP_DEPS=	leapseconds.awk leap-seconds.list
-TZDATA_ZI_DEPS=	ziguard.awk zishrink.awk version $(TDATA) 

CVS commit: src/lib/libc/time

2022-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 16 10:56:22 UTC 2022

Modified Files:
src/lib/libc/time: Makefile NEWS asctime.c calendars localtime.c
private.h strftime.c theory.html tz-how-to.html tz-link.html
tzselect.8 version zdump.c zic.8 zic.c

Log Message:
Welcome to 2022b:

zic has a new option '-R @N' to output explicit transitions < N.
(Need suggested by Almaz Mingaleev.)

'zic -r @N' no longer outputs bad data when N < first transition.
(Problem introduced in 2021d and reported by Peter Krefting.)

zic now checks its input for NUL bytes and unterminated lines, and
now supports input line lengths up to 2048 (not 512) bytes.

gmtime and related code now use the abbreviation "UTC" not "GMT".
POSIX is being revised to require this.

When tzset and related functions set vestigial static variables
like tzname, they now prefer specified timestamps to unspecified ones.
(Problem reported by Almaz Mingaleev.)

zic no longer complains "can't determine time zone abbreviation to
use just after until time" when a transition to a new standard
time occurs simultanously with the first DST fallback transition.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/time/Makefile
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/time/NEWS
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/asctime.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/calendars
cvs rdiff -u -r1.133 -r1.134 src/lib/libc/time/localtime.c
cvs rdiff -u -r1.58 -r1.59 src/lib/libc/time/private.h
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/time/strftime.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/time/theory.html
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/time/tz-how-to.html
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/tz-link.html
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/time/tzselect.8
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/time/version
cvs rdiff -u -r1.56 -r1.57 src/lib/libc/time/zdump.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/time/zic.8
cvs rdiff -u -r1.81 -r1.82 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.



Re: CVS commit: src/lib/libc/time

2022-03-26 Thread Christos Zoulas
In article <977b81a4-d330-6722-7ce4-cc4e61011...@gmx.de>,
Roland Illig   wrote:
>Am 25.03.2022 um 22:25 schrieb Christos Zoulas:
>> In article <20220325183551.0f039f...@cvs.netbsd.org>,
>> Roland Illig  wrote:
>>> -=-=-=-=-=-
>>>
>>> Module Name:src
>>> Committed By:   rillig
>>> Date:   Fri Mar 25 18:35:50 UTC 2022
>>>
>>> Modified Files:
>>> src/lib/libc/time: localtime.c
>>>
>>> Log Message:
>>> localtime.c: add back storage class 'register'
>>>
>>> This reduces the differences to the upstream code.
>>
>> I don't know why you did that. It is as simple to sed -e 's/register //g'
>> in upstream when you diff. Adding register is useless; these days it is
>> mostly ignored by compilers, except you can't &...
>
>I thought that having a small diff to the upstream code was more
>important than a few saved keywords.  If I was wrong, I can of course
>revert it.

I don't care too much, less clutter without obsolete keywords that do
nothing or worse.

christos



Re: CVS commit: src/lib/libc/time

2022-03-25 Thread Roland Illig

Am 26.03.2022 um 00:50 schrieb Tobias Nygren:

On Sat, 26 Mar 2022 00:31:45 +0100
Roland Illig  wrote:


localtime.c: add back storage class 'register'

This reduces the differences to the upstream code.


I don't know why you did that. It is as simple to sed -e 's/register //g'
in upstream when you diff. Adding register is useless; these days it is
mostly ignored by compilers, except you can't &...


I thought that having a small diff to the upstream code was more
important than a few saved keywords.  If I was wrong, I can of course
revert it.


Can we keep it as-is, but #define register to empty at the top of the file?


I don't think the compiler's view on the code is the main point of this
discussion.  At least, GCC generates the same code on x86_64, with or
without 'register', so it doesn't seem to care.

To me, the more interesting question is how human readers should deal
with the code.

If this piece of code had originated in the NetBSD tree, I wouldn't have
added the 'register' keywords, I would have just indented the code
according to KNF.

But, most of this code is copied from the tz project, therefore our goal
should be to make the diff minimal, in order to benefit from the testing
of other projects using the same code.  In this case, it means to keep
the indentation exactly as inconsistent as upstream and also to keep the
keyword 'register'.  The remaining diff is still large enough to consume
some developer time, containing a few fixes for WARNS=6 and for the lint
checks.

Roland


Re: CVS commit: src/lib/libc/time

2022-03-25 Thread Tobias Nygren
On Sat, 26 Mar 2022 00:31:45 +0100
Roland Illig  wrote:

> >> localtime.c: add back storage class 'register'
> >>
> >> This reduces the differences to the upstream code.
> >
> > I don't know why you did that. It is as simple to sed -e 's/register //g'
> > in upstream when you diff. Adding register is useless; these days it is
> > mostly ignored by compilers, except you can't &...
> 
> I thought that having a small diff to the upstream code was more
> important than a few saved keywords.  If I was wrong, I can of course
> revert it.

Can we keep it as-is, but #define register to empty at the top of the file?



  1   2   3   4   5   6   >