unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: thunk2@arcor.de (Thomas Plass)
To: 34315@debbugs.gnu.org
Subject: bug#34315: [PATCH] icalendar.el: DURATION fix + more robust timezone handling
Date: Mon, 4 Feb 2019 12:48:11 +0100	[thread overview]
Message-ID: <23640.9851.562972.730234@AGAME7.local> (raw)

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 2051 bytes --]

The attached patch contains a fix for what looks like a clerical error
in icalendar--decode-isoduration(), test case: P1DT2H.

But the real point of this post is to propose a few improvements to
handling timezones.

I use icalendar.el as a library for dealing with raw VCALENDAR data.
Also, I'm on Windows where the OS makes Emacs' timezone handling a
bit tricky.  Meaning that, unless precautions are taken, datetime
conversions by icalendar.el sometimes are incorrect, in particular
around DST transitions.

Changes in the patch:

 - add an optional argument to icalendar--decode-isodatetime() which
   is passed to decode-time().

   So, both encode-time() and decode-time() get to have their
   respective timezones which makes datetime conversions predictable.
   I know, I could do a (setenv "TZ" (icalendar--convert-tz-offset
   ...))  before I call icalendar--decode-isodatetime() but that +
   restoring the environment variable afterwards looks clumsy.

 - handle RDATE in icalendar--convert-tz-offset() in a rudimentary
   fashion.

   RDATE handling is required for those VTIMEZONEs that do not specify
   RRULE, otherwise there will be no datetime conversions at all.

 - identify the latest oberservance for DAYLIGHT and STANDARD
   specifications within one VTIMEZONE, again supporting RDATE.

   As is, icalendar.el handles multiple such specifications
   indiscriminately, resulting in conversions that may be relative to
   a date centuries in the past.

   The relevance of this change is this: when a VCALENDAR does not
   contain a VTIMEZONE section or e.g. the popular nonstandard
   X-WR-TIMEZONE property, my application goes and fetches one from a
   tzdata database such as tzurl.org.  Standard tzurl.org responses
   contain lots of historical records.  Yes, tzurl.org also returns
   "Outlook-style" VTIMEZONEs which icalendar.el is quite happy with
   but that doesn't help me with complex VTIMEZONEs contained in
   incoming VCALENDARs.


The patch is not a --git diff.  Is that tolerable at all?

Best regards

Thomas



[-- Attachment #2: icalendar.el.patch --]
[-- Type: application/x-diff, Size: 5712 bytes --]

             reply	other threads:[~2019-02-04 11:48 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 11:48 Thomas Plass [this message]
2019-02-12 18:57 ` bug#34315: [PATCH] icalendar.el: DURATION fix + more robust timezone handling Ulf Jasper
2019-02-15 17:17   ` Ulf Jasper
2019-02-18  9:36     ` Thomas Plass
2019-02-18 15:59       ` Eli Zaretskii
2019-02-18 19:15         ` Thomas Plass
2019-02-18 19:30           ` Eli Zaretskii
2019-02-18 20:03             ` Thomas Plass
2019-02-18 20:16               ` Eli Zaretskii
2020-08-10 11:48     ` Lars Ingebrigtsen
2020-08-10 16:08       ` Ulf Jasper
2020-08-10 16:45         ` Eli Zaretskii
2020-08-10 17:04           ` Thomas Plass
2020-08-11 11:01             ` Lars Ingebrigtsen
2020-08-11 15:14               ` Ulf Jasper
2020-08-11 15:19                 ` Lars Ingebrigtsen
2020-08-11 15:45                   ` Ulf Jasper
2020-08-12 13:08                 ` Thomas Plass
2020-08-12 13:12                   ` Lars Ingebrigtsen
2020-08-12 13:30                     ` Thomas Plass
2020-08-12 15:06                       ` Ulf Jasper
2020-09-02 18:05                         ` Ulf Jasper
2020-09-03  8:38                           ` Thomas Plass
2020-09-03 14:28                             ` Ulf Jasper
2020-09-12  8:01                               ` Thomas Plass
2020-09-12  8:11                                 ` Eli Zaretskii
2020-09-13  4:07                                 ` Richard Stallman
2020-09-29 10:05                               ` Thomas Plass
2020-10-01  1:45                                 ` Lars Ingebrigtsen
2020-10-01  1:50                                   ` Lars Ingebrigtsen
2020-10-01 13:38                                   ` Thomas Plass
2020-10-01 16:19                                     ` Ulf Jasper
2020-10-01 16:22                                       ` Lars Ingebrigtsen
2020-10-01 16:54                                         ` Ulf Jasper
2020-10-01 16:59                                           ` Lars Ingebrigtsen
2020-10-01 18:40                                             ` Ulf Jasper
2020-10-01 18:47                                               ` Lars Ingebrigtsen
2020-10-01 19:00                                                 ` Ulf Jasper
2020-10-01 18:49                                           ` Thomas Plass
2020-10-01 18:53                                             ` Thomas Plass
2020-10-01 19:14                                             ` Ulf Jasper
2020-10-10 20:06                                               ` Lars Ingebrigtsen
2020-10-22 15:50                                                 ` Ulf Jasper
2021-05-11 14:10                                                   ` Lars Ingebrigtsen
2021-07-29 14:55                                                     ` Ulf Jasper
2021-07-30 11:37                                                       ` Lars Ingebrigtsen
2023-10-01  2:12                                                 ` Stefan Kangas
2023-10-12 14:49                                                   ` Ulf Jasper
2023-10-15 14:28                                                     ` Stefan Kangas
2023-10-19 14:11                                                       ` Ulf Jasper
2023-12-24 14:02                                                         ` Stefan Kangas

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23640.9851.562972.730234@AGAME7.local \
    --to=thunk2@arcor.de \
    --cc=34315@debbugs.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.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).