From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QE+eDuU+YGLW9QAAbAwnHQ (envelope-from ) for ; Wed, 20 Apr 2022 19:12:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id QChmDuU+YGJKYAAAauVa8A (envelope-from ) for ; Wed, 20 Apr 2022 19:12:05 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D2D3828E98 for ; Wed, 20 Apr 2022 19:12:04 +0200 (CEST) Received: from localhost ([::1]:41412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhDs3-0002BN-Sq for larch@yhetil.org; Wed, 20 Apr 2022 13:12:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhDcs-0003fj-BS for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 12:56:22 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:34497) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhDcq-0005WA-Ou for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 12:56:22 -0400 Received: by mail-lf1-x130.google.com with SMTP id x33so4102311lfu.1 for ; Wed, 20 Apr 2022 09:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:references:cc:from:in-reply-to :content-transfer-encoding; bh=jEFZEeJlt/lZUNOIJXM8VNGfv+ft9rL8tzfBbYeIh8U=; b=HGGP/gvZ0vcMT/k1x5S01KJYZoTz0jtRNxHJEBJNbmzqG3ZrqmZFhetYWXv4yK5/Av LlEC+1l8Y7j0mWsWahZsBvKJWpSCUH2RRiBEXOiJvYwDVey2VvP7vhPZgThB+wC1+loV Cf3I1S/FJ0Ss63pM0asW6ayvCOM8g4OXeKJhVp7Aafv+MMSHuvrPc5Nlw2C/eQE1JliU bi60ow1OKiZ8/TjYGO5F+RV0XHtUWVzQ1X3CpMHy/fSKfG74uS3VNgkirg9u2HfIhcwU Xy/K/gjcAC328jYYDnQOVTv71f497Zrt8TWd+nPPmpGE5xArDKIl/5B598llLX95G0iW Gjmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:references:cc:from:in-reply-to :content-transfer-encoding; bh=jEFZEeJlt/lZUNOIJXM8VNGfv+ft9rL8tzfBbYeIh8U=; b=AOpi7vKCbDOBNci+Xf9Z8Kp9tx7ZkdDaV/eGDwlSXcxF0Cf3ZLKqVafl0BrqrrK7S+ eY2C/Kl8A22IhhYK4xnjqAsLuNw4GZG71N2W/QapXt5+BXBDb7Cm36HCbXTyMtzQdrl4 P7DF6qJTG3lKZhxkvZSHZtbNVz8ReXwuTu/prrxmq6VJ02R2PT1AsU+lQTTWb6OuEGm8 DtKxd69Vb5ingM4fruy/l05/zqEzMttpa1I+h4mnoFXw4N4IUHwQeHeGLXnNCR6yaiml 1Iv4CpwGPvndf+zwuXVZYTcICsz7t3S2LfijEzKvJe7JSeI5X7a8UUmcgDAsmaIo3tB/ PIzQ== X-Gm-Message-State: AOAM532YTbXw+YvHVXTqrdII86OhGEuKJpUaUKogD3whFjxCiXx+wuKn mk9TB9BmEVMO0XuAagZI44o= X-Google-Smtp-Source: ABdhPJzw2eH/OjA3LV/TrnAzfVZ6YOlA/d6SC+El1RGAM5VY4XDPUj3JeAJ6j4gM0IedwytBki2tjQ== X-Received: by 2002:a05:6512:b81:b0:448:b342:513c with SMTP id b1-20020a0565120b8100b00448b342513cmr15520582lfv.257.1650473777434; Wed, 20 Apr 2022 09:56:17 -0700 (PDT) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id m2-20020a196142000000b004711ef2d738sm1255412lfk.254.2022.04.20.09.56.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Apr 2022 09:56:16 -0700 (PDT) Message-ID: <8ba9e258-dd24-a0a0-1aa6-9c2831c05af0@gmail.com> Date: Wed, 20 Apr 2022 23:56:15 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones Content-Language: en-US To: Paul Eggert References: <5ed963b2-3fa8-48d8-627e-bc0571d15b43@gmail.com> <149de00f-115b-5367-414f-c7700ef8966b@cs.ucla.edu> <2d57e59b-f971-483b-ad65-e0c5ff7883e8@gmail.com> <3624beb8-71fd-924e-a065-74d0034ed351@cs.ucla.edu> From: Max Nikulin In-Reply-To: <3624beb8-71fd-924e-a065-74d0034ed351@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=manikulin@gmail.com; helo=mail-lf1-x130.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, NICE_REPLY_A=-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: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode , 54764@debbugs.gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650474725; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=jEFZEeJlt/lZUNOIJXM8VNGfv+ft9rL8tzfBbYeIh8U=; b=LRQgvBZkwfVO7b9lTa+balwu5Ro4UofZgI8acvCpj9zyL170Hyfm2DYbaVUl0Pq4zdzKBG 2q4medJ9wfaQamrsDIdhujLaDiTXeMxZWX4NgFC9/B08Nzr0okSSwvOCunDyzaZGFqsjCP tw1nCjYhYTjWtDs2Vi5tzV0tYHBUTqSTAFzZw+h6EShEsbEoexFAdqhM46xw1hPCRKl6nt DO2rIgP/KryZ7/xs9MoVjiyXwUvuVLL6OP1LCYLNuGoWNINMhMn8tE6L5GfnoFrfwqBSm0 lH/Ux9Eu3EaF16HD+u9hl6ZOEdVI1+OewI2EQM59ZqIegdVv74mLxrlfeoFT1Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650474725; a=rsa-sha256; cv=none; b=axoL/vi53O/Xbjj7o8F+buOhzgYPnp67c08HrzZHS5Mm/S3HYquZOcH6ZqxXmRkiTgv4Kf GhpNIgxsqApqbLzar1+jy4kd0iMhMh8VMrPcYb2bAf+iS3rBwUwLdhI+uVmCR9nIEx7AtQ m6nnN8BPmM5s43wTu7U/jMzjGP4bd+JYFtvtdh7xisY6e1jWasocVOHuBHKB4cVrdDoFrl Uo6PCLWJW06szKInf/7LJwQiLjrXJ1rixeYf9hld/DZr9U9axAJFY0Iai7kpraC+cJll4E ce98GuGBJefoubRjfeWHwXY6Wk6CcU+ITQaj6x1kricjcxZAJXJGXSGHLha9Hw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="HGGP/gvZ"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.16 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="HGGP/gvZ"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D2D3828E98 X-Spam-Score: 6.16 X-Migadu-Scanner: scn1.migadu.com X-TUID: +3cXFO4U8e55 On 17/04/2022 08:58, Paul Eggert wrote: > Thanks, I installed that and then installed the attached, which merges > that with some documentation improvements that I drafted based on this > thread. Thank you for further editing of docs. Please, fix a typo. > diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi > index 66689f43a9..8366689640 100644 > --- a/doc/lispref/os.texi > +++ b/doc/lispref/os.texi > > @@ -1687,14 +1660,18 @@ Time Conversion > than six arguments the @emph{last} argument is used as @var{zone} and > any other extra arguments are ignored, so that @code{(apply > #'encode-time (decode-time ...))} works. In this obsolescent > -convention, @var{zone} defaults to the current time zone rule > -(@pxref{Time Zone Rules}), and @var{dst} is treated as if it was > -@minus{}1. > +convention, @var{dst} is @minus{}1 and @var{zone} defaults to the > +current time zone rule (@pxref{Time Zone Rules}). > +When modernizing an obsolescent caller, ensure that the more-modern > +list equivalent contains 9 elements with a a @code{dst} element that ^^^ A typo: double "a". > +is @minus{}1, not @code{nil}. > > +@lisp > +;; Try to compute the time four years from now. > +;; Watch out; this might not work as expected. > +(let ((time (decode-time))) > + (setf (decoded-time-year time) > + (+ (decoded-time-year time) 4)) > + time) > +@end lisp > +@noindent > +Unfortunately, this code might not work as expected if the resulting > +time is invalid due to daylight saving transitions, time zone changes, > +or missing leap days or leap seconds. For example, if executed on > +February 29, 2096 this code yields a nonexistent date because 2100 is > +not a leap year. To avoid some (though not all) of the problem, you > +can base calculations on the middle of the affected unit, e.g., start > +at July 1 when adding years. If I get your idea correctly then "January, 31" + "1 month" should be more impressive as impossible date. Year 2096 is too far in future. I am unsure concerning expectation. Overflow arithmetic is described above and e.g. JavaScript normalizes Date object in a similar fashion. The special point is that elisp decoded time requires explicit normalization however and 2100 is a good example that updating of any field may "break" the date. > Alternatively, you can use the > +@file{calendar} and @file{time-date} libraries. A remark loosely related to your patch. Earlier you mentioned missed midnight due to time transition and suggested to use calendrical functions in Org. I can not figure out which elisp function can help to determine wall time for Aug 1 start of day in Cairo: Africa/Cairo Thu Jul 31 21:59:59 2014 UT = Thu Jul 31 23:59:59 2014 EET isdst=0 gmtoff=7200 Africa/Cairo Thu Jul 31 22:00:00 2014 UT = Fri Aug 1 01:00:00 2014 EEST isdst=1 gmtoff=10800 input: 2014-08-01 Africa/Cairo (timezone may be implicit as the system one) expected output: 01:00:00