From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxim Nikulin Newsgroups: gmane.emacs.bugs Subject: bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess) Date: Wed, 25 May 2022 21:46:50 +0700 Message-ID: <940415ce-2e31-ae18-3e16-8fdc54504a67@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26202"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 To: 55635@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 25 17:13:29 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 1ntshV-0006dN-6J for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 May 2022 17:13:29 +0200 Original-Received: from localhost ([::1]:58726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntshU-0005FN-21 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 May 2022 11:13:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntsIt-0005Pg-BQ for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:48:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34082) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntsIs-0007u7-DK for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:48:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ntsIs-0001AM-93 for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Maxim Nikulin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 May 2022 14:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55635 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16534900224234 (code B ref -1); Wed, 25 May 2022 14:48:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 May 2022 14:47:02 +0000 Original-Received: from localhost ([127.0.0.1]:56212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntsHt-00016A-P1 for submit@debbugs.gnu.org; Wed, 25 May 2022 10:47:01 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntsHs-00015z-AQ for submit@debbugs.gnu.org; Wed, 25 May 2022 10:47:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntsHr-0004eC-0p for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:46:59 -0400 Original-Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:39437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntsHp-0007hU-As for bug-gnu-emacs@gnu.org; Wed, 25 May 2022 10:46:58 -0400 Original-Received: by mail-lf1-x134.google.com with SMTP id y32so36367689lfa.6 for ; Wed, 25 May 2022 07:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:date:mime-version:user-agent:to:content-language :subject:content-transfer-encoding; bh=6bckdsNsjy+VClOR73p50sN89C1BCVZPw1qqROCfGiU=; b=FD37sI28+q42AeJWqRolamRYNpb6JnVJoUD8JbbfQEBV0zxHgpgdoZD18PduBViO33 xKX6+uEOHsJPZKgLHDZOmF3dJsFUzDk3aGAg4NoovfGw8VCFgX2fm7ucqCAk1Vo6k987 XAcQ5jQTDe8C7bMmreHWtmo/hb6WB77MvlfqEZclGWL4CVaamqhZu2ecuLh4uR9ry24u cDr7jvFrQN7i2DdjZFitp4nRsmhdRAL8R0wcbLWYSIhsBEcp3qHZXY7Vv11enlVhcvfc 9zOyKTbRpqmILo22O2tTCpc9+9EcO0SW3JhuFQ0Y6eCDzoNUDhK0NXz+7Si2TEns70xr uHCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:date:mime-version:user-agent:to :content-language:subject:content-transfer-encoding; bh=6bckdsNsjy+VClOR73p50sN89C1BCVZPw1qqROCfGiU=; b=L/J2iiB1L2PCoCLsT63mLBsPIUbs5XH+VNcZWcIXYSU2GSdSQ4cnB9JkM2pJkcOmp4 4+wgNBAlFqfUxaKxCuXcbU/o3dMCQ1SB7Lz/0rL5w4mgc5e+m0DtLHDPTdVQ6bIgrtS6 CiXMNvTLIZN+SBVjlwccLkOYsiLxL/KjXJb77WEjqe9GR/YlV7TjT9oxpixWOEcsabai 2BLvl8OLGIccE19kq0y4lFgp2tbA5kHa1UKMBtJrk46I2dnpOzKaZDimdi+dXPoJrphs o7dLrbUFzoGcPps28E1PwDGaSvcwxx1bNOZ+xaPkeF/bUCE+Jw0D9j6LVVpDp5L9VXxk s9tg== X-Gm-Message-State: AOAM5305rPR3AZu8KMZvB2AY5C+jrnXezyYAEfQxI+3Fac3TRmV8MCr+ BH2+Z3rEEVq8U2oDes3WKGcncw/QW1M= X-Google-Smtp-Source: ABdhPJxTVOwr4BVg6KrUun/k/7BL1VkmBVxwOAsxKELyCy+U/TBIdikmyNbFh/AYZzEzWfQhYgKsLw== X-Received: by 2002:a05:6512:e83:b0:477:bd0e:e54b with SMTP id bi3-20020a0565120e8300b00477bd0ee54bmr6814916lfb.191.1653490012073; Wed, 25 May 2022 07:46:52 -0700 (PDT) Original-Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id z21-20020a19f715000000b00477cc3fa475sm2956489lfe.204.2022.05.25.07.46.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 May 2022 07:46:51 -0700 (PDT) X-Google-Original-From: Maxim Nikulin Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=m.a.nikulin@gmail.com; helo=mail-lf1-x134.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:233067 Archived-At: 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". 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. An example in the `decoded-time-add' docstring > (decoded-time-add (decode-time) (make-decoded-time :month 2)) adds even more confusion. If `make-decoded-time' is intended for intervals, not timestamps than it should not have DST and TZ values at all. Time interval may be added to timestamp, and time zone and daylight saving time flag is the property of particular timestamp while the same interval may be added to various timestamps and the actual result depends on the base timestamp. Timestamp and interval are different types and should not be used interchangeably. nil/t/-1 interpretation difference for DST causes issues like (bug#54731), so it should be handled with care.