public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: libc-alpha@sourceware.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 34/59] mktime should not consult 'daylight'
Date: Sat,  4 Jan 2025 21:57:09 -0800	[thread overview]
Message-ID: <20250105055750.1668721-35-eggert@cs.ucla.edu> (raw)
In-Reply-To: <01207110-bd60-46ae-9c08-fb39c2011067@cs.ucla.edu>

* lib/mktime.c (__mktime_internal): Do not consult __daylight as it
has unreliable contents when a geographical timezone is used, and the
user can set it.  Instead, use tm_isdst for mktime, and ignore
tm_isdst for timegm.  This patch is cherry-picked from Gnulib commit
72abb08f4495bf232736f4d13a24bced72a9c327 dated Thu Nov 14 10:40:24
2024 -0700.
---
 time/mktime.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/time/mktime.c b/time/mktime.c
index 3a951b2c8c..0981cd1d1d 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -356,8 +356,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;
-- 
2.45.2


  parent reply	other threads:[~2025-01-05  5:59 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-02 17:42 [PATCH v2 0/4] mktime tm_isdst compatibility improvements Florian Weimer
2025-01-02 17:42 ` [PATCH v2 1/4] time: Use __tz_convert in mktime implementation Florian Weimer
2025-01-02 17:42 ` [PATCH v2 2/4] time: Push tzset lock into callers of time functions Florian Weimer
2025-01-02 17:42 ` [PATCH v2 3/4] time: Do not perform forced DST adjustment for DST-less zones Florian Weimer
2025-01-02 17:42 ` [PATCH v2 4/4] time: Implement the glibc.time.mktime_dst_adjustment tunable Florian Weimer
2025-01-05  2:58 ` [PATCH v2 0/4] mktime tm_isdst compatibility improvements Paul Eggert
2025-01-05  5:56   ` [PATCH 00/59] time: sync mktime from Gnulib Paul Eggert
2025-01-06 14:30     ` Carlos O'Donell
2025-01-06 21:34       ` Joseph Myers
2025-01-06 21:43         ` Paul Eggert
2025-01-05  5:56   ` [PATCH 01/59] Split intprops.h into two Paul Eggert
2025-01-05  5:56   ` [PATCH 02/59] Support stdckdint.h internally if older GCC Paul Eggert
2025-01-05  5:56   ` [PATCH 03/59] Fix mishandling of default DST rule Paul Eggert
2025-01-05  5:56   ` [PATCH 04/59] Don't worry about !TZDEFAULT Paul Eggert
2025-01-05  5:56   ` [PATCH 05/59] Support static_assert in pre-C23 C Paul Eggert
2025-01-05  5:56   ` [PATCH 06/59] Sync mktime.c from Gnulib 2024-10-04 Paul Eggert
2025-01-05  5:56   ` [PATCH 07/59] Document mktime out-of-range + tm_isdst Paul Eggert
2025-01-05  8:03     ` Florian Weimer
2025-01-05 14:03       ` Paul Eggert
2025-01-05  5:56   ` [PATCH 08/59] Push tzset lock into callers of time functions Paul Eggert
2025-01-05  5:56   ` [PATCH 09/59] Omit parse_offset unnecessary *tz == '\0' Paul Eggert
2025-01-05  5:56   ` [PATCH 10/59] Don’t assume TZif bloat is likely Paul Eggert
2025-01-05  5:56   ` [PATCH 11/59] tzset no longer calls ftello Paul Eggert
2025-01-05  5:56   ` [PATCH 12/59] Check TZif files more carefully Paul Eggert
2025-01-05  5:56   ` [PATCH 13/59] Remove alignment assumption from __tzfile_read Paul Eggert
2025-01-05  5:56   ` [PATCH 14/59] Treat oddball UTC offset strings as zero Paul Eggert
2025-01-05  5:56   ` [PATCH 15/59] Simplify __tz_compute Paul Eggert
2025-01-05  5:56   ` [PATCH 16/59] Improve performance in 2 BC Paul Eggert
2025-01-05  5:56   ` [PATCH 17/59] Don’t mishandle years < 1970 in compute_change Paul Eggert
2025-01-05  5:56   ` [PATCH 18/59] Match RFC 9636 names Paul Eggert
2025-01-05  5:56   ` [PATCH 19/59] Trivial tzset_internal speedup Paul Eggert
2025-01-05  5:56   ` [PATCH 20/59] Fix obscure bug when stdoffset == dstoffset Paul Eggert
2025-01-05  5:56   ` [PATCH 21/59] Document assumption that NO_DST == 0 Paul Eggert
2025-01-05  5:56   ` [PATCH 22/59] __use_tzfile is boolean Paul Eggert
2025-01-05  5:56   ` [PATCH 23/59] Minor tzfile.c clarity improvements Paul Eggert
2025-01-05  5:56   ` [PATCH 24/59] Stop using zic's -y option Paul Eggert
2025-01-05  5:57   ` [PATCH 25/59] Fix mishandling of default DST rule Paul Eggert
2025-01-05  5:57   ` [PATCH 26/59] Simplify treatment of missing and empty TZ Paul Eggert
2025-01-05  5:57   ` [PATCH 27/59] TZ="" always means UTC sans leap seconds Paul Eggert
2025-01-05  5:57   ` [PATCH 28/59] Prefer "UTC" for UTC Paul Eggert
2025-01-05  5:57   ` [PATCH 29/59] Simplify setting tz_rules to UTC Paul Eggert
2025-01-05  5:57   ` [PATCH 30/59] Update tzname etc. even if TZ is unchanged Paul Eggert
2025-01-05  5:57   ` [PATCH 31/59] "POSIX TZ" -> "proleptic TZ" Paul Eggert
2025-01-05  5:57   ` [PATCH 32/59] Reject invalid TZ strings in TZif files Paul Eggert
2025-01-05  5:57   ` [PATCH 33/59] Reject TZif files containing '\0' in TZ string Paul Eggert
2025-01-05  5:57   ` Paul Eggert [this message]
2025-01-05  5:57   ` [PATCH 35/59] Remove __use_tzfile Paul Eggert
2025-01-05  5:57   ` [PATCH 36/59] Remove arbitrary limit on TZ, TZDIR lengths Paul Eggert
2025-01-05  5:57   ` [PATCH 37/59] Tighten setuid TZif file name check Paul Eggert
2025-01-05  5:57   ` [PATCH 38/59] Avoid a malloc in __tzfile_read Paul Eggert
2025-01-05  5:57   ` [PATCH 39/59] Free earlier " Paul Eggert
2025-01-05  5:57   ` [PATCH 40/59] Improve __tzfile_read TZ="" comment Paul Eggert
2025-01-05  5:57   ` [PATCH 41/59] Refactor enum tz_rule_type Paul Eggert
2025-01-05  5:57   ` [PATCH 42/59] __offtime now returns struct tm * Paul Eggert
2025-01-05  5:57   ` [PATCH 43/59] Fix overflow checking in offtime Paul Eggert
2025-01-05  5:57   ` [PATCH 44/59] Handle TZif time type 0 correctly Paul Eggert
2025-01-05  5:57   ` [PATCH 45/59] Remove invalid tzset tests from tst-bz29951.c Paul Eggert
2025-01-05  5:57   ` [PATCH 46/59] tzset, not localtime, now parses TZif TZ spec Paul Eggert
2025-01-05  5:57   ` [PATCH 47/59] Minor compute_change widening tweak Paul Eggert
2025-01-05  5:57   ` [PATCH 48/59] Minor SECSPERDAY " Paul Eggert
2025-01-05  5:57   ` [PATCH 49/59] Remove leap-second goto from __tzfile_compute Paul Eggert
2025-01-05  5:57   ` [PATCH 50/59] Remove use_last label " Paul Eggert
2025-01-05  5:57   ` [PATCH 51/59] Refactor ‘if’ in __tzfile_compute Paul Eggert
2025-01-05  5:57   ` [PATCH 52/59] Refactor localtime " Paul Eggert
2025-01-05  5:57   ` [PATCH 53/59] Refactor post-transition-table ‘if’ Paul Eggert
2025-01-05  5:57   ` [PATCH 54/59] Refactor __tzfile_compute to avoid two gotos Paul Eggert
2025-01-05  5:57   ` [PATCH 55/59] Refactor __tzfile_compute index local Paul Eggert
2025-01-05  5:57   ` [PATCH 56/59] mktime: prefer bool to int Paul Eggert
2025-01-05  5:57   ` [PATCH 57/59] mktime: port __mktime64 locking to Gnulib Paul Eggert
2025-01-05  5:57   ` [PATCH 58/59] mktime: improve tm_isdst heuristic Paul Eggert
2025-01-05  5:57   ` [PATCH 59/59] time: test DST adjustment for DST-less zones Paul Eggert
2025-01-07  8:59   ` [PATCH v2 0/4] mktime tm_isdst compatibility improvements Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250105055750.1668721-35-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).