diff options
author | Glenn Morris <rgm@gnu.org> | 2008-03-16 01:58:15 +0000 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2008-03-16 01:58:15 +0000 |
commit | 2112d731b8e3f0c931b8c5404d2a9794da941990 (patch) | |
tree | 75b0112fb61958292e541455344d4ee964b2a4bb /lisp/calendar/cal-mayan.el | |
parent | 594928444e28ca31ccde7433dc3cb365251208b1 (diff) | |
download | emacs-2112d731b8e3f0c931b8c5404d2a9794da941990.tar.gz |
(calendar-mayan-haab-to-string): Simplify.
(calendar-mayan-tzolkin-from-absolute): Expand calendar-mod calls.
Diffstat (limited to 'lisp/calendar/cal-mayan.el')
-rw-r--r-- | lisp/calendar/cal-mayan.el | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lisp/calendar/cal-mayan.el b/lisp/calendar/cal-mayan.el index 56522c8dd36..c36a82bc3e9 100644 --- a/lisp/calendar/cal-mayan.el +++ b/lisp/calendar/cal-mayan.el @@ -215,24 +215,22 @@ Echo Mayan date unless NOECHO is non-nil." (defun calendar-mayan-haab-to-string (haab) "Convert Mayan HAAB date (a pair) into its traditional written form." - (let ((month (cdr haab)) - (day (car haab))) - ;; 19th month consists of 5 special days - (if (= month 19) - (format "%d Uayeb" day) - (format "%d %s" - day + (let ((month (cdr haab))) + (format "%d %s" (car haab) ; day + ;; 19th month consists of 5 special days + (if (= month 19) "Uayeb" (aref calendar-mayan-haab-month-name-array (1- month)))))) (defun calendar-mayan-tzolkin-from-absolute (date) "Convert absolute DATE into a Mayan tzolkin date (a pair)." (let* ((long-count (+ date calendar-mayan-days-before-absolute-zero)) - (day (calendar-mod - (+ long-count (car calendar-mayan-tzolkin-at-epoch)) - 13)) - (name (calendar-mod - (+ long-count (cdr calendar-mayan-tzolkin-at-epoch)) - 20))) + ;; Remainder on division by 13,20 with 13,20 instead of zero. + (day (1+ (mod + (1- (+ long-count (car calendar-mayan-tzolkin-at-epoch))) + 13))) + (name (1+ (mod + (1- (+ long-count (cdr calendar-mayan-tzolkin-at-epoch))) + 20)))) (cons day name))) (defun calendar-mayan-tzolkin-difference (date1 date2) |