From: Edward M. Reingold Date: Thu, 26 Oct 1995 22:38:23 +0000 (+0000) Subject: Fix the way the sexagisimal names are calculated. X-Git-Tag: emacs-19.34~2554 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b4cb70c40cd2817909e6d39fa62cf1a8e7748289;p=emacs.git Fix the way the sexagisimal names are calculated. --- diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el index 3df879a930a..3c6b8d265f2 100644 --- a/lisp/calendar/cal-china.el +++ b/lisp/calendar/cal-china.el @@ -319,12 +319,10 @@ Gregorian date Sunday, December 31, 1 BC." (calendar-gregorian-from-absolute (cdr (assoc 1 (chinese-year y)))))) (if (calendar-date-is-visible-p chinese-new-year) - (list (list chinese-new-year - (format "Chinese New Year (%s-%s)" - (aref chinese-calendar-celestial-stem - (% (+ y 6) 10)) - (aref chinese-calendar-terrestrial-branch - (% (+ y 8) 12)))))))))) + (list + (list chinese-new-year + (format "Chinese New Year (%s)" + (calendar-chinese-sexagisimal-name (+ y 57)))))))))) (defun calendar-chinese-date-string (&optional date) "String of Chinese date of Gregorian DATE. @@ -344,20 +342,28 @@ Defaults to today's date if DATE is not given." (calendar-mod (1+ (floor month)) 12) 1))) (m-cycle (% (+ (* year 5) (floor month)) 60))) - (format "Cycle %s, year %s (%s-%s), %smonth %s, day %s (%s-%s)" + (format "Cycle %s, year %s (%s), %smonth %s%s, day %s (%s)" cycle - year - (aref chinese-calendar-celestial-stem (% (+ year 9) 10)) - (aref chinese-calendar-terrestrial-branch (% (+ year 11) 12)) + year (calendar-chinese-sexagisimal-name year) (if (not (integerp month)) "second " (if (< 30 (- next-month this-month)) "first " "")) (floor month) - day - (aref chinese-calendar-celestial-stem (% (+ a-date 4) 10)) - (aref chinese-calendar-terrestrial-branch (% (+ a-date 2) 12))))) + (if (integerp month) + (format " (%s)" (calendar-chinese-sexagisimal-name + (+ (* 5 year) month 44))) + "") + day (calendar-chinese-sexagisimal-name (+ a-date 15))))) + +(defun calendar-chinese-sexagisimal-name (n) + "The N-th name of the Chinese sexagisimal cycle. +N congruent to 1 gives the first name, N congruent to 2 gives the second name, +..., N congruent to 60 gives the sixtieth name." + (format "%s-%s" + (aref chinese-calendar-celestial-stem (% (1- n) 10)) + (aref chinese-calendar-terrestrial-branch (% (1- n) 12)))) (defun calendar-print-chinese-date () "Show the Chinese date equivalents of date."