Function: calendar-chinese-from-absolute
calendar-chinese-from-absolute is a byte-compiled function defined in
cal-china.el.gz.
Signature
(calendar-chinese-from-absolute DATE)
Documentation
Compute Chinese date (cycle year month day) corresponding to absolute DATE.
The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/cal-china.el.gz
(defun calendar-chinese-from-absolute (date)
"Compute Chinese date (cycle year month day) corresponding to absolute DATE.
The absolute date is the number of days elapsed since the (imaginary)
Gregorian date Sunday, December 31, 1 BC."
(let* ((g-year (calendar-extract-year
(calendar-gregorian-from-absolute date)))
(c-year (+ g-year 2695))
(list (append (calendar-chinese-year (1- g-year))
(calendar-chinese-year g-year)
(calendar-chinese-year (1+ g-year)))))
(while (<= (cadr (cadr list)) date)
;; The first month on the list is in Chinese year c-year.
;; Date is on or after start of second month on list...
(if (= 1 (caar (cdr list)))
;; Second month on list is a new Chinese year...
(setq c-year (1+ c-year)))
;; ...so first month on list is of no interest.
(setq list (cdr list)))
(list (/ (1- c-year) 60)
;; Remainder of c-year/60 with 60 instead of 0.
(1+ (mod (1- c-year) 60))
(caar list)
(1+ (- date (cadr (car list)))))))