Function: math-absolute-from-julian-dt

math-absolute-from-julian-dt is a byte-compiled function defined in calc-forms.el.gz.

Signature

(math-absolute-from-julian-dt YEAR MONTH DAY)

Documentation

Return the DATE of the day given by the Julian day YEAR MONTH DAY.

Recall that DATE is the number of days since December 31, -1 in the Gregorian calendar.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-forms.el.gz
(defun math-absolute-from-julian-dt (year month day)
  "Return the DATE of the day given by the Julian day YEAR MONTH DAY.
Recall that DATE is the number of days since December 31, -1
in the Gregorian calendar."
  (if (eq year 0) (setq year -1))
  (let ((yearm1 (math-sub year 1)))
    (math-sub
     ;; Add the number of days of the year and the numbers of days
     ;; in the previous years (leap year days to be added separately)
     (math-add (math-day-in-year year month day t)
               (math-add (math-mul 365 yearm1)
                         ;; Add the number of Julian leap years
                         (if (math-posp year)
                             (math-quotient yearm1 4)
                           (math-sub 365
                                     (math-quotient (math-sub 3 year)
                                                    4)))))
     ;; Adjustment, since January 1, 1 (Julian) is absolute day -1
     2)))