From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess) Date: Thu, 26 May 2022 14:13:52 +0200 Message-ID: <87o7zkbif3.fsf@gnus.org> References: <940415ce-2e31-ae18-3e16-8fdc54504a67@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36760"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 55635@debbugs.gnu.org, Paul Eggert To: Maxim Nikulin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 26 14:21:13 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nuCUL-0009M7-75 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 May 2022 14:21:13 +0200 Original-Received: from localhost ([::1]:36122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nuCUK-0003QP-2C for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 May 2022 08:21:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuCON-0004Vn-EA for bug-gnu-emacs@gnu.org; Thu, 26 May 2022 08:15:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nuCOM-0000Z4-6T for bug-gnu-emacs@gnu.org; Thu, 26 May 2022 08:15:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nuCOL-0004Bm-SS for bug-gnu-emacs@gnu.org; Thu, 26 May 2022 08:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 May 2022 12:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55635 X-GNU-PR-Package: emacs Original-Received: via spool by 55635-submit@debbugs.gnu.org id=B55635.165356724716022 (code B ref 55635); Thu, 26 May 2022 12:15:01 +0000 Original-Received: (at 55635) by debbugs.gnu.org; 26 May 2022 12:14:07 +0000 Original-Received: from localhost ([127.0.0.1]:57192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuCNS-0004AL-Nf for submit@debbugs.gnu.org; Thu, 26 May 2022 08:14:06 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:56742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuCNP-00049d-CA for 55635@debbugs.gnu.org; Thu, 26 May 2022 08:14:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=g2dhkIWxsW25rzTo8lXkqUvEvaooOrEvGvzbFBS+SnY=; b=aWKtJuXCuFqLxEFzOYBDFq6cEM MIcoErGuBYnSmp7/tyQNJsSlcDyPwTAGl/YDwQ/26w4wK5lh7Fn4WkAnlOjNHLpaDbV01lzyeL2Hy DdJLEPyLlej/mI3PwX/4Nm72ZODAugMTzaG5RLFDGIbqmdf48c0J3PFrvROq2yMtJ8Hs=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nuCNF-0004Nq-Af; Thu, 26 May 2022 14:13:55 +0200 X-Now-Playing: Talking Heads's _The Name Of This Band Is Talking Heads (Disc 2: 1980-1981)_: "Drugs (Electricity)" In-Reply-To: <940415ce-2e31-ae18-3e16-8fdc54504a67@gmail.com> (Maxim Nikulin's message of "Wed, 25 May 2022 21:46:50 +0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233105 Archived-At: Maxim Nikulin writes: > Consider the following example: > > (format-time-string > "%F %T %Z %z" > (encode-time > (make-decoded-time :year 2022 :month 3 :day 31 > :hour 23 :minute 30 :second 0 > :zone "Europe/Madrid")) > "Europe/Madrid") > "2022-04-01 00:30:00 CEST +0200" > > I believe that the result should be > "2022-03-31 23:30:00 CEST +0200" > It can be obtained if :dst -1 is explicitly added to the > `make-decoded-time' arguments. > > Since `make-decoded-time' is defined using `cl-defun', I think, it is > better to use -1 ("guess") default value for the :dst argument, not > nil that explicitly says "no daylight saving time". I think that makes some sense, but on the other hand, that's just a simple helper function that does what it says -- "with only the keywords given filled out". But perhaps -1 is less "filled out" than nil in this case. > There is `decoded-time-set-defaults', but it does not help > > (format-time-string > "%F %T %Z %z" > (encode-time > (decoded-time-set-defaults > (make-decoded-time :year 2022 :month 3 :day 31 > :hour 23 :minute 30) > "Europe/Madrid")) > "Europe/Madrid") > "2022-04-01 01:30:00 CEST +0200" > > This case I have no idea how to fix the issue. It's this code, I guess: ;; When we don't have a time zone, default to DEFAULT-ZONE without ;; DST if DEFAULT-ZONE if given, and to unknown DST otherwise. (unless (decoded-time-zone time) (if default-zone (progn (setf (decoded-time-zone time) default-zone) (setf (decoded-time-dst time) nil)) (setf (decoded-time-dst time) -1))) I've added Paul to the CCs; perhaps he has some comments. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no