From patchwork Tue Oct 1 12:14:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1991445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YVcCN7qg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XHxhf5jfWz1xtY for ; Tue, 1 Oct 2024 22:14:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1E9523842422 for ; Tue, 1 Oct 2024 12:14:56 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id D0870386D600 for ; Tue, 1 Oct 2024 12:14:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0870386D600 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D0870386D600 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727784879; cv=none; b=CTB8MkcyYLGSc9Tev8nzxEJrdylP1kglrtOj7cZ7UMTeVJbW8khUteoOv0hMYflNVh2dkRp1xFa1rasVyEh2Y2lILb1bQFQsTdOm67dsxtXZk6lQn8/vrE2yuecSDsc9MWDCxCphla7smn9TDschSLBTvwGI32r3fFizb7Z8y/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727784879; c=relaxed/simple; bh=f9wZMz0z1GDsgRSoTDi5t28l+qh+GU3jO6JuRkPeMeE=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=r93/1gBYloeqy8xb6f42ZONeFsRpY+wb7zAZEjb7L1PPaVc+LW3oef0ONLwkt4VDHOiEZxz0OC54tPXbRMWNnGA0EnkAxQIbARV7GV8r+HphnktrTuqQ5gvCEsiKfxZS9rTMWN57/OUbo/6m1F+CKmOrkPuvt7R4XHQaZsqEp1U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727784877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=6I78I/t75SiFaKL7s4GhrlwbWuVx+CKBXSVRZUxx89M=; b=YVcCN7qgKqoiVkZ0f0CmOF558mkv5U9qxzw5ErcDRXRsDUtM75EwB4MQWNj2M9FlgVCV+i OLgMWxyP223oUXRzQnO2OODvUU2t8bvKbDm3wlTR6jGeniMxkez5UcxPL0RwLET4px0TE3 rfElB9amW+1poFfeqwD9D936w7etR38= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-tFwgTXoLOj-NlNpvEWeG9g-1; Tue, 01 Oct 2024 08:14:36 -0400 X-MC-Unique: tFwgTXoLOj-NlNpvEWeG9g-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B6305196A429 for ; Tue, 1 Oct 2024 12:14:35 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.45.224.151]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C659D3003E4D for ; Tue, 1 Oct 2024 12:14:34 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 0/4] mktime tm_isdst compatibility improvements Message-ID: X-From-Line: 4b54ff2cd98520b5e1bf31da5b3ec0a2713ad3b3 Mon Sep 17 00:00:00 2001 Date: Tue, 01 Oct 2024 14:14:31 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This series fixes some divergence with historic mktime behavior (particularly for UTC) and adds a tunable to disable DST adjustment heuristics. I also try to explain the tm_isdst handling in greater detail in the manual. Tested on i686-linux-gnu and x86_64-linux-gnu. Thanks, Florian Florian Weimer (4): time: Use a flag for localtime/gmtime operation in __mktime_internal time: Push tzset lock into callers of time functions time: Do not perform forced DST adjustment for DST-less zones time: Implement the glibc.time.mktime_dst_adjustment tunable elf/dl-tunables.list | 9 ++ elf/libc_early_init.c | 3 + include/time.h | 23 ----- manual/time.texi | 42 ++++++++- manual/tunables.texi | 12 +++ time/Makefile | 8 +- time/gmtime.c | 8 +- time/localtime.c | 8 +- time/mktime-internal.h | 11 +-- time/mktime.c | 117 ++++++++++++++++--------- time/strftime_l.c | 1 + time/time-tunables.c | 29 ++++++ time/timegm.c | 13 ++- time/tst-mktime-dst-adjust-0.c | 154 ++++++++++++++++++++++++++++++++ time/tst-mktime-dst-adjust-1.c | 2 + time/tst-mktime-dst-adjust.c | 156 +++++++++++++++++++++++++++++++++ time/tzfile.c | 1 + time/tzset.c | 20 +++-- time/tzset.h | 40 +++++++++ timezone/testdata/IST | Bin 0 -> 285 bytes 20 files changed, 569 insertions(+), 88 deletions(-) create mode 100644 time/time-tunables.c create mode 100644 time/tst-mktime-dst-adjust-0.c create mode 100644 time/tst-mktime-dst-adjust-1.c create mode 100644 time/tst-mktime-dst-adjust.c create mode 100644 time/tzset.h create mode 100644 timezone/testdata/IST base-commit: 9dfea3de7f690bff70e3c6eb346b9ad082bb2e35