From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 8K25OQyXRGaDJQEAqHPOHw:P1 (envelope-from ) for ; Wed, 15 May 2024 13:05:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 8K25OQyXRGaDJQEAqHPOHw (envelope-from ) for ; Wed, 15 May 2024 13:05:49 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=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"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715771148; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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; bh=fEEEtuJM4ahW4ZB9LbHqx4BDiJqShrm7w35g5rD39Kc=; b=HePiRaRrmereZPU/pNT704TVqzb1rk/6LIudOrBO+o7k47RvnVcrBPbSQ9HpMDW2TGWm1F Ejo/j0LERu1XgjCDsuQ6q0cosxM0Ut9kTDZxMPfUt4VrrvKjGMCx8bMUsdWlhPaV8zi/Wa mwd2cgV1C5RdZXqoLGIy1vVSr5bCYnZ1aTym12b8wU+/EThqDmynxR3gsc/2ho2tLQGdTE 4oCCeQQ2UxSMRfQidsHnMrSGrkdsLzPTQd2h+TKyoD0TJ+7mvHxVRP7AEAYd/elkVhek5p sJYwDOlowdg3cXoSJc6JSYYpIKArAwX6QjaAqGlbBngJkheHxqRYVLVR0bSPHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715771148; a=rsa-sha256; cv=none; b=TykAFkl00tL3GWEIzvB39AkCW1CdBpxJYSfn6eF/2Rce2M4J425qhFcpBKidC656haiRpE U5Jdb5A90Xh/QVnCthcN+XgyxROvZyBce4acdJx1wwuIdBkgo+yVQTvI1dos5itW+1CNfm RKra4acF/f10lk56JxdqOjK1r8lEEWtP39GDV4i5tutLAdtNoVneM4bdL9mxjFOI2jEglN hiBpsHkmM49nhNqLRV3soOuAgLbTQkiGZq6k/XMn4XUtt71NZe245M1hq4pFZQIqDB6aWQ I7BVayT9CIXhmlPuvMFJMZxDUKZ3CeTu52w1tpVkWUOULnLENx8f0Uy4g/DJ1Q== 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 8CEA527F04 for ; Wed, 15 May 2024 13:05:48 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7CRB-0006lG-QW; Wed, 15 May 2024 07:04:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7CR7-0006l6-Gv for emacs-orgmode@gnu.org; Wed, 15 May 2024 07:04:41 -0400 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7CR3-0003mI-Eg for emacs-orgmode@gnu.org; Wed, 15 May 2024 07:04:38 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1s7CQz-0006Am-TK for emacs-orgmode@gnu.org; Wed, 15 May 2024 13:04:33 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?) Date: Wed, 15 May 2024 18:04:23 +0700 Message-ID: References: <87frvzodze.fsf@localhost> <87v83if2io.fsf@localhost> <87seykpn58.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird Content-Language: en-US, ru-RU In-Reply-To: <87seykpn58.fsf@localhost> Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 26 X-Spam_score: 2.6 X-Spam_bar: ++ X-Spam_report: (2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -0.86 X-Migadu-Queue-Id: 8CEA527F04 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -0.86 X-TUID: veod2+KVps3x On 14/05/2024 19:56, Ihor Radchenko wrote: > Max Nikulin writes: >> On 13/05/2024 17:07, Ihor Radchenko wrote: >>> >>> <2025-01-31 Fri +1m> >>> <2025-02-28 Fri +1m> >>> <2025-03-28 Fri +1m> >> >> Instead of using timestamp obtained on previous step, use original >> timestamp and multiple of the interval. > > This is not possible because of how `org-auto-repeat-maybe' is designed. Then the only way to get reasonable results is to store in :PROPERTIES: either original date (and iteration count) or current date before clamping (2025-02-31) > No idea. I am not aware about any existing built-in API that provides > date increments. The context was that day start time may give some surprise as well. I am unsure concerning namely increments. I just expected a set of more accurate functions for working with dates. >>> + (org-encode-time [...] >>> + (+ (if (eq unit 'day) value 0) (decoded-time-day time)) >> >> Have you considered using `min' with result of `date-days-in-month' here >> (or its sibling from timezone.el)? > > Not sure if it is going to be simpler. My idea was to avoid the backward `while' loop in the code below this line. >> (format-time-string >> "%F %T %Z %z" >> (encode-time '(0 30 12 15 1 2000 'ignored nil "Africa/Juba")) >> "Africa/Juba") >> (error "Specified time is not representable") > > Hmm. I am not sure if it is a real problem in practice. > String values of time zone are only possible for hand-crafted time > values. This example avoids changing system time or starting Emacs with TZ environment. The following example does not include explicit timezone: TZ=Africa/Juba emacs -Q --batch \ --eval "(encode-time '(0 30 12 15 1 2000 'ignored nil nil))" > The reason why I forced DST nil is hysteresis of glibc when dealing with > DST transitions: At first I was trying to figure out what time zone had 24:00<->23:00 transition in 2012. > (cl-loop for m in '(1 2 3 4 5 6 7 8 9 10 11 12) > collect (decode-time (encode-time `(0 0 0 4 ,m 2012 nil -1 10800)))) > > (0 0 23 3 1 2012 2 nil 7200) This result depends on your timezone. It is consistent with e.g. Asia/Istanbul. It had +02:00 offset in January, but you requested +03:00. The result of conversion is -1 hour difference in requested timestamp and conversion result. It is unrelated to internal DST state and hysteresis caused by this state. When DST is nil 2012-01-04 00:00:00 +03:00 === 2012-01:03 23:00:00 +02:00 Avoid passing timezone offset when you do not know it. I agree that there are issues with handling tm_gmtoff and tm_isdst https://data.iana.org/time-zones/theory.html#POSIX-extensions Results may vary across libraries. > Although, forcing DST nil will not always help here It is fragile, I would not rely on ignoring offset when DST is specified. Actually you pass mutually inconsistent values, so it is either undefined behavior or close to it.