Commit Diff


commit - ea41105e137c538f46beddcb5ebbe8df068f69ab
commit + 64029920d8548ac7cd2ababbac34963be159c472
blob - 5acd7e137c2267187592eb94c33a57dface99861
blob + facb42d29db1b0dafd87f063173ef62a13e0f3e2
--- usr.sbin/zdump/zdump.8
+++ usr.sbin/zdump/zdump.8
@@ -1,5 +1,5 @@
-.\"	$OpenBSD: zdump.8,v 1.3 2022/09/11 06:38:12 jmc Exp $
-.Dd $Mdocdate: September 11 2022 $
+.\"	$OpenBSD: zdump.8,v 1.4 2025/05/16 13:51:04 millert Exp $
+.Dd $Mdocdate: May 16 2025 $
 .Dt ZDUMP 8
 .Os
 .Sh NAME
@@ -45,15 +45,10 @@ if the given time is Daylight Saving Time or
 otherwise.
 .El
 .Sh LIMITATIONS
-The
-.Fl v
-option may not be used on systems with floating-point
-.Vt time_t
-values that are neither float nor double.
-.Pp
 Time discontinuities are found by sampling the results returned by localtime
 at twelve-hour intervals.
 This works in all real-world cases;
+one can construct artificial time zones for which this fails.
 .\" @(#)zdump.8	8.1
 .Sh SEE ALSO
 .Xr ctime 3 ,
blob - fc36eec5c374e49e4bfc3f3897bc0205590934dd
blob + 330f9d1126a22ce0946bc88cad218bb05d291cf7
--- usr.sbin/zdump/zdump.c
+++ usr.sbin/zdump/zdump.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: zdump.c,v 1.15 2025/04/13 15:42:59 florian Exp $ */
+/*	$OpenBSD: zdump.c,v 1.16 2025/05/16 13:51:04 millert Exp $ */
 /*
 ** This file is in the public domain, so clarified as of
 ** 2009-05-17 by Arthur David Olson.
@@ -11,6 +11,7 @@
 */
 
 #include <ctype.h>
+#include <limits.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -50,19 +51,18 @@ extern char	**environ;
 extern char	*tzname[2];
 extern char 	*__progname;
 
-time_t		absolute_min_time;
-time_t		absolute_max_time;
-size_t		longest;
-int		warned;
+static const time_t	absolute_min_time = LLONG_MIN;
+static const time_t	absolute_max_time = LLONG_MAX;
+static size_t		longest;
+static int		warned;
 
 static char 		*abbr(struct tm *tmp);
 static void		abbrok(const char *abbrp, const char *zone);
-static long		delta(struct tm *newp, struct tm *oldp);
+static __pure long	delta(struct tm *newp, struct tm *oldp);
 static void		dumptime(const struct tm *tmp);
-static time_t		hunt(char *name, time_t lot, time_t	hit);
-static void		setabsolutes(void);
+static time_t		hunt(char *name, time_t lot, time_t hit);
 static void		show(char *zone, time_t t, int v);
-static time_t		yeartot(long y);
+static __pure time_t	yeartot(long y);
 static void		usage(void);
 
 static void
@@ -151,7 +151,6 @@ main(int argc, char *argv[])
 				exit(EXIT_FAILURE);
 			}
 		}
-		setabsolutes();
 		cutlotime = yeartot(cutloyear);
 		cuthitime = yeartot(cuthiyear);
 	}
@@ -236,23 +235,6 @@ main(int argc, char *argv[])
 	return 0;
 }
 
-static void
-setabsolutes(void)
-{
-	time_t t = 0, t1 = 1;
-
-	while (t < t1) {
-		t = t1;
-		t1 = 2 * t1 + 1;
-	}
-
-	absolute_max_time = t;
-	t = -t;
-	absolute_min_time = t - 1;
-	if (t < absolute_min_time)
-		absolute_min_time = t;
-}
-
 static time_t
 yeartot(const long y)
 {