Function: calendar-coptic-from-absolute

calendar-coptic-from-absolute is a byte-compiled function defined in cal-coptic.el.gz.

Signature

(calendar-coptic-from-absolute DATE)

Documentation

Compute the Coptic equivalent for absolute date DATE.

The result is a list of the form (MONTH DAY YEAR). 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-coptic.el.gz
       day)))                         ; days so far this month

(defun calendar-coptic-from-absolute (date)
  "Compute the Coptic equivalent for absolute date DATE.
The result is a list of the form (MONTH DAY YEAR).
The absolute date is the number of days elapsed since the imaginary
Gregorian date Sunday, December 31, 1 BC."
  (if (< date calendar-coptic-epoch)
      (list 0 0 0)                      ; pre-Coptic date
    (let* ((approx (/ (- date calendar-coptic-epoch)
                      366))    ; approximation from below
           (year               ; search forward from the approximation
            (+ approx
               (calendar-sum y approx
                             (>= date (calendar-coptic-to-absolute
                                       (list 1 1 (1+ y))))
                             1)))
           (month                       ; search forward from Tot
            (1+ (calendar-sum m 1
                              (> date
                                 (calendar-coptic-to-absolute
                                  (list m
                                        (calendar-coptic-last-day-of-month m
                                                                           year)
                                        year)))
                              1)))
           (day                     ; calculate the day by subtraction
            (- date
               (1- (calendar-coptic-to-absolute (list month 1 year))))))
      (list month day year))))