emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118350: Allow VTIMEZONE where daylight and standard


From: Paul Eggert
Subject: [Emacs-diffs] trunk r118350: Allow VTIMEZONE where daylight and standard time zones are equal.
Date: Mon, 10 Nov 2014 17:07:19 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118350
revision-id: address@hidden
parent: address@hidden
author: Sylvain Chouleur <address@hidden>  (tiny change)
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2014-11-10 09:07:09 -0800
message:
  Allow VTIMEZONE where daylight and standard time zones are equal.
  
  See: http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00494.html
  * calendar/icalendar.el (icalendar--convert-tz-offset):
  Support timezone without daylight saving time.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/calendar/icalendar.el     
icalendar.el-20091113204419-o5vbwnq5f7feedwu-3296
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-11-10 07:39:35 +0000
+++ b/lisp/ChangeLog    2014-11-10 17:07:09 +0000
@@ -1,3 +1,10 @@
+2014-11-10  Sylvain Chouleur  <address@hidden>  (tiny change)
+
+       Allow VTIMEZONE where daylight and standard time zones are equal.
+       See: http://lists.gnu.org/archive/html/emacs-devel/2014-11/msg00494.html
+       * calendar/icalendar.el (icalendar--convert-tz-offset):
+       Support timezone without daylight saving time.
+
 2014-11-10  Glenn Morris  <address@hidden>
 
        * startup.el (command-line): Handle nil elements in load-path.

=== modified file 'lisp/calendar/icalendar.el'
--- a/lisp/calendar/icalendar.el        2014-10-29 01:42:51 +0000
+++ b/lisp/calendar/icalendar.el        2014-11-10 17:07:09 +0000
@@ -485,45 +485,48 @@
 ALIST is an alist entry from a VTIMEZONE, like STANDARD.
 DST-P is non-nil if this is for daylight savings time.
 The strings are suitable for assembling into a TZ variable."
-  (let ((offset (car (cddr (assq 'TZOFFSETTO alist))))
-       (rrule-value (car (cddr (assq 'RRULE alist))))
-       (dtstart (car (cddr (assq 'DTSTART alist)))))
+  (let* ((offsetto (car (cddr (assq 'TZOFFSETTO alist))))
+        (offsetfrom (car (cddr (assq 'TZOFFSETFROM alist))))
+        (rrule-value (car (cddr (assq 'RRULE alist))))
+        (dtstart (car (cddr (assq 'DTSTART alist))))
+        (no-dst (equal offsetto offsetfrom)))
     ;; FIXME: for now we only handle RRULE and not RDATE here.
-    (when (and offset rrule-value dtstart)
+    (when (and offsetto dtstart (or rrule-value no-dst))
       (let* ((rrule (icalendar--split-value rrule-value))
             (freq (cadr (assq 'FREQ rrule)))
             (bymonth (cadr (assq 'BYMONTH rrule)))
             (byday (cadr (assq 'BYDAY rrule))))
        ;; FIXME: we don't correctly handle WKST here.
-       (if (and (string= freq "YEARLY") bymonth)
+       (if (or no-dst (and (string= freq "YEARLY") bymonth))
            (cons
             (concat
              ;; Fake a name.
              (if dst-p "DST" "STD")
              ;; For TZ, OFFSET is added to the local time.  So,
              ;; invert the values.
-             (if (eq (aref offset 0) ?-) "+" "-")
-             (substring offset 1 3)
+             (if (eq (aref offsetto 0) ?-) "+" "-")
+             (substring offsetto 1 3)
              ":"
-             (substring offset 3 5))
+             (substring offsetto 3 5))
             ;; The start time.
-            (let* ((day (icalendar--get-weekday-number (substring byday -2)))
-                   (week (if (eq day -1)
-                             byday
-                           (substring byday 0 -2))))
-               ;; "Translate" the iCalendar way to specify the last
-               ;; (sun|mon|...)day in month to the tzset way.
-               (if (string= week "-1")  ; last day as iCalendar calls it
-                   (setq week "5"))     ; last day as tzset calls it
-              (concat "M" bymonth "." week "." (if (eq day -1) "0"
-                                                 (int-to-string day))
-                      ;; Start time.
-                      "/"
-                      (substring dtstart -6 -4)
-                      ":"
-                      (substring dtstart -4 -2)
-                      ":"
-                      (substring dtstart -2)))))))))
+            (unless no-dst
+              (let* ((day (icalendar--get-weekday-number (substring byday -2)))
+                     (week (if (eq day -1)
+                               byday
+                             (substring byday 0 -2))))
+                ;; "Translate" the iCalendar way to specify the last
+                ;; (sun|mon|...)day in month to the tzset way.
+                (if (string= week "-1")  ; last day as iCalendar calls it
+                    (setq week "5"))     ; last day as tzset calls it
+                (concat "M" bymonth "." week "." (if (eq day -1) "0"
+                                                   (int-to-string day))
+                        ;; Start time.
+                        "/"
+                        (substring dtstart -6 -4)
+                        ":"
+                        (substring dtstart -4 -2)
+                        ":"
+                        (substring dtstart -2))))))))))
 
 (defun icalendar--parse-vtimezone (alist)
   "Turn a VTIMEZONE ALIST into a cons (ID . TZ-STRING).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]