From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?)
Date: Thu, 16 May 2024 17:41:58 +0700 [thread overview]
Message-ID: <v24nto$am1$1@ciao.gmane.io> (raw)
In-Reply-To: <87seykpn58.fsf@localhost>
On 14/05/2024 19:56, Ihor Radchenko wrote:
> Max Nikulin writes:
>
>>> +(defun org-time-inc (unit value time)
>> Is there a chance that support of intervals like 1h20m will be required
>> later?
>
> Not sure again. I simply used ts-inc function signature from Adam's
> ts.el as reference.
ts.el has `ts-adjust' that may change several fields. I had in mind
specification of time interval from RFC5545 iCalendar P4h20m.
>>> + (if (memq unit '(day month year))
>>> + nil ; Avoid auto-adjustments of time when jumping across DST.
>>
>> Sorry, but you have to use -1, otherwise
>>
>> (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.
You are right. When you are using TZ as integer offset from UTC,
`encode-time' does not signal any error. It ignores DST. However it is
the case of conversion to local time a timestamp with arbitrary explicit
offset, e.g. taken from a Date email header. So my example is wrong for
current patch revision, but the code needs a fix.
You need to get local timestamp for given local time. You should use -1
for DST and nil for TZ.
In some cases it may cause change like 1:30 to 2:30, but it is not worse
than date drift from 31 to 30 or even 28.
> The reason why I forced DST nil is hysteresis of glibc when dealing with
> DST transitions:
As I wrote yesterday, you example is unrelated to glibc hysteresis. The
reliable way to deal with ambiguous time close to time transition is to
have get next transition function for given timezone and a way to
resolve ambiguous time (DST can not help in some cases). Heuristics with
trying a day before and a day after should work, but it may impact
performance.
Your patch allows users to choose if they prefer May, 31 to July, 1 or
to July, 30 drift. It may be an improvement some of them.
I think, they actually expect choice to get June, 30 and July, 31 or to
ignore June since it has 30 days only.
next prev parent reply other threads:[~2024-05-16 10:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 10:48 Leap-year bug with todo-cycle Anton Haglund
2024-04-05 18:34 ` [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?) (was: Leap-year bug with todo-cycle) Ihor Radchenko
2024-04-05 19:53 ` Russell Adams
2024-04-05 21:18 ` jman
2024-04-05 21:27 ` Ihor Radchenko
2024-04-06 14:52 ` [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?) Max Nikulin
2024-04-07 11:47 ` Ihor Radchenko
2024-05-13 10:07 ` [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?) (was: Leap-year bug with todo-cycle) Ihor Radchenko
2024-05-14 11:08 ` [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?) Max Nikulin
2024-05-14 12:56 ` Ihor Radchenko
2024-05-14 13:10 ` Stefan Nobis
2024-05-18 11:40 ` Ihor Radchenko
2024-05-18 12:49 ` Stefan Nobis
2024-05-18 13:09 ` Ihor Radchenko
2024-05-18 14:26 ` Stefan Nobis
2024-05-18 14:35 ` Ihor Radchenko
2024-05-15 11:04 ` Max Nikulin
2024-05-18 11:50 ` Ihor Radchenko
2024-05-16 10:41 ` Max Nikulin [this message]
2024-05-18 11:56 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='v24nto$am1$1@ciao.gmane.io' \
--to=manikulin@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).