Function: calendar-persian-year-from-absolute
calendar-persian-year-from-absolute is a byte-compiled function
defined in cal-persia.el.gz.
Signature
(calendar-persian-year-from-absolute DATE)
Documentation
Persian year corresponding to the absolute DATE.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/cal-persia.el.gz
day)))) ; days so far this month
(defun calendar-persian-year-from-absolute (date)
"Persian year corresponding to the absolute DATE."
(let* ((d0 ; prior days since start of 2820 cycles
(- date (calendar-persian-to-absolute (list 1 1 -2345))))
(n2820 ; completed 2820-year cycles
(floor d0 1029983))
(d1 ; prior days not in n2820
(mod d0 1029983))
(n768 ; 768-year cycles not in n2820
(floor d1 280506))
(d2 ; prior days not in n2820 or n768
(mod d1 280506))
(n1 ; years not in n2820 or n768
(floor (* 2820 (+ d2 366)) 1029983))
(year (+ (* 2820 n2820) ; complete 2820 year cycles
(* 768 n768) ; complete 768 year cycles
;; Remaining years.
(if (= d1 1029617) ; last day of 2820 year cycle
(1- n1)
n1)
-2345))) ; years before year 1
(if (< year 1)
(1- year) ; no year zero
year)))