Function: solar-longitude

solar-longitude is a byte-compiled function defined in solar.el.gz.

Signature

(solar-longitude D)

Documentation

Longitude of sun on astronomical (Julian) day number D.

Accuracy is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes). The values of calendar-daylight-savings-starts, calendar-daylight-savings-starts-time, calendar-daylight-savings-ends, calendar-daylight-savings-ends-time, calendar-daylight-time-offset, and calendar-time-zone are used to interpret local time.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/solar.el.gz
(defun solar-longitude (d)
  "Longitude of sun on astronomical (Julian) day number D.
Accuracy is about 0.0006 degree (about 365.25*24*60*0.0006/360 = 1 minutes).
The values of `calendar-daylight-savings-starts',
`calendar-daylight-savings-starts-time', `calendar-daylight-savings-ends',
`calendar-daylight-savings-ends-time', `calendar-daylight-time-offset', and
`calendar-time-zone' are used to interpret local time."
  (let* ((a-d (calendar-astro-to-absolute d))
         ;; Get Universal Time.
         (date (calendar-astro-from-absolute
                (- a-d
                   (if (dst-in-effect a-d)
                       (/ calendar-daylight-time-offset 24.0 60.0) 0)
                   (/ calendar-time-zone 60.0 24.0))))
         ;; Get Ephemeris Time.
         (date (+ date (solar-ephemeris-correction
                        (calendar-extract-year
                         (calendar-gregorian-from-absolute
                          (floor
                           (calendar-astro-to-absolute
                            date)))))))
         (U (/ (- date 2451545) 3652500))
         (longitude
          (+ 4.9353929
             (* 62833.1961680 U)
             (* 0.0000001
                (apply #'+
                       (mapcar (lambda (x)
                                 (* (car x)
                                    (sin (mod
                                          (+ (cadr x)
                                             (* (nth 2 x) U))
                                          (* 2 float-pi)))))
                               solar-data-list)))))
         (aberration
          (* 0.0000001 (- (* 17 (cos (+ 3.10 (* 62830.14 U)))) 973)))
         (A1 (mod (+ 2.18 (* U (+ -3375.70 (* 0.36 U)))) (* 2 float-pi)))
         (A2 (mod (+ 3.51 (* U (+ 125666.39 (* 0.10 U)))) (* 2 float-pi)))
         (nutation (* -0.0000001 (+ (* 834 (sin A1)) (* 64 (sin A2))))))
    (mod (radians-to-degrees (+ longitude aberration nutation)) 360.0)))