Function: icalendar-recur-date-time-occurs-twice-p

icalendar-recur-date-time-occurs-twice-p is a byte-compiled function defined in icalendar-recur.el.gz.

Signature

(icalendar-recur-date-time-occurs-twice-p DT OBS-ONSET OBSERVANCE)

Documentation

Return non-nil if DT occurs twice in the given OBSERVANCE.

Some local date-times occur twice in a given time zone. When switching from daylight savings to standard time time, the local clock time is typically set back, so that a certain range of clock times occurs twice, once in daylight savings time and once in standard time. This function tests whether DT is one of those local times which occur twice.

DT and OBS-ONSET should be icalendar-date-time values; OBS-ONSET should be the (local) time immediately at the relevant onset of the OBSERVANCE. OBSERVANCE should be an icalendar-standard or icalendar-daylight component.

If this function returns t, then per RFC5545 Section 3.3.5, DT must be interpreted as the first occurrence of this clock time, i.e., in daylight savings time, prior to OBS-ONSET.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-recur.el.gz
(defun icr:date-time-occurs-twice-p (dt obs-onset observance)
  "Return non-nil if DT occurs twice in the given OBSERVANCE.

Some local date-times occur twice in a given time zone.  When switching
from daylight savings to standard time time, the local clock time is
typically set back, so that a certain range of clock times occurs twice,
once in daylight savings time and once in standard time.  This function
tests whether DT is one of those local times which occur twice.

DT and OBS-ONSET should be `icalendar-date-time' values; OBS-ONSET
should be the (local) time immediately at the relevant onset of the
OBSERVANCE.  OBSERVANCE should be an `icalendar-standard' or
`icalendar-daylight' component.

If this function returns t, then per RFC5545 Section 3.3.5, DT must be
interpreted as the first occurrence of this clock time, i.e., in
daylight savings time, prior to OBS-ONSET."
  (when (ical:standard-component-p observance)
    (ical:with-component observance
        ((ical:tzoffsetfrom :value offset-from)
         (ical:tzoffsetto :value offset-to))
      (and (= (decoded-time-year dt) (decoded-time-year obs-onset))
           (= (decoded-time-month dt) (decoded-time-month obs-onset))
           (= (decoded-time-day dt) (decoded-time-day obs-onset))
           (let* ((onset-secs (+ (decoded-time-second obs-onset)
                                 (* 60 (decoded-time-minute obs-onset))
                                 (* 60 60 (decoded-time-hour obs-onset))))
                  (dt-secs (+ (decoded-time-second dt)
                              (* 60 (decoded-time-minute dt))
                              (* 60 60 (decoded-time-hour dt))))
                  (repeated (abs (- offset-from offset-to)))
                  (start-repeateds (- onset-secs repeated)))
             (and
              (<= start-repeateds dt-secs)
              (< dt-secs onset-secs)))))))