Theory 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. Theory and pragmatics of the tz code and data
  2. ----- Outline -----
  3. Scope of the tz database
  4. Names of time zone rules
  5. Time zone abbreviations
  6. Accuracy of the tz database
  7. Time and date functions
  8. Calendrical issues
  9. Time and time zones on Mars
  10. ----- Scope of the tz database -----
  11. The tz database attempts to record the history and predicted future of
  12. all computer-based clocks that track civil time. To represent this
  13. data, the world is partitioned into regions whose clocks all agree
  14. about time stamps that occur after the somewhat-arbitrary cutoff point
  15. of the POSIX Epoch (1970-01-01 00:00:00 UTC). For each such region,
  16. the database records all known clock transitions, and labels the region
  17. with a notable location. Although 1970 is a somewhat-arbitrary
  18. cutoff, there are significant challenges to moving the cutoff earlier
  19. even by a decade or two, due to the wide variety of local practices
  20. before computer timekeeping became prevalent.
  21. Clock transitions before 1970 are recorded for each such location,
  22. because most systems support time stamps before 1970 and could
  23. misbehave if data entries were omitted for pre-1970 transitions.
  24. However, the database is not designed for and does not suffice for
  25. applications requiring accurate handling of all past times everywhere,
  26. as it would take far too much effort and guesswork to record all
  27. details of pre-1970 civil timekeeping.
  28. As described below, reference source code for using the tz database is
  29. also available. The tz code is upwards compatible with POSIX, an
  30. international standard for UNIX-like systems. As of this writing, the
  31. current edition of POSIX is:
  32. The Open Group Base Specifications Issue 7
  33. IEEE Std 1003.1, 2013 Edition
  34. <http://pubs.opengroup.org/onlinepubs/9699919799/>
  35. ----- Names of time zone rules -----
  36. Each of the database's time zone rules has a unique name.
  37. Inexperienced users are not expected to select these names unaided.
  38. Distributors should provide documentation and/or a simple selection
  39. interface that explains the names; for one example, see the 'tzselect'
  40. program in the tz code. The Unicode Common Locale Data Repository
  41. <http://cldr.unicode.org/> contains data that may be useful for other
  42. selection interfaces.
  43. The time zone rule naming conventions attempt to strike a balance
  44. among the following goals:
  45. * Uniquely identify every region where clocks have agreed since 1970.
  46. This is essential for the intended use: static clocks keeping local
  47. civil time.
  48. * Indicate to experts where that region is.
  49. * Be robust in the presence of political changes. For example, names
  50. of countries are ordinarily not used, to avoid incompatibilities
  51. when countries change their name (e.g. Zaire->Congo) or when
  52. locations change countries (e.g. Hong Kong from UK colony to
  53. China).
  54. * Be portable to a wide variety of implementations.
  55. * Use a consistent naming conventions over the entire world.
  56. Names normally have the form AREA/LOCATION, where AREA is the name
  57. of a continent or ocean, and LOCATION is the name of a specific
  58. location within that region. North and South America share the same
  59. area, 'America'. Typical names are 'Africa/Cairo', 'America/New_York',
  60. and 'Pacific/Honolulu'.
  61. Here are the general rules used for choosing location names,
  62. in decreasing order of importance:
  63. Use only valid POSIX file name components (i.e., the parts of
  64. names other than '/'). Do not use the file name
  65. components '.' and '..'. Within a file name component,
  66. use only ASCII letters, '.', '-' and '_'. Do not use
  67. digits, as that might create an ambiguity with POSIX
  68. TZ strings. A file name component must not exceed 14
  69. characters or start with '-'. E.g., prefer 'Brunei'
  70. to 'Bandar_Seri_Begawan'. Exceptions: see the discussion
  71. of legacy names below.
  72. A name must not be empty, or contain '//', or start or end with '/'.
  73. Do not use names that differ only in case. Although the reference
  74. implementation is case-sensitive, some other implementations
  75. are not, and they would mishandle names differing only in case.
  76. If one name A is an initial prefix of another name AB (ignoring case),
  77. then B must not start with '/', as a regular file cannot have
  78. the same name as a directory in POSIX. For example,
  79. 'America/New_York' precludes 'America/New_York/Bronx'.
  80. Uninhabited regions like the North Pole and Bouvet Island
  81. do not need locations, since local time is not defined there.
  82. There should typically be at least one name for each ISO 3166-1
  83. officially assigned two-letter code for an inhabited country
  84. or territory.
  85. If all the clocks in a region have agreed since 1970,
  86. don't bother to include more than one location
  87. even if subregions' clocks disagreed before 1970.
  88. Otherwise these tables would become annoyingly large.
  89. If a name is ambiguous, use a less ambiguous alternative;
  90. e.g. many cities are named San José and Georgetown, so
  91. prefer 'Costa_Rica' to 'San_Jose' and 'Guyana' to 'Georgetown'.
  92. Keep locations compact. Use cities or small islands, not countries
  93. or regions, so that any future time zone changes do not split
  94. locations into different time zones. E.g. prefer 'Paris'
  95. to 'France', since France has had multiple time zones.
  96. Use mainstream English spelling, e.g. prefer 'Rome' to 'Roma', and
  97. prefer 'Athens' to the Greek 'Αθήνα' or the Romanized 'Athína'.
  98. The POSIX file name restrictions encourage this rule.
  99. Use the most populous among locations in a zone,
  100. e.g. prefer 'Shanghai' to 'Beijing'. Among locations with
  101. similar populations, pick the best-known location,
  102. e.g. prefer 'Rome' to 'Milan'.
  103. Use the singular form, e.g. prefer 'Canary' to 'Canaries'.
  104. Omit common suffixes like '_Islands' and '_City', unless that
  105. would lead to ambiguity. E.g. prefer 'Cayman' to
  106. 'Cayman_Islands' and 'Guatemala' to 'Guatemala_City',
  107. but prefer 'Mexico_City' to 'Mexico' because the country
  108. of Mexico has several time zones.
  109. Use '_' to represent a space.
  110. Omit '.' from abbreviations in names, e.g. prefer 'St_Helena'
  111. to 'St._Helena'.
  112. Do not change established names if they only marginally
  113. violate the above rules. For example, don't change
  114. the existing name 'Rome' to 'Milan' merely because
  115. Milan's population has grown to be somewhat greater
  116. than Rome's.
  117. If a name is changed, put its old spelling in the 'backward' file.
  118. This means old spellings will continue to work.
  119. The file 'zone1970.tab' lists geographical locations used to name time
  120. zone rules. It is intended to be an exhaustive list of names for
  121. geographic regions as described above; this is a subset of the names
  122. in the data. Although a 'zone1970.tab' location's longitude
  123. corresponds to its LMT offset with one hour for every 15 degrees east
  124. longitude, this relationship is not exact.
  125. Older versions of this package used a different naming scheme,
  126. and these older names are still supported.
  127. See the file 'backward' for most of these older names
  128. (e.g., 'US/Eastern' instead of 'America/New_York').
  129. The other old-fashioned names still supported are
  130. 'WET', 'CET', 'MET', and 'EET' (see the file 'europe').
  131. Older versions of this package defined legacy names that are
  132. incompatible with the first rule of location names, but which are
  133. still supported. These legacy names are mostly defined in the file
  134. 'etcetera'. Also, the file 'backward' defines the legacy names
  135. 'GMT0', 'GMT-0', 'GMT+0' and 'Canada/East-Saskatchewan', and the file
  136. 'northamerica' defines the legacy names 'EST5EDT', 'CST6CDT',
  137. 'MST7MDT', and 'PST8PDT'.
  138. Excluding 'backward' should not affect the other data. If
  139. 'backward' is excluded, excluding 'etcetera' should not affect the
  140. remaining data.
  141. ----- Time zone abbreviations -----
  142. When this package is installed, it generates time zone abbreviations
  143. like 'EST' to be compatible with human tradition and POSIX.
  144. Here are the general rules used for choosing time zone abbreviations,
  145. in decreasing order of importance:
  146. Use abbreviations that consist of three or more ASCII letters.
  147. Previous editions of this database also used characters like
  148. ' ' and '?', but these characters have a special meaning to
  149. the shell and cause commands like
  150. set `date`
  151. to have unexpected effects.
  152. Previous editions of this rule required upper-case letters,
  153. but the Congressman who introduced Chamorro Standard Time
  154. preferred "ChST", so the rule has been relaxed.
  155. This rule guarantees that all abbreviations could have
  156. been specified by a POSIX TZ string. POSIX
  157. requires at least three characters for an
  158. abbreviation. POSIX through 2000 says that an abbreviation
  159. cannot start with ':', and cannot contain ',', '-',
  160. '+', NUL, or a digit. POSIX from 2001 on changes this
  161. rule to say that an abbreviation can contain only '-', '+',
  162. and alphanumeric characters from the portable character set
  163. in the current locale. To be portable to both sets of
  164. rules, an abbreviation must therefore use only ASCII
  165. letters.
  166. Use abbreviations that are in common use among English-speakers,
  167. e.g. 'EST' for Eastern Standard Time in North America.
  168. We assume that applications translate them to other languages
  169. as part of the normal localization process; for example,
  170. a French application might translate 'EST' to 'HNE'.
  171. For zones whose times are taken from a city's longitude, use the
  172. traditional xMT notation, e.g. 'PMT' for Paris Mean Time.
  173. The only name like this in current use is 'GMT'.
  174. Use 'LMT' for local mean time of locations before the introduction
  175. of standard time; see "Scope of the tz database".
  176. If there is no common English abbreviation, use numeric offsets like
  177. -05 and +0830 that are generated by zic's %z notation.
  178. [The remaining guidelines predate the introduction of %z.
  179. They are problematic as they mean tz data entries invent
  180. notation rather than record it. These guidelines are now
  181. deprecated and the plan is to gradually move to %z for
  182. inhabited locations and to "-00" for uninhabited locations.]
  183. If there is no common English abbreviation, abbreviate the English
  184. translation of the usual phrase used by native speakers.
  185. If this is not available or is a phrase mentioning the country
  186. (e.g. "Cape Verde Time"), then:
  187. When a country is identified with a single or principal zone,
  188. append 'T' to the country's ISO code, e.g. 'CVT' for
  189. Cape Verde Time. For summer time append 'ST';
  190. for double summer time append 'DST'; etc.
  191. Otherwise, take the first three letters of an English place
  192. name identifying each zone and append 'T', 'ST', etc.
  193. as before; e.g. 'VLAST' for VLAdivostok Summer Time.
  194. Use UT (with time zone abbreviation 'zzz') for locations while
  195. uninhabited. The 'zzz' mnemonic is that these locations are,
  196. in some sense, asleep.
  197. Application writers should note that these abbreviations are ambiguous
  198. in practice: e.g. 'CST' has a different meaning in China than
  199. it does in the United States. In new applications, it's often better
  200. to use numeric UT offsets like '-0600' instead of time zone
  201. abbreviations like 'CST'; this avoids the ambiguity.
  202. ----- Accuracy of the tz database -----
  203. The tz database is not authoritative, and it surely has errors.
  204. Corrections are welcome and encouraged; see the file CONTRIBUTING.
  205. Users requiring authoritative data should consult national standards
  206. bodies and the references cited in the database's comments.
  207. Errors in the tz database arise from many sources:
  208. * The tz database predicts future time stamps, and current predictions
  209. will be incorrect after future governments change the rules.
  210. For example, if today someone schedules a meeting for 13:00 next
  211. October 1, Casablanca time, and tomorrow Morocco changes its
  212. daylight saving rules, software can mess up after the rule change
  213. if it blithely relies on conversions made before the change.
  214. * The pre-1970 entries in this database cover only a tiny sliver of how
  215. clocks actually behaved; the vast majority of the necessary
  216. information was lost or never recorded. Thousands more zones would
  217. be needed if the tz database's scope were extended to cover even
  218. just the known or guessed history of standard time; for example,
  219. the current single entry for France would need to split into dozens
  220. of entries, perhaps hundreds.
  221. * Most of the pre-1970 data entries come from unreliable sources, often
  222. astrology books that lack citations and whose compilers evidently
  223. invented entries when the true facts were unknown, without
  224. reporting which entries were known and which were invented.
  225. These books often contradict each other or give implausible entries,
  226. and on the rare occasions when they are checked they are
  227. typically found to be incorrect.
  228. * For the UK the tz database relies on years of first-class work done by
  229. Joseph Myers and others; see <http://www.polyomino.org.uk/british-time/>.
  230. Other countries are not done nearly as well.
  231. * Sometimes, different people in the same city would maintain clocks
  232. that differed significantly. Railway time was used by railroad
  233. companies (which did not always agree with each other),
  234. church-clock time was used for birth certificates, etc.
  235. Often this was merely common practice, but sometimes it was set by law.
  236. For example, from 1891 to 1911 the UT offset in France was legally
  237. 0:09:21 outside train stations and 0:04:21 inside.
  238. * Although a named location in the tz database stands for the
  239. containing region, its pre-1970 data entries are often accurate for
  240. only a small subset of that region. For example, Europe/London
  241. stands for the United Kingdom, but its pre-1847 times are valid
  242. only for locations that have London's exact meridian, and its 1847
  243. transition to GMT is known to be valid only for the L&NW and the
  244. Caledonian railways.
  245. * The tz database does not record the earliest time for which a zone's
  246. data entries are thereafter valid for every location in the region.
  247. For example, Europe/London is valid for all locations in its
  248. region after GMT was made the standard time, but the date of
  249. standardization (1880-08-02) is not in the tz database, other than
  250. in commentary. For many zones the earliest time of validity is
  251. unknown.
  252. * The tz database does not record a region's boundaries, and in many
  253. cases the boundaries are not known. For example, the zone
  254. America/Kentucky/Louisville represents a region around the city of
  255. Louisville, the boundaries of which are unclear.
  256. * Changes that are modeled as instantaneous transitions in the tz
  257. database were often spread out over hours, days, or even decades.
  258. * Even if the time is specified by law, locations sometimes
  259. deliberately flout the law.
  260. * Early timekeeping practices, even assuming perfect clocks, were
  261. often not specified to the accuracy that the tz database requires.
  262. * Sometimes historical timekeeping was specified more precisely
  263. than what the tz database can handle. For example, from 1909 to
  264. 1937 Netherlands clocks were legally UT+00:19:32.13, but the tz
  265. database cannot represent the fractional second.
  266. * Even when all the timestamp transitions recorded by the tz database
  267. are correct, the tz rules that generate them may not faithfully
  268. reflect the historical rules. For example, from 1922 until World
  269. War II the UK moved clocks forward the day following the third
  270. Saturday in April unless that was Easter, in which case it moved
  271. clocks forward the previous Sunday. Because the tz database has no
  272. way to specify Easter, these exceptional years are entered as
  273. separate tz Rule lines, even though the legal rules did not change.
  274. * The tz database models pre-standard time using the proleptic Gregorian
  275. calendar and local mean time (LMT), but many people used other
  276. calendars and other timescales. For example, the Roman Empire used
  277. the Julian calendar, and had 12 varying-length daytime hours with a
  278. non-hour-based system at night.
  279. * Early clocks were less reliable, and data entries do not represent
  280. this unreliability.
  281. * As for leap seconds, civil time was not based on atomic time before
  282. 1972, and we don't know the history of earth's rotation accurately
  283. enough to map SI seconds to historical solar time to more than
  284. about one-hour accuracy. See: Morrison LV, Stephenson FR.
  285. Historical values of the Earth's clock error Delta T and the
  286. calculation of eclipses. J Hist Astron. 2004;35:327-36
  287. <http://adsabs.harvard.edu/full/2004JHA....35..327M>;
  288. Historical values of the Earth's clock error. J Hist Astron. 2005;36:339
  289. <http://adsabs.harvard.edu/full/2005JHA....36..339M>.
  290. * The relationship between POSIX time (that is, UTC but ignoring leap
  291. seconds) and UTC is not agreed upon after 1972. Although the POSIX
  292. clock officially stops during an inserted leap second, at least one
  293. proposed standard has it jumping back a second instead; and in
  294. practice POSIX clocks more typically either progress glacially during
  295. a leap second, or are slightly slowed while near a leap second.
  296. * The tz database does not represent how uncertain its information is.
  297. Ideally it would contain information about when data entries are
  298. incomplete or dicey. Partial temporal knowledge is a field of
  299. active research, though, and it's not clear how to apply it here.
  300. In short, many, perhaps most, of the tz database's pre-1970 and future
  301. time stamps are either wrong or misleading. Any attempt to pass the
  302. tz database off as the definition of time should be unacceptable to
  303. anybody who cares about the facts. In particular, the tz database's
  304. LMT offsets should not be considered meaningful, and should not prompt
  305. creation of zones merely because two locations differ in LMT or
  306. transitioned to standard time at different dates.
  307. ----- Time and date functions -----
  308. The tz code contains time and date functions that are upwards
  309. compatible with those of POSIX.
  310. POSIX has the following properties and limitations.
  311. * In POSIX, time display in a process is controlled by the
  312. environment variable TZ. Unfortunately, the POSIX TZ string takes
  313. a form that is hard to describe and is error-prone in practice.
  314. Also, POSIX TZ strings can't deal with other (for example, Israeli)
  315. daylight saving time rules, or situations where more than two
  316. time zone abbreviations are used in an area.
  317. The POSIX TZ string takes the following form:
  318. stdoffset[dst[offset][,date[/time],date[/time]]]
  319. where:
  320. std and dst
  321. are 3 or more characters specifying the standard
  322. and daylight saving time (DST) zone names.
  323. Starting with POSIX.1-2001, std and dst may also be
  324. in a quoted form like "<UTC+10>"; this allows
  325. "+" and "-" in the names.
  326. offset
  327. is of the form '[+-]hh:[mm[:ss]]' and specifies the
  328. offset west of UT. 'hh' may be a single digit; 0<=hh<=24.
  329. The default DST offset is one hour ahead of standard time.
  330. date[/time],date[/time]
  331. specifies the beginning and end of DST. If this is absent,
  332. the system supplies its own rules for DST, and these can
  333. differ from year to year; typically US DST rules are used.
  334. time
  335. takes the form 'hh:[mm[:ss]]' and defaults to 02:00.
  336. This is the same format as the offset, except that a
  337. leading '+' or '-' is not allowed.
  338. date
  339. takes one of the following forms:
  340. Jn (1<=n<=365)
  341. origin-1 day number not counting February 29
  342. n (0<=n<=365)
  343. origin-0 day number counting February 29 if present
  344. Mm.n.d (0[Sunday]<=d<=6[Saturday], 1<=n<=5, 1<=m<=12)
  345. for the dth day of week n of month m of the year,
  346. where week 1 is the first week in which day d appears,
  347. and '5' stands for the last week in which day d appears
  348. (which may be either the 4th or 5th week).
  349. Typically, this is the only useful form;
  350. the n and Jn forms are rarely used.
  351. Here is an example POSIX TZ string, for US Pacific time using rules
  352. appropriate from 1987 through 2006:
  353. TZ='PST8PDT,M4.1.0/02:00,M10.5.0/02:00'
  354. This POSIX TZ string is hard to remember, and mishandles time stamps
  355. before 1987 and after 2006. With this package you can use this
  356. instead:
  357. TZ='America/Los_Angeles'
  358. * POSIX does not define the exact meaning of TZ values like "EST5EDT".
  359. Typically the current US DST rules are used to interpret such values,
  360. but this means that the US DST rules are compiled into each program
  361. that does time conversion. This means that when US time conversion
  362. rules change (as in the United States in 1987), all programs that
  363. do time conversion must be recompiled to ensure proper results.
  364. * In POSIX, there's no tamper-proof way for a process to learn the
  365. system's best idea of local wall clock. (This is important for
  366. applications that an administrator wants used only at certain times -
  367. without regard to whether the user has fiddled the "TZ" environment
  368. variable. While an administrator can "do everything in UTC" to get
  369. around the problem, doing so is inconvenient and precludes handling
  370. daylight saving time shifts - as might be required to limit phone
  371. calls to off-peak hours.)
  372. * POSIX requires that systems ignore leap seconds.
  373. * The tz code attempts to support all the time_t implementations
  374. allowed by POSIX. The time_t type represents a nonnegative count of
  375. seconds since 1970-01-01 00:00:00 UTC, ignoring leap seconds.
  376. In practice, time_t is usually a signed 64- or 32-bit integer; 32-bit
  377. signed time_t values stop working after 2038-01-19 03:14:07 UTC, so
  378. new implementations these days typically use a signed 64-bit integer.
  379. Unsigned 32-bit integers are used on one or two platforms,
  380. and 36-bit and 40-bit integers are also used occasionally.
  381. Although earlier POSIX versions allowed time_t to be a
  382. floating-point type, this was not supported by any practical
  383. systems, and POSIX.1-2013 and the tz code both require time_t
  384. to be an integer type.
  385. These are the extensions that have been made to the POSIX functions:
  386. * The "TZ" environment variable is used in generating the name of a file
  387. from which time zone information is read (or is interpreted a la
  388. POSIX); "TZ" is no longer constrained to be a three-letter time zone
  389. name followed by a number of hours and an optional three-letter
  390. daylight time zone name. The daylight saving time rules to be used
  391. for a particular time zone are encoded in the time zone file;
  392. the format of the file allows U.S., Australian, and other rules to be
  393. encoded, and allows for situations where more than two time zone
  394. abbreviations are used.
  395. It was recognized that allowing the "TZ" environment variable to
  396. take on values such as "America/New_York" might cause "old" programs
  397. (that expect "TZ" to have a certain form) to operate incorrectly;
  398. consideration was given to using some other environment variable
  399. (for example, "TIMEZONE") to hold the string used to generate the
  400. time zone information file name. In the end, however, it was decided
  401. to continue using "TZ": it is widely used for time zone purposes;
  402. separately maintaining both "TZ" and "TIMEZONE" seemed a nuisance;
  403. and systems where "new" forms of "TZ" might cause problems can simply
  404. use TZ values such as "EST5EDT" which can be used both by
  405. "new" programs (a la POSIX) and "old" programs (as zone names and
  406. offsets).
  407. * To handle places where more than two time zone abbreviations are used,
  408. the functions "localtime" and "gmtime" set tzname[tmp->tm_isdst]
  409. (where "tmp" is the value the function returns) to the time zone
  410. abbreviation to be used. This differs from POSIX, where the elements
  411. of tzname are only changed as a result of calls to tzset.
  412. * Since the "TZ" environment variable can now be used to control time
  413. conversion, the "daylight" and "timezone" variables are no longer
  414. needed. (These variables are defined and set by "tzset"; however, their
  415. values will not be used by "localtime.")
  416. * The "localtime" function has been set up to deliver correct results
  417. for near-minimum or near-maximum time_t values. (A comment in the
  418. source code tells how to get compatibly wrong results).
  419. * A function "tzsetwall" has been added to arrange for the system's
  420. best approximation to local wall clock time to be delivered by
  421. subsequent calls to "localtime." Source code for portable
  422. applications that "must" run on local wall clock time should call
  423. "tzsetwall();" if such code is moved to "old" systems that don't
  424. provide tzsetwall, you won't be able to generate an executable program.
  425. (These time zone functions also arrange for local wall clock time to be
  426. used if tzset is called - directly or indirectly - and there's no "TZ"
  427. environment variable; portable applications should not, however, rely
  428. on this behavior since it's not the way SVR2 systems behave.)
  429. * Negative time_t values are supported, on systems where time_t is signed.
  430. * These functions can account for leap seconds, thanks to Bradley White.
  431. Points of interest to folks with other systems:
  432. * This package is already part of many POSIX-compliant hosts,
  433. including BSD, HP, Linux, Network Appliance, SCO, SGI, and Sun.
  434. On such hosts, the primary use of this package
  435. is to update obsolete time zone rule tables.
  436. To do this, you may need to compile the time zone compiler
  437. 'zic' supplied with this package instead of using the system 'zic',
  438. since the format of zic's input changed slightly in late 1994,
  439. and many vendors still do not support the new input format.
  440. * The UNIX Version 7 "timezone" function is not present in this package;
  441. it's impossible to reliably map timezone's arguments (a "minutes west
  442. of GMT" value and a "daylight saving time in effect" flag) to a
  443. time zone abbreviation, and we refuse to guess.
  444. Programs that in the past used the timezone function may now examine
  445. tzname[localtime(&clock)->tm_isdst] to learn the correct time
  446. zone abbreviation to use. Alternatively, use
  447. localtime(&clock)->tm_zone if this has been enabled.
  448. * The 4.2BSD gettimeofday function is not used in this package.
  449. This formerly let users obtain the current UTC offset and DST flag,
  450. but this functionality was removed in later versions of BSD.
  451. * In SVR2, time conversion fails for near-minimum or near-maximum
  452. time_t values when doing conversions for places that don't use UT.
  453. This package takes care to do these conversions correctly.
  454. The functions that are conditionally compiled if STD_INSPIRED is defined
  455. should, at this point, be looked on primarily as food for thought. They are
  456. not in any sense "standard compatible" - some are not, in fact, specified in
  457. *any* standard. They do, however, represent responses of various authors to
  458. standardization proposals.
  459. Other time conversion proposals, in particular the one developed by folks at
  460. Hewlett Packard, offer a wider selection of functions that provide capabilities
  461. beyond those provided here. The absence of such functions from this package
  462. is not meant to discourage the development, standardization, or use of such
  463. functions. Rather, their absence reflects the decision to make this package
  464. contain valid extensions to POSIX, to ensure its broad acceptability. If
  465. more powerful time conversion functions can be standardized, so much the
  466. better.
  467. ----- Calendrical issues -----
  468. Calendrical issues are a bit out of scope for a time zone database,
  469. but they indicate the sort of problems that we would run into if we
  470. extended the time zone database further into the past. An excellent
  471. resource in this area is Nachum Dershowitz and Edward M. Reingold,
  472. Calendrical Calculations: Third Edition, Cambridge University Press (2008)
  473. <http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/>.
  474. Other information and sources are given below. They sometimes disagree.
  475. France
  476. Gregorian calendar adopted 1582-12-20.
  477. French Revolutionary calendar used 1793-11-24 through 1805-12-31,
  478. and (in Paris only) 1871-05-06 through 1871-05-23.
  479. Russia
  480. From Chris Carrier (1996-12-02):
  481. On 1929-10-01 the Soviet Union instituted an "Eternal Calendar"
  482. with 30-day months plus 5 holidays, with a 5-day week.
  483. On 1931-12-01 it changed to a 6-day week; in 1934 it reverted to the
  484. Gregorian calendar while retaining the 6-day week; on 1940-06-27 it
  485. reverted to the 7-day week. With the 6-day week the usual days
  486. off were the 6th, 12th, 18th, 24th and 30th of the month.
  487. (Source: Evitiar Zerubavel, _The Seven Day Circle_)
  488. Mark Brader reported a similar story in "The Book of Calendars", edited
  489. by Frank Parise (1982, Facts on File, ISBN 0-8719-6467-8), page 377. But:
  490. From: Petteri Sulonen (via Usenet)
  491. Date: 14 Jan 1999 00:00:00 GMT
  492. ...
  493. If your source is correct, how come documents between 1929 and 1940 were
  494. still dated using the conventional, Gregorian calendar?
  495. I can post a scan of a document dated December 1, 1934, signed by
  496. Yenukidze, the secretary, on behalf of Kalinin, the President of the
  497. Executive Committee of the Supreme Soviet, if you like.
  498. Sweden (and Finland)
  499. From: Mark Brader
  500. Subject: Re: Gregorian reform - a part of locale?
  501. <news:1996Jul6.012937.29190@sq.com>
  502. Date: 1996-07-06
  503. In 1700, Denmark made the transition from Julian to Gregorian. Sweden
  504. decided to *start* a transition in 1700 as well, but rather than have one of
  505. those unsightly calendar gaps :-), they simply decreed that the next leap
  506. year after 1696 would be in 1744 - putting the whole country on a calendar
  507. different from both Julian and Gregorian for a period of 40 years.
  508. However, in 1704 something went wrong and the plan was not carried through;
  509. they did, after all, have a leap year that year. And one in 1708. In 1712
  510. they gave it up and went back to Julian, putting 30 days in February that
  511. year!...
  512. Then in 1753, Sweden made the transition to Gregorian in the usual manner,
  513. getting there only 13 years behind the original schedule.
  514. (A previous posting of this story was challenged, and Swedish readers
  515. produced the following references to support it: "Tideräkning och historia"
  516. by Natanael Beckman (1924) and "Tid, en bok om tideräkning och
  517. kalenderväsen" by Lars-Olof Lodén (1968).
  518. Grotefend's data
  519. From: "Michael Palmer" [with one obvious typo fixed]
  520. Subject: Re: Gregorian Calendar (was Re: Another FHC related question
  521. Newsgroups: soc.genealogy.german
  522. Date: Tue, 9 Feb 1999 02:32:48 -800
  523. ...
  524. The following is a(n incomplete) listing, arranged chronologically, of
  525. European states, with the date they converted from the Julian to the
  526. Gregorian calendar:
  527. 04/15 Oct 1582 - Italy (with exceptions), Spain, Portugal, Poland (Roman
  528. Catholics and Danzig only)
  529. 09/20 Dec 1582 - France, Lorraine
  530. 21 Dec 1582/
  531. 01 Jan 1583 - Holland, Brabant, Flanders, Hennegau
  532. 10/21 Feb 1583 - bishopric of Liege (Lüttich)
  533. 13/24 Feb 1583 - bishopric of Augsburg
  534. 04/15 Oct 1583 - electorate of Trier
  535. 05/16 Oct 1583 - Bavaria, bishoprics of Freising, Eichstedt, Regensburg,
  536. Salzburg, Brixen
  537. 13/24 Oct 1583 - Austrian Oberelsaß and Breisgau
  538. 20/31 Oct 1583 - bishopric of Basel
  539. 02/13 Nov 1583 - duchy of Jülich-Berg
  540. 02/13 Nov 1583 - electorate and city of Köln
  541. 04/15 Nov 1583 - bishopric of Würzburg
  542. 11/22 Nov 1583 - electorate of Mainz
  543. 16/27 Nov 1583 - bishopric of Strassburg and the margraviate of Baden
  544. 17/28 Nov 1583 - bishopric of Münster and duchy of Cleve
  545. 14/25 Dec 1583 - Steiermark
  546. 06/17 Jan 1584 - Austria and Bohemia
  547. 11/22 Jan 1584 - Lucerne, Uri, Schwyz, Zug, Freiburg, Solothurn
  548. 12/23 Jan 1584 - Silesia and the Lausitz
  549. 22 Jan/
  550. 02 Feb 1584 - Hungary (legally on 21 Oct 1587)
  551. Jun 1584 - Unterwalden
  552. 01/12 Jul 1584 - duchy of Westfalen
  553. 16/27 Jun 1585 - bishopric of Paderborn
  554. 14/25 Dec 1590 - Transylvania
  555. 22 Aug/
  556. 02 Sep 1612 - duchy of Prussia
  557. 13/24 Dec 1614 - Pfalz-Neuburg
  558. 1617 - duchy of Kurland (reverted to the Julian calendar in
  559. 1796)
  560. 1624 - bishopric of Osnabrück
  561. 1630 - bishopric of Minden
  562. 15/26 Mar 1631 - bishopric of Hildesheim
  563. 1655 - Kanton Wallis
  564. 05/16 Feb 1682 - city of Strassburg
  565. 18 Feb/
  566. 01 Mar 1700 - Protestant Germany (including Swedish possessions in
  567. Germany), Denmark, Norway
  568. 30 Jun/
  569. 12 Jul 1700 - Gelderland, Zutphen
  570. 10 Nov/
  571. 12 Dec 1700 - Utrecht, Overijssel
  572. 31 Dec 1700/
  573. 12 Jan 1701 - Friesland, Groningen, Zürich, Bern, Basel, Geneva,
  574. Turgau, and Schaffhausen
  575. 1724 - Glarus, Appenzell, and the city of St. Gallen
  576. 01 Jan 1750 - Pisa and Florence
  577. 02/14 Sep 1752 - Great Britain
  578. 17 Feb/
  579. 01 Mar 1753 - Sweden
  580. 1760-1812 - Graubünden
  581. The Russian empire (including Finland and the Baltic states) did not
  582. convert to the Gregorian calendar until the Soviet revolution of 1917.
  583. Source: H. Grotefend, _Taschenbuch der Zeitrechnung des deutschen
  584. Mittelalters und der Neuzeit_, herausgegeben von Dr. O. Grotefend
  585. (Hannover: Hahnsche Buchhandlung, 1941), pp. 26-28.
  586. ----- Time and time zones on Mars -----
  587. Some people's work schedules use Mars time. Jet Propulsion Laboratory
  588. (JPL) coordinators have kept Mars time on and off at least since 1997
  589. for the Mars Pathfinder mission. Some of their family members have
  590. also adapted to Mars time. Dozens of special Mars watches were built
  591. for JPL workers who kept Mars time during the Mars Exploration
  592. Rovers mission (2004). These timepieces look like normal Seikos and
  593. Citizens but use Mars seconds rather than terrestrial seconds.
  594. A Mars solar day is called a "sol" and has a mean period equal to
  595. about 24 hours 39 minutes 35.244 seconds in terrestrial time. It is
  596. divided into a conventional 24-hour clock, so each Mars second equals
  597. about 1.02749125 terrestrial seconds.
  598. The prime meridian of Mars goes through the center of the crater
  599. Airy-0, named in honor of the British astronomer who built the
  600. Greenwich telescope that defines Earth's prime meridian. Mean solar
  601. time on the Mars prime meridian is called Mars Coordinated Time (MTC).
  602. Each landed mission on Mars has adopted a different reference for
  603. solar time keeping, so there is no real standard for Mars time zones.
  604. For example, the Mars Exploration Rover project (2004) defined two
  605. time zones "Local Solar Time A" and "Local Solar Time B" for its two
  606. missions, each zone designed so that its time equals local true solar
  607. time at approximately the middle of the nominal mission. Such a "time
  608. zone" is not particularly suited for any application other than the
  609. mission itself.
  610. Many calendars have been proposed for Mars, but none have achieved
  611. wide acceptance. Astronomers often use Mars Sol Date (MSD) which is a
  612. sequential count of Mars solar days elapsed since about 1873-12-29
  613. 12:00 GMT.
  614. The tz database does not currently support Mars time, but it is
  615. documented here in the hopes that support will be added eventually.
  616. Sources:
  617. Michael Allison and Robert Schmunk,
  618. "Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock"
  619. <http://www.giss.nasa.gov/tools/mars24/help/notes.html> (2012-08-08).
  620. Jia-Rui Chong, "Workdays Fit for a Martian", Los Angeles Times
  621. <http://articles.latimes.com/2004/jan/14/science/sci-marstime14>
  622. (2004-01-14), pp A1, A20-A21.
  623. Tom Chmielewski, "Jet Lag Is Worse on Mars", The Atlantic (2015-02-26)
  624. <http://www.theatlantic.com/technology/archive/2015/02/jet-lag-is-worse-on-mars/386033/>
  625. -----
  626. This file is in the public domain, so clarified as of 2009-05-17 by
  627. Arthur David Olson.
  628. -----
  629. Local Variables:
  630. coding: utf-8
  631. End: