imapext-2007

diff docs/calendar.txt @ 0:ada5e610ab86

imap-2007e
author yuuji@gentei.org
date Mon, 14 Sep 2009 15:17:45 +0900
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docs/calendar.txt	Mon Sep 14 15:17:45 2009 +0900
     1.3 @@ -0,0 +1,332 @@
     1.4 +/* ========================================================================
     1.5 + * Copyright 1988-2006 University of Washington
     1.6 + *
     1.7 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.8 + * you may not use this file except in compliance with the License.
     1.9 + * You may obtain a copy of the License at
    1.10 + *
    1.11 + *     http://www.apache.org/licenses/LICENSE-2.0
    1.12 + *
    1.13 + * 
    1.14 + * ========================================================================
    1.15 + */
    1.16 +
    1.17 +			 ALL ABOUT CALENDARS
    1.18 +
    1.19 +     Although one can never be sure of what will happen at some future
    1.20 +time, there is strong historical precedent for presuming that the
    1.21 +present Gregorian calendar will still be in effect within the useful
    1.22 +lifetime of the IMAP toolkit.  We have therefore chosen to adhere to
    1.23 +these precedents.
    1.24 + 
    1.25 +     The purpose of a calendar is to reckon time in advance, to show
    1.26 +how many days have to elapse until a certain event takes place in the
    1.27 +future, such as the harvest or the release of a new version of Pine.
    1.28 +The earliest calendars, naturally, were crude and tended to be based
    1.29 +upon the seasons or the lunar cycle.
    1.30 + 
    1.31 +
    1.32 +ANCIENT CALENDARS
    1.33 +
    1.34 +     The calendar of the Assyrians, for example, was based upon the
    1.35 +phases of the moon.  They knew that a lunation (the time from one full
    1.36 +moon to the next) was 29 1/2 days long, so their lunar year had a
    1.37 +duration of 354 days.  This fell short of the solar year by about 11
    1.38 +days.  (The exact time for the solar year is approximately 365 days, 5
    1.39 +hours, 48 minutes, and 46 seconds.)  After 3 years, such a lunar
    1.40 +calendar would be off by a whole month, so the Assyrians added an extra
    1.41 +month from time to time to keep their calendar in synchronization with
    1.42 +the seasons.
    1.43 + 
    1.44 +     The best approximation that was possible in antiquity was a 19-year
    1.45 +period, with 7 of these 19 years having 13 months (leap months).  This
    1.46 +scheme was adopted as the basis for the lunar calendar used by the
    1.47 +Hebrews.  The Arabs also used this calendar until Mohammed forbade
    1.48 +shifting from 12 months to 13 months; this causes the Muslim holy month
    1.49 +of Ramadan to move backwards through the seasons, completing a cycle
    1.50 +every 32 1/2 years.
    1.51 + 
    1.52 +     When Rome emerged as a world power, the difficulties of making a
    1.53 +calendar were well known, but the Romans complicated their lives because
    1.54 +of their superstition that even numbers were unlucky.  Hence their
    1.55 +months were 29 or 31 days long, with the exception of February, which
    1.56 +had 28 days.  Every second year, the Roman calendar included an extra
    1.57 +month called Mercedonius of 22 or 23 days to keep up with the solar
    1.58 +year.
    1.59 +
    1.60 +
    1.61 +JULIAN CALENDAR
    1.62 +
    1.63 +     Even this algorithm was very poor, so that in 45 BCE, Caesar,
    1.64 +advised by the astronomer Sosigenes, ordered a sweeping reform.  By
    1.65 +imperial decree, the year 46 BCE was made 445 days long to bring the
    1.66 +calendar back in step with the seasons.  The new calendar, similar to
    1.67 +the one we now use was called the Julian calendar (named after Julius
    1.68 +Caesar).
    1.69 +
    1.70 +     Months in the Julian calendar were 30 or 31 days in length and
    1.71 +every fourth year was made a leap year (having 366 days) by adding a day
    1.72 +to the end of the year.  This leap year rule was not consistantly
    1.73 +applied until 8 CE.  The year-ending month of February, never a popular
    1.74 +month, was presently shortened so that Julius Caesar and Emperor
    1.75 +Augustus could each have long months named after them.
    1.76 +
    1.77 +     Caesar also decreed that the year would start with the first of
    1.78 +January, which since 153 BCE was the day that Roman consuls took office,
    1.79 +and not the vernal equinox in late March.  Not everyone accepted that
    1.80 +part of his reform, as we shall see.
    1.81 +
    1.82 + 
    1.83 +GREGORIAN CALENDAR
    1.84 +
    1.85 +     Caesar's year was 11 1/2 minutes short of the calculations
    1.86 +recommended by Sosigenes and eventually the date of the vernal equinox
    1.87 +began to drift.  Roger Bacon became alarmed and sent a note to Pope
    1.88 +Clement IV, who apparently was not impressed.  Pope Sixtus IV later
    1.89 +became convinced that another reform was needed and called the German
    1.90 +astronomer, Regiomontanus, to Rome to advise him.  Unfortunately,
    1.91 +Regiomontanus died of the plague shortly thereafter and the plans died
    1.92 +as well.
    1.93 + 
    1.94 +     In 1545, the Council of Trent authorized Pope Gregory XIII to
    1.95 +reform the calendar once more.  Most of the mathematical work was done
    1.96 +by Father Christopher Clavius, S.J.  The immediate correction that was
    1.97 +adopted was that Thursday, October 4, 1582 was to be the last day of the
    1.98 +Julian calendar.  The next day was Friday, with the date of October 15.
    1.99 +For long range accuracy, a formula suggested by the Vatican librarian
   1.100 +Aloysius Giglio was adopted.  It said that every fourth year is a leap
   1.101 +year except for century years that are not divisible by 400.  Thus 1700,
   1.102 +1800 and 1900 would not be leap years, but 2000 would be a leap year
   1.103 +since 2000 is divisible by 400.  This rule eliminates 3 leap years every
   1.104 +4 centuries, making the calendar sufficiently correct for most ordinary
   1.105 +purposes.  This calendar is known as the Gregorian calendar and is the
   1.106 +one that we now use today.
   1.107 +
   1.108 +     It is interesting to note that in 1582, all the Protestant princes
   1.109 +ignored the papal decree and so many countries continued to use the
   1.110 +Julian calendar until either 1698 or 1752.  Britain and its American
   1.111 +colonies went from Wednesday, September 2, 1752 to Thursday, September
   1.112 +14.  Prior to the changeover, the British used March 25 as the start of
   1.113 +the new year.
   1.114 +
   1.115 +     In Russia, it needed the revolution to introduce the Gregorian
   1.116 +calendar in 1918.  Turkey didn't adopt it until 1927.
   1.117 +
   1.118 +
   1.119 +NUMBERING OF YEARS
   1.120 +
   1.121 +     The numbering of the year is generally done according to an "era",
   1.122 +such as the year of a ruler's reign.
   1.123 +
   1.124 +     In about 525, a monk named Dionysius Exiguus suggested that the
   1.125 +calculated year of Jesus' birth be designated as year 1 in the Julian
   1.126 +calendar.  This suggestion was adopted over the next 500 years and
   1.127 +subsequently followed in the Gregorian calendar.
   1.128 +
   1.129 +     For the benefit of those who seek religious significance to the
   1.130 +calendar millenium, note that year 1 is too late by at least 4 years.
   1.131 +Herod the Great, named in the Christian Bible as having all children in
   1.132 +Bethlehem put to death in an attempt to kill the infant Jesus, died in 4
   1.133 +BCE.
   1.134 +
   1.135 +     Nothing particularly significant of an historic or religious nature
   1.136 +happened in Gregorian year 1; however it has become a worldwide standard
   1.137 +as the "common era."  In modern times, the terms "CE" (common era) and
   1.138 +"BCE" (before common era) are preferred over the earlier (and, as we
   1.139 +have seen, less accurate) "AD" (anno Domini, "the year of the Lord") and
   1.140 +"BC" (before Christ).
   1.141 +
   1.142 +     The Hebrew lunar calendar begins at 3760 BCE, the year of creation
   1.143 +in Jewish tradition.  The Muslim lunar calendar begins on July 16, 622,
   1.144 +when Mohammed fled from Mecca to Medina.
   1.145 +
   1.146 +     The Japanese, Taiwanese, and North Koreans use the Gregorian
   1.147 +calendar, but number the year by political era.  In Japan, an era
   1.148 +begins when an emperor succeeds to the throne; year 1 of the Heisei
   1.149 +era was 1989 when Emperor Akihito ascended to the throne (the first
   1.150 +few days of 1989 was year 64 of the Shouwa era).  In Taiwan, year 1 is
   1.151 +the first full year after the founding of the Republic of China in 1911.
   1.152 +In North Korea, year 1 is the year of the Juche (self-reliance) ideal,
   1.153 +corresponding to the birth year of founder Kim Il-Sung (1912).  Thus,
   1.154 +year 2000 is Heisei 12 (Japan), 89th year of the Republic (Taiwan),
   1.155 +and Juche 89 (North Korea).
   1.156 +
   1.157 +
   1.158 +FURTHER MODIFICATIONS TO THE GREGORIAN CALENDAR
   1.159 +
   1.160 +     Despite the great accuracy of the Gregorian calendar, it still
   1.161 +falls behind very slightly every few years.  The most serious problem
   1.162 +is that the earth's rotation is slowing gradually.  If you are very
   1.163 +concerned about this problem, we suggest that you tune in short wave
   1.164 +radio station WWV or the Global Positioning System, which broadcasts
   1.165 +official time signals for use in the United States.  About once every
   1.166 +3 years, they declare a leap second at which time you should be
   1.167 +careful to adjust your system clock.  If you have trouble picking up
   1.168 +their signals, we suggest you purchase an atomic clock (not part of
   1.169 +the IMAP toolkit).
   1.170 +
   1.171 +     Another problem is that the Gregorian calendar represents a year
   1.172 +of 365.2425 days, whereas the actual time taken for the earth to
   1.173 +rotate around the Sun is 365.2421991 days.  Thus, the Gregorian calendar
   1.174 +is actually 26 seconds slow each year, resulting in the calendar
   1.175 +being one day behind every 3,300 or so years (a Y3.3K problem).
   1.176 +
   1.177 +     Consequently, the Gregorian calendar has been modified with a
   1.178 +further rule, which is that years evenly divisible by 4000 are not
   1.179 +leap years.  Thus, the year 4000 will not be a leap year.  Or, at
   1.180 +least we assume that's what will happen assuming that the calendar
   1.181 +remains unchanged for the next 2000 years.
   1.182 +
   1.183 +     The modified Gregorian calendar represents a year of 365.24225
   1.184 +days.  Thus, the modified Gregorian calendar is actually 4 seconds
   1.185 +slow each year, resulting in the calendar being one day slow every
   1.186 +20,000 or so years.  So there will be a Y20K problem.
   1.187 +
   1.188 +     There is some dispute whether the modified Gregorian calendar was
   1.189 +officially adopted, or if it's just a proposal.  Other options (see
   1.190 +below) exist; fortunately no decision needs to be made for several
   1.191 +centuries yet.
   1.192 +
   1.193 +     There is code in c-client to support the modified Gregorian
   1.194 +calendar, although it is currently disabled.  Sometime in the next
   1.195 +2000 years, someone will need to enable this code so that c-client is
   1.196 +Y4K compiliant.  Then, 18,000 years from now, someone will have to
   1.197 +tear into c-client's code to fix the Y20K bug.
   1.198 +
   1.199 +
   1.200 +EASTERN ORTHODOX MODIFICATION OF THE GREGORIAN CALENDAR
   1.201 +
   1.202 +     The Eastern Orthodox church in 1923 established its own rules to
   1.203 +correct the Julian calendar.  In their calendar, century years modulo
   1.204 +900 must result in value of 200 or 600 to be considered a leap year.
   1.205 +Both the Orthodox and Gregorian calendar agree that the years 2000 and
   1.206 +2400 will be leap years, and the years 1900, 2100, 2200, 2300, 2500,
   1.207 +2600, 2700 are not.  However, the year 2800 will be a leap year in the
   1.208 +Gregorian calendar but not in the Orthodox calendar; similarly, the
   1.209 +year 2900 will be a leap year in the Orthodox calendar but not in the
   1.210 +Gregorian calendar.  Both calendars will agree that 3000 and
   1.211 +3100 are leap years, but will disagree again in 3200 and 3300.
   1.212 +
   1.213 +     There is code in c-client to support the Orthodox calendar.  It
   1.214 +can be enabled by adding -DUSEORTHODOXCALENDAR=1 to the c-client
   1.215 +CFLAGS, e.g.
   1.216 +	make xxx EXTRACFLAGS="-DUSEORTHODOXCALENDAR=1"
   1.217 +
   1.218 +     The Orthodox calendar represents a year of 365.24222222... days.
   1.219 +Thus, the Orthodox calendar is actually 2 seconds slow each year,
   1.220 +resulting in the calendar being one day slow every 40,000 or so years.
   1.221 +The Eastern Orthodox church has not yet made any statements on how the
   1.222 +Y40K bug will be fixed.
   1.223 +
   1.224 +
   1.225 +OTHER ISSUES AFFECTING THE CALENDAR IN THE FUTURE
   1.226 +
   1.227 +     The effect of leap seconds also needs to be considered when
   1.228 +looking at the Y3.3K/Y4K, Y20K, and Y40K problems.  Leap seconds put
   1.229 +the clock back in line with the Earth's rotation, whereas leap years
   1.230 +put the calendar back in line with the Earth's revolution.  Since leap
   1.231 +seconds slow down the clock (and hence the calendar), they actually
   1.232 +bring the day of reckoning for the Gregorian and Orthodox calendars
   1.233 +sooner.
   1.234 +
   1.235 +     Another factor is that the next ice age (technically, the end of
   1.236 +the current interglacial period; we are in the middle of an ice age
   1.237 +now!) is due around Y25K.  It is not known what perturbations this will
   1.238 +cause on the Earth's rotation and revolution, nor what calendar
   1.239 +adjustments will be necessary at that time.
   1.240 +
   1.241 +     Hence my use of "or so" in predicting the years that the calendar
   1.242 +will fall behind.  The actual point may be anywhere from decades (in the
   1.243 +case of Y3.3K) to millenia (in the case of Y40K) off from these predictions.
   1.244 +
   1.245 +
   1.246 +MEANINGS OF DAY NAMES
   1.247 +
   1.248 +     The names of days of the week from a combination of Roman and
   1.249 +Germanic names for celestial bodies:
   1.250 +. Sunday	Latin "dies solis" => "Sun's day"
   1.251 +. Monday	Latin "dies lunae" => "Moon's day"
   1.252 +. Tuesday	Germanic "Tiw's day" => "Mars' day"
   1.253 +. Wednesday	Germanic "Woden's day" => "Mercury's day"
   1.254 +. Thursday	Germanic "Thor's day" => "Jupiter's day"
   1.255 +. Friday	Germanic "Frigg's day" => "Venus' day"
   1.256 +. Saturday	Latin "dies Saturni" => "Saturn's day"
   1.257 +
   1.258 +
   1.259 +MEANINGS OF MONTH NAMES
   1.260 +
   1.261 +     The names of the months are from the Roman calendar:
   1.262 +. January	Janus, protector of doorways
   1.263 +. February	Februalia, a time for sacrifice to atone for sins
   1.264 +. March		Mars, god of war
   1.265 +. April		Latin "aperire" => "to open" buds
   1.266 +. May		Maia, goddess of plant growth
   1.267 +. June		Latin "juvenis" => "youth"
   1.268 +. July		Julius Caesar
   1.269 +. August	Augustus Caesar
   1.270 +. September	Latin "septem" => "seven"
   1.271 +. October	Latin "octo" => "eight"
   1.272 +. November	Latin "novem" => "nine"
   1.273 +. December	Latin "decem" => "ten"
   1.274 +
   1.275 +     As you'll notice, the last four months are numbered 7 to 10, which
   1.276 +is an artifact of the time when the new year started in March.
   1.277 +
   1.278 +
   1.279 +INTERESTING FORMULAE
   1.280 +
   1.281 +     There's another reason why the historical starting of the new year
   1.282 +is significant.  Starting with March, the length of months follows a
   1.283 +mathematical series:
   1.284 +	31 30 31 30 31 31 30 31 30 31 31 28
   1.285 +
   1.286 +     This means that you can calculate the day of week for any
   1.287 +arbitrary day/month/year of the Gregorian calendar with the following
   1.288 +formula (note all divisions are integral):
   1.289 +        _                                      _
   1.290 +       |     7 + 31*(m - 1)       y    y     y  |
   1.291 + dow = | d + -------------- + y + - - --- + --- | MOD 7
   1.292 +       |_          12             4   100   400_|
   1.293 +where
   1.294 + d   := day of month (1..31)
   1.295 + m   := month in old style (March = 1..February = 12)
   1.296 + y   := year in old style
   1.297 + dow := day of week (Tuesday = 0..Monday = 6)
   1.298 +
   1.299 +     To convert from new style month/year to old style:
   1.300 +  if (m > 2) m -= 2;		/* Mar-Dec: subtract 2 from month */
   1.301 +  else m += 10,y--;		/* Jan-Feb: months 11 & 12 of previous year */
   1.302 +
   1.303 +     Here's another fun formula.  To find the number of days between two
   1.304 +days, calculate a pair of calendar days with the formula (again, all
   1.305 +divisions are integral), using new style month/year this time:
   1.306 +                        m
   1.307 +                    m + -
   1.308 +                        8             y    y     y
   1.309 + d + 30 * (m - 1) + ----- + y * 365 + - - --- + --- - ld
   1.310 +                      2               4   100   400
   1.311 +
   1.312 +where:
   1.313 + d   := day of month (1..31)
   1.314 + m   := month in new style (January = 1..December = 12)
   1.315 + y   := year in new style
   1.316 + ld  := leap day correction factor:
   1.317 +	0 for January and February in non-leap years
   1.318 +	1 for January and February in leap years
   1.319 +	2 for all other months in all years        
   1.320 +
   1.321 +     In C code, the leap day correction factor is calculated as:
   1.322 +  (m < 3) ? !(y % 4) && ((y % 100) || !(y % 400)) : 2
   1.323 +
   1.324 +     It's up to you to figure out how to adapt these formulas for the
   1.325 +Y4K bugfix and the Orthodox calendar.  If you're really clever, try to
   1.326 +use these formulae to implement the C library ctime(), gmtime(), and
   1.327 +mktime() functions.  Most C library implementations use a table of the
   1.328 +number of days in a month.  You don't need it.
   1.329 +
   1.330 +
   1.331 +ACKNOWLEDGEMENT:
   1.332 +
   1.333 +The original version is from an old Digital Equipment Corporation SPR
   1.334 +answer for VMS.  Modifications for c-client, and additional information
   1.335 +added by Mark Crispin.

UW-IMAP'd extensions by yuuji