Function: dst-adjust-time

dst-adjust-time is a byte-compiled function defined in cal-dst.el.gz.

Signature

(dst-adjust-time DATE TIME)

Documentation

Adjust, to account for dst on DATE, decimal fraction standard TIME.

Returns a list (date adj-time zone) where date and adj-time are the values adjusted for zone; here date is a list (month day year), adj-time is a decimal fraction time, and zone is a string.

Conversion to daylight saving time is done according to calendar-daylight-savings-starts, calendar-daylight-savings-ends, calendar-daylight-savings-starts-time, calendar-daylight-savings-ends-time, and calendar-daylight-time-offset.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-dst.el.gz
;; used by calc, lunar, solar.
(defun dst-adjust-time (date time)
  "Adjust, to account for dst on DATE, decimal fraction standard TIME.
Returns a list (date adj-time zone) where `date' and `adj-time' are the values
adjusted for `zone'; here `date' is a list (month day year), `adj-time' is a
decimal fraction time, and `zone' is a string.

Conversion to daylight saving time is done according to
`calendar-daylight-savings-starts', `calendar-daylight-savings-ends',
`calendar-daylight-savings-starts-time',
`calendar-daylight-savings-ends-time', and `calendar-daylight-time-offset'."
  (let* ((rounded-abs-date (+ (calendar-absolute-from-gregorian date)
                              (/ (round (* 60 time)) 60.0 24.0)))
         (dst (dst-in-effect rounded-abs-date))
         (time-zone (if dst
                        calendar-daylight-time-zone-name
                      calendar-standard-time-zone-name))
         (time (+ rounded-abs-date
                  (if dst (/ calendar-daylight-time-offset 24.0 60.0) 0))))
    (list (calendar-gregorian-from-absolute (truncate time))
          (* 24.0 (- time (truncate time)))
          time-zone)))