[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v |
Date: |
Fri, 14 Mar 2008 03:34:42 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Glenn Morris <gm> 08/03/14 03:34:42
Index: cal-julian.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/cal-julian.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- cal-julian.el 13 Mar 2008 05:45:28 -0000 1.25
+++ cal-julian.el 14 Mar 2008 03:34:42 -0000 1.26
@@ -38,6 +38,20 @@
(require 'calendar)
+(defun calendar-absolute-from-julian (date)
+ "The number of days elapsed between the Gregorian date 12/31/1 BC and DATE.
+The Gregorian date Sunday, December 31, 1 BC is imaginary."
+ (let ((month (extract-calendar-month date))
+ (year (extract-calendar-year date)))
+ (+ (calendar-day-number date)
+ (if (and (zerop (% year 100))
+ (not (zerop (% year 400)))
+ (> month 2))
+ 1 0) ; correct for Julian but not Gregorian leap year
+ (* 365 (1- year))
+ (/ (1- year) 4)
+ -2)))
+
;;;###cal-autoload
(defun calendar-julian-from-absolute (date)
"Compute the Julian (month day year) corresponding to the absolute DATE.
@@ -47,7 +61,8 @@
(year ; search forward from the approximation
(+ approx
(calendar-sum y approx
- (>= date (calendar-absolute-from-julian (list 1 1 (1+ y))))
+ (>= date (calendar-absolute-from-julian
+ (list 1 1 (1+ y))))
1)))
(month ; search forward from January
(1+ (calendar-sum m 1
@@ -56,7 +71,8 @@
(list m
(if (and (= m 2) (zerop (% year 4)))
29
- (aref [31 28 31 30 31 30 31 31 30 31 30 31]
+ (aref [31 28 31 30 31 30 31
+ 31 30 31 30 31]
(1- m)))
year)))
1)))
@@ -64,21 +80,6 @@
(- date (1- (calendar-absolute-from-julian (list month 1 year))))))
(list month day year)))
-(defun calendar-absolute-from-julian (date)
- "The number of days elapsed between the Gregorian date 12/31/1 BC and DATE.
-The Gregorian date Sunday, December 31, 1 BC is imaginary."
- (let ((month (extract-calendar-month date))
- (day (extract-calendar-day date))
- (year (extract-calendar-year date)))
- (+ (calendar-day-number date)
- (if (and (zerop (% year 100))
- (/= (% year 400) 0)
- (> month 2))
- 1 0) ; correct for Julian but not Gregorian leap year
- (* 365 (1- year))
- (/ (1- year) 4)
- -2)))
-
;;;###cal-autoload
(defun calendar-julian-date-string (&optional date)
"String of Julian date of Gregorian DATE.
@@ -86,8 +87,7 @@
Driven by the variable `calendar-date-display-form'."
(calendar-date-string
(calendar-julian-from-absolute
- (calendar-absolute-from-gregorian
- (or date (calendar-current-date))))
+ (calendar-absolute-from-gregorian (or date (calendar-current-date))))
nil t))
;;;###cal-autoload
@@ -99,7 +99,7 @@
;;;###cal-autoload
(defun calendar-goto-julian-date (date &optional noecho)
- "Move cursor to Julian DATE; echo Julian date unless NOECHO is t."
+ "Move cursor to Julian DATE; echo Julian date unless NOECHO is non-nil."
(interactive
(let* ((today (calendar-current-date))
(year (calendar-read
@@ -181,8 +181,7 @@
(int-to-string
(ceiling
(calendar-astro-from-absolute
- (calendar-absolute-from-gregorian
- (or date (calendar-current-date)))))))
+ (calendar-absolute-from-gregorian (or date (calendar-current-date)))))))
;;;###cal-autoload
(defun calendar-print-astro-day-number ()
@@ -195,7 +194,7 @@
;;;###cal-autoload
(defun calendar-goto-astro-day-number (daynumber &optional noecho)
"Move cursor to astronomical (Julian) DAYNUMBER.
-Echo astronomical (Julian) day number unless NOECHO is t."
+Echo astronomical (Julian) day number unless NOECHO is non-nil."
(interactive (list (calendar-read
"Astronomical (Julian) day number (>1721425): "
(lambda (x) (> x 1721425)))))
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/07
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/07
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/12
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/13
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v,
Glenn Morris <=
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/29
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/30
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/31
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/31
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-julian.el,v, Glenn Morris, 2008/03/31