From 72abb08f4495bf232736f4d13a24bced72a9c327 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 14 Nov 2024 10:40:24 -0700 Subject: [PATCH] =?utf8?q?mktime:=20don=E2=80=99t=20consult=20daylight?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * lib/mktime.c (__mktime_internal): Do not consult __daylight as it has unreliable contents - among other things, the user can set it. It also wasn’t being configured properly for mingw-w64; this problem was reported by Markus Muetzel in . * m4/mktime.m4 (gl_PREREQ_MKTIME): Do not check for ‘daylight’; no longer needed. --- ChangeLog | 11 +++++++++++ lib/mktime.c | 4 ++-- m4/mktime.m4 | 22 ++-------------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index da783e9f32..c74117ac6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2024-11-14 Paul Eggert + + mktime: don’t consult daylight + * lib/mktime.c (__mktime_internal): Do not consult __daylight + as it has unreliable contents - among other things, the user + can set it. It also wasn’t being configured properly for + mingw-w64; this problem was reported by Markus Muetzel in + . + * m4/mktime.m4 (gl_PREREQ_MKTIME): Do not check for ‘daylight’; + no longer needed. + 2024-11-14 Bruno Haible Eliminate gcc -Wzero-as-null-pointer-constant warnings. diff --git a/lib/mktime.c b/lib/mktime.c index 7f07abb814..81d58fd01a 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -350,8 +350,8 @@ __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset) int mon = tp->tm_mon; int year_requested = tp->tm_year; - /* If the timezone never observes DST, ignore any tm_isdst request. */ - int isdst = local && __daylight ? tp->tm_isdst : 0; + /* Ignore any tm_isdst request for timegm. */ + int isdst = local ? tp->tm_isdst : 0; /* 1 if the previous probe was DST. */ int dst2 = 0; diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 5f8c608271..cc4998804e 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,5 +1,5 @@ # mktime.m4 -# serial 41 +# serial 42 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, @@ -316,22 +316,4 @@ AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [ ]) # Prerequisites of lib/mktime.c. -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 1; do - test $gl_cv_var___daylight = 1 && break - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], - [[return $gl_cv_var___daylight;]]) - ], - [break]) - done]) - AS_CASE([$gl_cv_var___daylight], - [__daylight], [], - [AC_DEFINE_UNQUOTED([__daylight], [$gl_cv_var___daylight], - [Define to an expression equivalent to daylight - if __daylight does not already do that.])]) -]) +AC_DEFUN([gl_PREREQ_MKTIME], [:]) -- 2.39.5