imapext-2007

view docs/calendar.txt @ 0:ada5e610ab86

imap-2007e
author yuuji@gentei.org
date Mon, 14 Sep 2009 15:17:45 +0900
parents
children
line source
1 /* ========================================================================
2 * Copyright 1988-2006 University of Washington
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *
11 * ========================================================================
12 */
14 ALL ABOUT CALENDARS
16 Although one can never be sure of what will happen at some future
17 time, there is strong historical precedent for presuming that the
18 present Gregorian calendar will still be in effect within the useful
19 lifetime of the IMAP toolkit. We have therefore chosen to adhere to
20 these precedents.
22 The purpose of a calendar is to reckon time in advance, to show
23 how many days have to elapse until a certain event takes place in the
24 future, such as the harvest or the release of a new version of Pine.
25 The earliest calendars, naturally, were crude and tended to be based
26 upon the seasons or the lunar cycle.
29 ANCIENT CALENDARS
31 The calendar of the Assyrians, for example, was based upon the
32 phases of the moon. They knew that a lunation (the time from one full
33 moon to the next) was 29 1/2 days long, so their lunar year had a
34 duration of 354 days. This fell short of the solar year by about 11
35 days. (The exact time for the solar year is approximately 365 days, 5
36 hours, 48 minutes, and 46 seconds.) After 3 years, such a lunar
37 calendar would be off by a whole month, so the Assyrians added an extra
38 month from time to time to keep their calendar in synchronization with
39 the seasons.
41 The best approximation that was possible in antiquity was a 19-year
42 period, with 7 of these 19 years having 13 months (leap months). This
43 scheme was adopted as the basis for the lunar calendar used by the
44 Hebrews. The Arabs also used this calendar until Mohammed forbade
45 shifting from 12 months to 13 months; this causes the Muslim holy month
46 of Ramadan to move backwards through the seasons, completing a cycle
47 every 32 1/2 years.
49 When Rome emerged as a world power, the difficulties of making a
50 calendar were well known, but the Romans complicated their lives because
51 of their superstition that even numbers were unlucky. Hence their
52 months were 29 or 31 days long, with the exception of February, which
53 had 28 days. Every second year, the Roman calendar included an extra
54 month called Mercedonius of 22 or 23 days to keep up with the solar
55 year.
58 JULIAN CALENDAR
60 Even this algorithm was very poor, so that in 45 BCE, Caesar,
61 advised by the astronomer Sosigenes, ordered a sweeping reform. By
62 imperial decree, the year 46 BCE was made 445 days long to bring the
63 calendar back in step with the seasons. The new calendar, similar to
64 the one we now use was called the Julian calendar (named after Julius
65 Caesar).
67 Months in the Julian calendar were 30 or 31 days in length and
68 every fourth year was made a leap year (having 366 days) by adding a day
69 to the end of the year. This leap year rule was not consistantly
70 applied until 8 CE. The year-ending month of February, never a popular
71 month, was presently shortened so that Julius Caesar and Emperor
72 Augustus could each have long months named after them.
74 Caesar also decreed that the year would start with the first of
75 January, which since 153 BCE was the day that Roman consuls took office,
76 and not the vernal equinox in late March. Not everyone accepted that
77 part of his reform, as we shall see.
80 GREGORIAN CALENDAR
82 Caesar's year was 11 1/2 minutes short of the calculations
83 recommended by Sosigenes and eventually the date of the vernal equinox
84 began to drift. Roger Bacon became alarmed and sent a note to Pope
85 Clement IV, who apparently was not impressed. Pope Sixtus IV later
86 became convinced that another reform was needed and called the German
87 astronomer, Regiomontanus, to Rome to advise him. Unfortunately,
88 Regiomontanus died of the plague shortly thereafter and the plans died
89 as well.
91 In 1545, the Council of Trent authorized Pope Gregory XIII to
92 reform the calendar once more. Most of the mathematical work was done
93 by Father Christopher Clavius, S.J. The immediate correction that was
94 adopted was that Thursday, October 4, 1582 was to be the last day of the
95 Julian calendar. The next day was Friday, with the date of October 15.
96 For long range accuracy, a formula suggested by the Vatican librarian
97 Aloysius Giglio was adopted. It said that every fourth year is a leap
98 year except for century years that are not divisible by 400. Thus 1700,
99 1800 and 1900 would not be leap years, but 2000 would be a leap year
100 since 2000 is divisible by 400. This rule eliminates 3 leap years every
101 4 centuries, making the calendar sufficiently correct for most ordinary
102 purposes. This calendar is known as the Gregorian calendar and is the
103 one that we now use today.
105 It is interesting to note that in 1582, all the Protestant princes
106 ignored the papal decree and so many countries continued to use the
107 Julian calendar until either 1698 or 1752. Britain and its American
108 colonies went from Wednesday, September 2, 1752 to Thursday, September
109 14. Prior to the changeover, the British used March 25 as the start of
110 the new year.
112 In Russia, it needed the revolution to introduce the Gregorian
113 calendar in 1918. Turkey didn't adopt it until 1927.
116 NUMBERING OF YEARS
118 The numbering of the year is generally done according to an "era",
119 such as the year of a ruler's reign.
121 In about 525, a monk named Dionysius Exiguus suggested that the
122 calculated year of Jesus' birth be designated as year 1 in the Julian
123 calendar. This suggestion was adopted over the next 500 years and
124 subsequently followed in the Gregorian calendar.
126 For the benefit of those who seek religious significance to the
127 calendar millenium, note that year 1 is too late by at least 4 years.
128 Herod the Great, named in the Christian Bible as having all children in
129 Bethlehem put to death in an attempt to kill the infant Jesus, died in 4
130 BCE.
132 Nothing particularly significant of an historic or religious nature
133 happened in Gregorian year 1; however it has become a worldwide standard
134 as the "common era." In modern times, the terms "CE" (common era) and
135 "BCE" (before common era) are preferred over the earlier (and, as we
136 have seen, less accurate) "AD" (anno Domini, "the year of the Lord") and
137 "BC" (before Christ).
139 The Hebrew lunar calendar begins at 3760 BCE, the year of creation
140 in Jewish tradition. The Muslim lunar calendar begins on July 16, 622,
141 when Mohammed fled from Mecca to Medina.
143 The Japanese, Taiwanese, and North Koreans use the Gregorian
144 calendar, but number the year by political era. In Japan, an era
145 begins when an emperor succeeds to the throne; year 1 of the Heisei
146 era was 1989 when Emperor Akihito ascended to the throne (the first
147 few days of 1989 was year 64 of the Shouwa era). In Taiwan, year 1 is
148 the first full year after the founding of the Republic of China in 1911.
149 In North Korea, year 1 is the year of the Juche (self-reliance) ideal,
150 corresponding to the birth year of founder Kim Il-Sung (1912). Thus,
151 year 2000 is Heisei 12 (Japan), 89th year of the Republic (Taiwan),
152 and Juche 89 (North Korea).
155 FURTHER MODIFICATIONS TO THE GREGORIAN CALENDAR
157 Despite the great accuracy of the Gregorian calendar, it still
158 falls behind very slightly every few years. The most serious problem
159 is that the earth's rotation is slowing gradually. If you are very
160 concerned about this problem, we suggest that you tune in short wave
161 radio station WWV or the Global Positioning System, which broadcasts
162 official time signals for use in the United States. About once every
163 3 years, they declare a leap second at which time you should be
164 careful to adjust your system clock. If you have trouble picking up
165 their signals, we suggest you purchase an atomic clock (not part of
166 the IMAP toolkit).
168 Another problem is that the Gregorian calendar represents a year
169 of 365.2425 days, whereas the actual time taken for the earth to
170 rotate around the Sun is 365.2421991 days. Thus, the Gregorian calendar
171 is actually 26 seconds slow each year, resulting in the calendar
172 being one day behind every 3,300 or so years (a Y3.3K problem).
174 Consequently, the Gregorian calendar has been modified with a
175 further rule, which is that years evenly divisible by 4000 are not
176 leap years. Thus, the year 4000 will not be a leap year. Or, at
177 least we assume that's what will happen assuming that the calendar
178 remains unchanged for the next 2000 years.
180 The modified Gregorian calendar represents a year of 365.24225
181 days. Thus, the modified Gregorian calendar is actually 4 seconds
182 slow each year, resulting in the calendar being one day slow every
183 20,000 or so years. So there will be a Y20K problem.
185 There is some dispute whether the modified Gregorian calendar was
186 officially adopted, or if it's just a proposal. Other options (see
187 below) exist; fortunately no decision needs to be made for several
188 centuries yet.
190 There is code in c-client to support the modified Gregorian
191 calendar, although it is currently disabled. Sometime in the next
192 2000 years, someone will need to enable this code so that c-client is
193 Y4K compiliant. Then, 18,000 years from now, someone will have to
194 tear into c-client's code to fix the Y20K bug.
197 EASTERN ORTHODOX MODIFICATION OF THE GREGORIAN CALENDAR
199 The Eastern Orthodox church in 1923 established its own rules to
200 correct the Julian calendar. In their calendar, century years modulo
201 900 must result in value of 200 or 600 to be considered a leap year.
202 Both the Orthodox and Gregorian calendar agree that the years 2000 and
203 2400 will be leap years, and the years 1900, 2100, 2200, 2300, 2500,
204 2600, 2700 are not. However, the year 2800 will be a leap year in the
205 Gregorian calendar but not in the Orthodox calendar; similarly, the
206 year 2900 will be a leap year in the Orthodox calendar but not in the
207 Gregorian calendar. Both calendars will agree that 3000 and
208 3100 are leap years, but will disagree again in 3200 and 3300.
210 There is code in c-client to support the Orthodox calendar. It
211 can be enabled by adding -DUSEORTHODOXCALENDAR=1 to the c-client
212 CFLAGS, e.g.
213 make xxx EXTRACFLAGS="-DUSEORTHODOXCALENDAR=1"
215 The Orthodox calendar represents a year of 365.24222222... days.
216 Thus, the Orthodox calendar is actually 2 seconds slow each year,
217 resulting in the calendar being one day slow every 40,000 or so years.
218 The Eastern Orthodox church has not yet made any statements on how the
219 Y40K bug will be fixed.
222 OTHER ISSUES AFFECTING THE CALENDAR IN THE FUTURE
224 The effect of leap seconds also needs to be considered when
225 looking at the Y3.3K/Y4K, Y20K, and Y40K problems. Leap seconds put
226 the clock back in line with the Earth's rotation, whereas leap years
227 put the calendar back in line with the Earth's revolution. Since leap
228 seconds slow down the clock (and hence the calendar), they actually
229 bring the day of reckoning for the Gregorian and Orthodox calendars
230 sooner.
232 Another factor is that the next ice age (technically, the end of
233 the current interglacial period; we are in the middle of an ice age
234 now!) is due around Y25K. It is not known what perturbations this will
235 cause on the Earth's rotation and revolution, nor what calendar
236 adjustments will be necessary at that time.
238 Hence my use of "or so" in predicting the years that the calendar
239 will fall behind. The actual point may be anywhere from decades (in the
240 case of Y3.3K) to millenia (in the case of Y40K) off from these predictions.
243 MEANINGS OF DAY NAMES
245 The names of days of the week from a combination of Roman and
246 Germanic names for celestial bodies:
247 . Sunday Latin "dies solis" => "Sun's day"
248 . Monday Latin "dies lunae" => "Moon's day"
249 . Tuesday Germanic "Tiw's day" => "Mars' day"
250 . Wednesday Germanic "Woden's day" => "Mercury's day"
251 . Thursday Germanic "Thor's day" => "Jupiter's day"
252 . Friday Germanic "Frigg's day" => "Venus' day"
253 . Saturday Latin "dies Saturni" => "Saturn's day"
256 MEANINGS OF MONTH NAMES
258 The names of the months are from the Roman calendar:
259 . January Janus, protector of doorways
260 . February Februalia, a time for sacrifice to atone for sins
261 . March Mars, god of war
262 . April Latin "aperire" => "to open" buds
263 . May Maia, goddess of plant growth
264 . June Latin "juvenis" => "youth"
265 . July Julius Caesar
266 . August Augustus Caesar
267 . September Latin "septem" => "seven"
268 . October Latin "octo" => "eight"
269 . November Latin "novem" => "nine"
270 . December Latin "decem" => "ten"
272 As you'll notice, the last four months are numbered 7 to 10, which
273 is an artifact of the time when the new year started in March.
276 INTERESTING FORMULAE
278 There's another reason why the historical starting of the new year
279 is significant. Starting with March, the length of months follows a
280 mathematical series:
281 31 30 31 30 31 31 30 31 30 31 31 28
283 This means that you can calculate the day of week for any
284 arbitrary day/month/year of the Gregorian calendar with the following
285 formula (note all divisions are integral):
286 _ _
287 | 7 + 31*(m - 1) y y y |
288 dow = | d + -------------- + y + - - --- + --- | MOD 7
289 |_ 12 4 100 400_|
290 where
291 d := day of month (1..31)
292 m := month in old style (March = 1..February = 12)
293 y := year in old style
294 dow := day of week (Tuesday = 0..Monday = 6)
296 To convert from new style month/year to old style:
297 if (m > 2) m -= 2; /* Mar-Dec: subtract 2 from month */
298 else m += 10,y--; /* Jan-Feb: months 11 & 12 of previous year */
300 Here's another fun formula. To find the number of days between two
301 days, calculate a pair of calendar days with the formula (again, all
302 divisions are integral), using new style month/year this time:
303 m
304 m + -
305 8 y y y
306 d + 30 * (m - 1) + ----- + y * 365 + - - --- + --- - ld
307 2 4 100 400
309 where:
310 d := day of month (1..31)
311 m := month in new style (January = 1..December = 12)
312 y := year in new style
313 ld := leap day correction factor:
314 0 for January and February in non-leap years
315 1 for January and February in leap years
316 2 for all other months in all years
318 In C code, the leap day correction factor is calculated as:
319 (m < 3) ? !(y % 4) && ((y % 100) || !(y % 400)) : 2
321 It's up to you to figure out how to adapt these formulas for the
322 Y4K bugfix and the Orthodox calendar. If you're really clever, try to
323 use these formulae to implement the C library ctime(), gmtime(), and
324 mktime() functions. Most C library implementations use a table of the
325 number of days in a month. You don't need it.
328 ACKNOWLEDGEMENT:
330 The original version is from an old Digital Equipment Corporation SPR
331 answer for VMS. Modifications for c-client, and additional information
332 added by Mark Crispin.

UW-IMAP'd extensions by yuuji