On 2024-10-04 13:42, Bruno Haible wrote:
All existing unit tests succeed. But would it not produce more correct
results in general to set this to 1 instead of 0? That is, if we are
in the mktime()/localtime() pair, if we know nothing about the time zone,
assume that is has DST?

Thanks, good catch. I installed the attached.

POSIX says 'daylight' is an X/Open extension to POSIX, so FreeBSD is still conforming to POSIX here. Normally I'd expect FreeBSD to support XSI too, but the 'daylight' and 'timezone' variables are so useless that I guess they drew the line.
From cc292ecda26359d5a80989bdbd1633f2f0721628 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sat, 5 Oct 2024 09:02:23 -0700
Subject: [PATCH] mktime: fix daylight default

Problem for FreeBSD 14 reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2024-10/msg00026.html
* m4/mktime.m4 (gl_PREREQ_MKTIME): Default daylight to 1, not 0.
---
 ChangeLog    | 7 +++++++
 m4/mktime.m4 | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 65fd11b2bf..76f55fdeb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-10-05  Paul Eggert  <egg...@cs.ucla.edu>
+
+	mktime: fix daylight default
+	Problem for FreeBSD 14 reported by Bruno Haible in:
+	https://lists.gnu.org/r/bug-gnulib/2024-10/msg00026.html
+	* m4/mktime.m4 (gl_PREREQ_MKTIME): Default daylight to 1, not 0.
+
 2024-10-04  Paul Eggert  <egg...@cs.ucla.edu>
 
 	mktime: improve thread-safety
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index 14ced571e0..837af0b0c3 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,5 +1,5 @@
 # mktime.m4
-# serial 40
+# serial 41
 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -318,8 +318,8 @@ AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [
 AC_DEFUN([gl_PREREQ_MKTIME], [
   AC_CACHE_CHECK([spelling of daylight variable],
     [gl_cv_var___daylight],
-    [for gl_cv_var___daylight in __daylight daylight _daylight 0; do
-       test $gl_cv_var___daylight = 0 && break
+    [for gl_cv_var___daylight in __daylight daylight _daylight 1; do
+       test $gl_cv_var___daylight = 1 && break
        AC_LINK_IFELSE(
          [AC_LANG_PROGRAM(
             [[#include <time.h>
-- 
2.43.0

Reply via email to