diff options
| author | Paul Eggert | 2012-11-17 16:01:59 -0600 |
|---|---|---|
| committer | Jay Belanger | 2012-11-17 16:01:59 -0600 |
| commit | 310e60d9454fe2d7e6920cf51f20d438e57f7b28 (patch) | |
| tree | 53031f808541b9cdb2d17cc79a6b4168db5d0afc | |
| parent | d7fe635216f7ac026ede427198dbb75b238d3142 (diff) | |
| download | emacs-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/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/misc/calc.texi | 53 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calc/calc-forms.el | 12 |
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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-11-16 Glenn Morris <rgm@gnu.org> | 7 | 2012-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} | |||
| 11010 | of a date form. @xref{Packing and Unpacking}. | 11010 | of a date form. @xref{Packing and Unpacking}. |
| 11011 | 11011 | ||
| 11012 | Date forms can go arbitrarily far into the future or past. Negative | 11012 | Date forms can go arbitrarily far into the future or past. Negative |
| 11013 | year numbers represent years BC. Calc uses a combination of the | 11013 | year numbers represent years BC. There is no ``year 0''; the day |
| 11014 | Gregorian and Julian calendars, following the history of Great | 11014 | before @samp{<Mon Jan 1, +1>} is @samp{<Sun Dec 31, -1>}. These are |
| 11015 | Britain and the British colonies. This is the same calendar that | 11015 | days 1 and 0 respectively in Calc's internal numbering scheme. The |
| 11016 | is used by the @code{cal} program in most Unix implementations. | 11016 | Gregorian calendar is used for all dates, including dates before the |
| 11017 | Gregorian 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 | ||
| 11019 | grain of salt. | ||
| 11017 | 11020 | ||
| 11018 | @cindex Julian calendar | 11021 | @cindex Julian calendar |
| 11019 | @cindex Gregorian calendar | 11022 | @cindex Gregorian calendar |
| 11020 | Some historical background: The Julian calendar was created by | 11023 | Some historical background: The Julian calendar was created by |
| 11021 | Julius Caesar in the year 46 BC as an attempt to fix the gradual | 11024 | Julius Caesar in the year 46 BC as an attempt to fix the confusion |
| 11022 | drift caused by the lack of leap years in the calendar used | 11025 | caused by the irregular Roman calendar that was used before that time. |
| 11023 | until that time. The Julian calendar introduced an extra day in | 11026 | The Julian calendar introduced an extra day in |
| 11024 | all years divisible by four. After some initial confusion, the | 11027 | all years divisible by four. After some initial confusion, the |
| 11025 | calendar was adopted around the year we call 8 AD. Some centuries | 11028 | calendar was adopted around the year we call 8 AD, although the years were |
| 11029 | numbered differently and did not necessarily begin on January 1. Some centuries | ||
| 11026 | later it became apparent that the Julian year of 365.25 days was | 11030 | later it became apparent that the Julian year of 365.25 days was |
| 11027 | itself not quite right. In 1582 Pope Gregory XIII introduced the | 11031 | itself not quite right. In 1582 Pope Gregory XIII introduced the |
| 11028 | Gregorian calendar, which added the new rule that years divisible | 11032 | Gregorian calendar, which added the new rule that years divisible |
| 11029 | by 100, but not by 400, were not to be considered leap years | 11033 | by 100, but not by 400, were not to be considered leap years |
| 11030 | despite being divisible by four. Many countries delayed adoption | 11034 | despite being divisible by four. Many countries delayed adoption |
| 11031 | of the Gregorian calendar because of religious differences; | 11035 | of the Gregorian calendar because of religious differences, and |
| 11032 | in Britain it was put off until the year 1752, by which time | 11036 | used differing year numbers and start-of-year for other reasons; |
| 11033 | the Julian calendar had fallen eleven days behind the true | 11037 | for example, in early 1752 England changed the start of its year from |
| 11034 | seasons. So the switch to the Gregorian calendar in early | 11038 | March 25 to January 1, and in September it switched to the Gregorian |
| 11035 | September 1752 introduced a discontinuity: The day after | 11039 | calendar: in England, the day after December 31, 1750 was January 1, |
| 11036 | Sep 2, 1752 is Sep 14, 1752. Calc follows this convention. | 11040 | 1750 and the day after March 24, 1750 was March 25, 1751, but the day |
| 11037 | To take another example, Russia waited until 1918 before | 11041 | after December 31, 1751 was January 1, 1752 and the day after |
| 11038 | adopting the new calendar, and thus needed to remove thirteen | 11042 | September 2, 1752 was September 14, 1752. To take another example, |
| 11039 | days (between Feb 1, 1918 and Feb 14, 1918). This means that | 11043 | Russia switched both year numbering and start-of-year in 1700, but did |
| 11040 | Calc's reckoning will be inconsistent with Russian history between | 11044 | not adopt the Gregorian calendar until 1918. Calc's reckoning |
| 11041 | 1752 and 1918, and similarly for various other countries. | 11045 | therefore matches English practice starting in 1752 and Russian |
| 11046 | practice starting in 1918, but disagrees with earlier dates in both | ||
| 11047 | countries. | ||
| 11042 | 11048 | ||
| 11043 | Today's timekeepers introduce an occasional ``leap second'' as | 11049 | Today's timekeepers introduce an occasional ``leap second'' as |
| 11044 | well, but Calc does not take these minor effects into account. | 11050 | well, 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. | |||
| 11046 | between, say, @samp{<12:00am Mon Jan 1, 1900>} and | 11052 | between, 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 | ||
| 11049 | Calc uses the Julian calendar for all dates before the year 1752, | ||
| 11050 | including dates BC when the Julian calendar technically had not | ||
| 11051 | yet been invented. Thus the claim that day number @mathit{-10000} is | ||
| 11052 | called ``August 16, 28 BC'' should be taken with a grain of salt. | ||
| 11053 | |||
| 11054 | Please note that there is no ``year 0''; the day before | ||
| 11055 | @samp{<Sat Jan 1, +1>} is @samp{<Fri Dec 31, -1>}. These are | ||
| 11056 | days 0 and @mathit{-1} respectively in Calc's internal numbering scheme. | ||
| 11057 | |||
| 11058 | @cindex Julian day counting | 11055 | @cindex Julian day counting |
| 11059 | Another day counting system in common use is, confusingly, also called | 11056 | Another 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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-11-17 Juanma Barranquero <lekktu@gmail.com> | 6 | 2012-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, |
| 661 | as measured in the number of days before January 1 of the year 1AD.") | 661 | as 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, |
| 665 | as measured in the integer number of days before January 1 of the year 1AD.") | 665 | as 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) |