# HG changeset patch # User Glenn Morris # Date 1205632695 0 # Node ID 6c85b8971fe36da07b741ddb44e7c2363fcc3078 # Parent 36af1225602d4137f0c9f80d7a80d43a95dbfab5 (calendar-mayan-haab-to-string): Simplify. (calendar-mayan-tzolkin-from-absolute): Expand calendar-mod calls. diff -r 36af1225602d -r 6c85b8971fe3 lisp/calendar/cal-mayan.el --- a/lisp/calendar/cal-mayan.el Sun Mar 16 01:57:13 2008 +0000 +++ b/lisp/calendar/cal-mayan.el Sun Mar 16 01:58:15 2008 +0000 @@ -215,24 +215,22 @@ (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)