aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2012-11-17 16:01:59 -0600
committerJay Belanger2012-11-17 16:01:59 -0600
commit310e60d9454fe2d7e6920cf51f20d438e57f7b28 (patch)
tree53031f808541b9cdb2d17cc79a6b4168db5d0afc
parentd7fe635216f7ac026ede427198dbb75b238d3142 (diff)
downloademacs-310e60d9454fe2d7e6920cf51f20d438e57f7b28.tar.gz
emacs-310e60d9454fe2d7e6920cf51f20d438e57f7b28.zip
Calc now uses the Gregorian calendar for all dates,
and uses January 1, 1 AD as its day number 1. * doc/misc/calc.texi (Date Forms): Document this. * lisp/calc/calc-forms.el (math-julian-date-beginning) (math-julian-date-beginning-int): Implement this.
-rw-r--r--doc/misc/ChangeLog6
-rw-r--r--doc/misc/calc.texi53
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/calc/calc-forms.el12
4 files changed, 42 insertions, 34 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index b31b67b5d84..39931f3a779 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,9 @@
12012-11-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 Calc now uses the Gregorian calendar for all dates,
4 and uses January 1, 1 AD as its day number 1.
5 * calc.texi (Date Forms): Document this.
6
12012-11-16 Glenn Morris <rgm@gnu.org> 72012-11-16 Glenn Morris <rgm@gnu.org>
2 8
3 * cl.texi (Function Bindings): Clarify that cl-flet is lexical. 9 * cl.texi (Function Bindings): Clarify that cl-flet is lexical.
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 2b198575bcb..6daceb4d41a 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -11010,35 +11010,41 @@ You can use the @kbd{v p} (@code{calc-pack}) and @kbd{v u}
11010of a date form. @xref{Packing and Unpacking}. 11010of a date form. @xref{Packing and Unpacking}.
11011 11011
11012Date forms can go arbitrarily far into the future or past. Negative 11012Date forms can go arbitrarily far into the future or past. Negative
11013year numbers represent years BC. Calc uses a combination of the 11013year numbers represent years BC. There is no ``year 0''; the day
11014Gregorian and Julian calendars, following the history of Great 11014before @samp{<Mon Jan 1, +1>} is @samp{<Sun Dec 31, -1>}. These are
11015Britain and the British colonies. This is the same calendar that 11015days 1 and 0 respectively in Calc's internal numbering scheme. The
11016is used by the @code{cal} program in most Unix implementations. 11016Gregorian calendar is used for all dates, including dates before the
11017Gregorian calendar was invented. Thus Calc's use of the day number
11018@mathit{-10000} to represent August 15, 28 BC should be taken with a
11019grain of salt.
11017 11020
11018@cindex Julian calendar 11021@cindex Julian calendar
11019@cindex Gregorian calendar 11022@cindex Gregorian calendar
11020Some historical background: The Julian calendar was created by 11023Some historical background: The Julian calendar was created by
11021Julius Caesar in the year 46 BC as an attempt to fix the gradual 11024Julius Caesar in the year 46 BC as an attempt to fix the confusion
11022drift caused by the lack of leap years in the calendar used 11025caused by the irregular Roman calendar that was used before that time.
11023until that time. The Julian calendar introduced an extra day in 11026The Julian calendar introduced an extra day in
11024all years divisible by four. After some initial confusion, the 11027all years divisible by four. After some initial confusion, the
11025calendar was adopted around the year we call 8 AD. Some centuries 11028calendar was adopted around the year we call 8 AD, although the years were
11029numbered differently and did not necessarily begin on January 1. Some centuries
11026later it became apparent that the Julian year of 365.25 days was 11030later it became apparent that the Julian year of 365.25 days was
11027itself not quite right. In 1582 Pope Gregory XIII introduced the 11031itself not quite right. In 1582 Pope Gregory XIII introduced the
11028Gregorian calendar, which added the new rule that years divisible 11032Gregorian calendar, which added the new rule that years divisible
11029by 100, but not by 400, were not to be considered leap years 11033by 100, but not by 400, were not to be considered leap years
11030despite being divisible by four. Many countries delayed adoption 11034despite being divisible by four. Many countries delayed adoption
11031of the Gregorian calendar because of religious differences; 11035of the Gregorian calendar because of religious differences, and
11032in Britain it was put off until the year 1752, by which time 11036used differing year numbers and start-of-year for other reasons;
11033the Julian calendar had fallen eleven days behind the true 11037for example, in early 1752 England changed the start of its year from
11034seasons. So the switch to the Gregorian calendar in early 11038March 25 to January 1, and in September it switched to the Gregorian
11035September 1752 introduced a discontinuity: The day after 11039calendar: in England, the day after December 31, 1750 was January 1,
11036Sep 2, 1752 is Sep 14, 1752. Calc follows this convention. 110401750 and the day after March 24, 1750 was March 25, 1751, but the day
11037To take another example, Russia waited until 1918 before 11041after December 31, 1751 was January 1, 1752 and the day after
11038adopting the new calendar, and thus needed to remove thirteen 11042September 2, 1752 was September 14, 1752. To take another example,
11039days (between Feb 1, 1918 and Feb 14, 1918). This means that 11043Russia switched both year numbering and start-of-year in 1700, but did
11040Calc's reckoning will be inconsistent with Russian history between 11044not adopt the Gregorian calendar until 1918. Calc's reckoning
110411752 and 1918, and similarly for various other countries. 11045therefore matches English practice starting in 1752 and Russian
11046practice starting in 1918, but disagrees with earlier dates in both
11047countries.
11042 11048
11043Today's timekeepers introduce an occasional ``leap second'' as 11049Today's timekeepers introduce an occasional ``leap second'' as
11044well, but Calc does not take these minor effects into account. 11050well, but Calc does not take these minor effects into account.
@@ -11046,15 +11052,6 @@ well, but Calc does not take these minor effects into account.
11046between, say, @samp{<12:00am Mon Jan 1, 1900>} and 11052between, say, @samp{<12:00am Mon Jan 1, 1900>} and
11047@samp{<12:00am Sat Jan 1, 2000>}.) 11053@samp{<12:00am Sat Jan 1, 2000>}.)
11048 11054
11049Calc uses the Julian calendar for all dates before the year 1752,
11050including dates BC when the Julian calendar technically had not
11051yet been invented. Thus the claim that day number @mathit{-10000} is
11052called ``August 16, 28 BC'' should be taken with a grain of salt.
11053
11054Please note that there is no ``year 0''; the day before
11055@samp{<Sat Jan 1, +1>} is @samp{<Fri Dec 31, -1>}. These are
11056days 0 and @mathit{-1} respectively in Calc's internal numbering scheme.
11057
11058@cindex Julian day counting 11055@cindex Julian day counting
11059Another day counting system in common use is, confusingly, also called 11056Another day counting system in common use is, confusingly, also called
11060``Julian.'' The Julian day number is the numbers of days since 11057``Julian.'' The Julian day number is the numbers of days since
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f9e9217fe10..4c3f4e51ffb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-11-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 * calc/calc-forms.el (math-julian-date-beginning)
4 (math-julian-date-beginning-int): Implement [new date numbering].
5
12012-11-17 Juanma Barranquero <lekktu@gmail.com> 62012-11-17 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * descr-text.el (quail-find-key): 8 * descr-text.el (quail-find-key):
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index c1f6d03db80..d1df20c697c 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -656,13 +656,13 @@ in the Gregorian calendar."
656 (setcdr math-fd-dt nil)) 656 (setcdr math-fd-dt nil))
657 fmt)))) 657 fmt))))
658 658
659(defconst math-julian-date-beginning '(float 17214235 -1) 659(defconst math-julian-date-beginning '(float 17214225 -1)
660 "The beginning of the Julian calendar, 660 "The beginning of the Julian date calendar,
661as measured in the number of days before January 1 of the year 1AD.") 661as measured in the number of days before December 31, 1 BC (Gregorian).")
662 662
663(defconst math-julian-date-beginning-int 1721424 663(defconst math-julian-date-beginning-int 1721423
664 "The beginning of the Julian calendar, 664 "The beginning of the Julian date calendar,
665as measured in the integer number of days before January 1 of the year 1AD.") 665as measured in the integer number of days before December 31, 1 BC (Gregorian).")
666 666
667(defun math-format-date-part (x) 667(defun math-format-date-part (x)
668 (cond ((stringp x) 668 (cond ((stringp x)