aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-07-30 13:06:06 +0200
committerLars Ingebrigtsen2019-07-30 13:06:06 +0200
commit9f14c9ad342e60d2ef4965253a57f297342e5cf9 (patch)
tree3a61d956b0f0f30e1bc04abb842eb5533c841c50
parentbd26eff54779bfd5739c1d663bcabd19246682d8 (diff)
downloademacs-9f14c9ad342e60d2ef4965253a57f297342e5cf9.tar.gz
emacs-9f14c9ad342e60d2ef4965253a57f297342e5cf9.zip
Use decoded time accessors in calendar
* lisp/calendar/icalendar.el (icalendar--add-decoded-times) (icalendar--convert-sexp-to-ical): * lisp/calendar/calendar.el (calendar-current-date): * lisp/calendar/cal-dst.el (calendar-dst-find-data) (calendar-dst-find-startend): Use decoded time accessors.
-rw-r--r--lisp/calendar/cal-dst.el5
-rw-r--r--lisp/calendar/calendar.el4
-rw-r--r--lisp/calendar/icalendar.el18
3 files changed, 15 insertions, 12 deletions
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el
index e0126a6560e..510cd6808e4 100644
--- a/lisp/calendar/cal-dst.el
+++ b/lisp/calendar/cal-dst.el
@@ -259,7 +259,7 @@ for `calendar-current-time-zone'."
259 (car t2-date-sec) t1-utc-diff)) 259 (car t2-date-sec) t1-utc-diff))
260 (t1-time (/ (cdr t1-date-sec) 60)) 260 (t1-time (/ (cdr t1-date-sec) 60))
261 (t2-time (/ (cdr t2-date-sec) 60))) 261 (t2-time (/ (cdr t2-date-sec) 60)))
262 (if (nth 7 (decode-time t1)) 262 (if (decoded-time-dst (decode-time t1))
263 (list (/ t0-utc-diff 60) (/ (- t1-utc-diff t0-utc-diff) 60) 263 (list (/ t0-utc-diff 60) (/ (- t1-utc-diff t0-utc-diff) 60)
264 t0-name t1-name t1-rules t2-rules t1-time t2-time) 264 t0-name t1-name t1-rules t2-rules t1-time t2-time)
265 (list (/ t1-utc-diff 60) (/ (- t0-utc-diff t1-utc-diff) 60) 265 (list (/ t1-utc-diff 60) (/ (- t0-utc-diff t1-utc-diff) 60)
@@ -291,7 +291,8 @@ the current year."
291 (condition-case nil 291 (condition-case nil
292 (encode-time 1 0 0 1 1 year) 292 (encode-time 1 0 0 1 1 year)
293 (error 293 (error
294 (encode-time 1 0 0 1 1 (nth 5 (decode-time)))))) 294 (encode-time 1 0 0 1 1
295 (decoded-time-year (decode-time))))))
295 f (nth 4 e) 296 f (nth 4 e)
296 e (list year f (nth 5 e)) 297 e (list year f (nth 5 e))
297 calendar-dst-transition-cache 298 calendar-dst-transition-cache
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 1e988c2712f..14604a673d0 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1871,7 +1871,9 @@ the STRINGS are just concatenated and the result truncated."
1871 "Return the current date in a list (month day year). 1871 "Return the current date in a list (month day year).
1872Optional integer OFFSET is a number of days from the current date." 1872Optional integer OFFSET is a number of days from the current date."
1873 (let* ((now (decode-time)) 1873 (let* ((now (decode-time))
1874 (now (list (nth 4 now) (nth 3 now) (nth 5 now)))) 1874 (now (list (decoded-time-month now)
1875 (decoded-time-day now)
1876 (decoded-time-year now))))
1875 (if (zerop (or offset 0)) 1877 (if (zerop (or offset 0))
1876 now 1878 now
1877 (calendar-gregorian-from-absolute 1879 (calendar-gregorian-from-absolute
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 17316ddbbd0..cf3315b45db 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -721,12 +721,12 @@ Both times must be given in decoded form. One of these times must be
721valid (year > 1900 or something)." 721valid (year > 1900 or something)."
722 ;; FIXME: does this function exist already? 722 ;; FIXME: does this function exist already?
723 (decode-time (encode-time 723 (decode-time (encode-time
724 (+ (nth 0 time1) (nth 0 time2)) 724 (+ (decoded-time-second time1) (decoded-time-second time2))
725 (+ (nth 1 time1) (nth 1 time2)) 725 (+ (decoded-time-minute time1) (decoded-time-minute time2))
726 (+ (nth 2 time1) (nth 2 time2)) 726 (+ (decoded-time-hour time1) (decoded-time-hour time2))
727 (+ (nth 3 time1) (nth 3 time2)) 727 (+ (decoded-time-day time1) (decoded-time-day time2))
728 (+ (nth 4 time1) (nth 4 time2)) 728 (+ (decoded-time-month time1) (decoded-time-month time2))
729 (+ (nth 5 time1) (nth 5 time2)) 729 (+ (decoded-time-year time1) (decoded-time-year time2))
730 nil 730 nil
731 nil 731 nil
732 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME? 732 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME?
@@ -1623,9 +1623,9 @@ enumeration, given as a Lisp time value -- used for test purposes."
1623 (lambda (offset) 1623 (lambda (offset)
1624 (let* ((day (decode-time (time-add now 1624 (let* ((day (decode-time (time-add now
1625 (* 60 60 24 offset)))) 1625 (* 60 60 24 offset))))
1626 (d (nth 3 day)) 1626 (d (decoded-time-day day))
1627 (m (nth 4 day)) 1627 (m (decoded-time-month day))
1628 (y (nth 5 day)) 1628 (y (decoded-time-year day))
1629 (se (diary-sexp-entry p1 p2 (list m d y))) 1629 (se (diary-sexp-entry p1 p2 (list m d y)))
1630 (see (cond ((stringp se) se) 1630 (see (cond ((stringp se) se)
1631 ((consp se) (cdr se)) 1631 ((consp se) (cdr se))