Theory revision 1.19
11.18SchristosTheory and pragmatics of the tz code and data 21.18Schristos 31.2Sperry 41.2Sperry----- Outline ----- 51.2Sperry 61.10Schristos Scope of the tz database 71.18Schristos Names of time zone rules 81.2Sperry Time zone abbreviations 91.18Schristos Accuracy of the tz database 101.18Schristos Time and date functions 111.4Skleink Calendrical issues 121.8Skleink Time and time zones on Mars 131.2Sperry 141.2Sperry 151.18Schristos----- Scope of the tz database ----- 161.18Schristos 171.18SchristosThe tz database attempts to record the history and predicted future of 181.18Schristosall computer-based clocks that track civil time. To represent this 191.18Schristosdata, the world is partitioned into regions whose clocks all agree 201.18Schristosabout time stamps that occur after the somewhat-arbitrary cutoff point 211.18Schristosof the POSIX Epoch (1970-01-01 00:00:00 UTC). For each such region, 221.18Schristosthe database records all known clock transitions, and labels the region 231.18Schristoswith a notable location. Although 1970 is a somewhat-arbitrary 241.18Schristoscutoff, there are significant challenges to moving the cutoff earlier 251.18Schristoseven by a decade or two, due to the wide variety of local practices 261.18Schristosbefore computer timekeeping became prevalent. 271.18Schristos 281.18SchristosClock transitions before 1970 are recorded for each such location, 291.18Schristosbecause most systems support time stamps before 1970 and could 301.18Schristosmisbehave if data entries were omitted for pre-1970 transitions. 311.18SchristosHowever, the database is not designed for and does not suffice for 321.18Schristosapplications requiring accurate handling of all past times everywhere, 331.18Schristosas it would take far too much effort and guesswork to record all 341.18Schristosdetails of pre-1970 civil timekeeping. 351.18Schristos 361.18SchristosAs described below, reference source code for using the tz database is 371.18Schristosalso available. The tz code is upwards compatible with POSIX, an 381.18Schristosinternational standard for UNIX-like systems. As of this writing, the 391.18Schristoscurrent edition of POSIX is: 401.2Sperry 411.14Schristos The Open Group Base Specifications Issue 7 421.14Schristos IEEE Std 1003.1, 2013 Edition 431.14Schristos <http://pubs.opengroup.org/onlinepubs/9699919799/> 441.2Sperry 451.2Sperry 461.1Sjtc 471.18Schristos----- Names of time zone rules ----- 481.2Sperry 491.18SchristosEach of the database's time zone rules has a unique name. 501.18SchristosInexperienced users are not expected to select these names unaided. 511.18SchristosDistributors should provide documentation and/or a simple selection 521.18Schristosinterface that explains the names; for one example, see the 'tzselect' 531.18Schristosprogram in the tz code. The Unicode Common Locale Data Repository 541.18Schristos<http://cldr.unicode.org/> contains data that may be useful for other 551.18Schristosselection interfaces. 561.2Sperry 571.18SchristosThe time zone rule naming conventions attempt to strike a balance 581.18Schristosamong the following goals: 591.6Skleink 601.18Schristos * Uniquely identify every region where clocks have agreed since 1970. 611.18Schristos This is essential for the intended use: static clocks keeping local 621.18Schristos civil time. 631.18Schristos 641.18Schristos * Indicate to experts where that region is. 651.18Schristos 661.18Schristos * Be robust in the presence of political changes. For example, names 671.18Schristos of countries are ordinarily not used, to avoid incompatibilities 681.18Schristos when countries change their name (e.g. Zaire->Congo) or when 691.18Schristos locations change countries (e.g. Hong Kong from UK colony to 701.18Schristos China). 711.2Sperry 721.18Schristos * Be portable to a wide variety of implementations. 731.9Smlelstv 741.18Schristos * Use a consistent naming conventions over the entire world. 751.9Smlelstv 761.18SchristosNames normally have the form AREA/LOCATION, where AREA is the name 771.18Schristosof a continent or ocean, and LOCATION is the name of a specific 781.18Schristoslocation within that region. North and South America share the same 791.18Schristosarea, 'America'. Typical names are 'Africa/Cairo', 'America/New_York', 801.18Schristosand 'Pacific/Honolulu'. 811.9Smlelstv 821.18SchristosHere are the general rules used for choosing location names, 831.18Schristosin decreasing order of importance: 841.9Smlelstv 851.18Schristos Use only valid POSIX file name components (i.e., the parts of 861.18Schristos names other than '/'). Do not use the file name 871.18Schristos components '.' and '..'. Within a file name component, 881.18Schristos use only ASCII letters, '.', '-' and '_'. Do not use 891.18Schristos digits, as that might create an ambiguity with POSIX 901.18Schristos TZ strings. A file name component must not exceed 14 911.18Schristos characters or start with '-'. E.g., prefer 'Brunei' 921.18Schristos to 'Bandar_Seri_Begawan'. Exceptions: see the discussion 931.18Schristos of legacy names below. 941.18Schristos A name must not be empty, or contain '//', or start or end with '/'. 951.18Schristos Do not use names that differ only in case. Although the reference 961.18Schristos implementation is case-sensitive, some other implementations 971.18Schristos are not, and they would mishandle names differing only in case. 981.18Schristos If one name A is an initial prefix of another name AB (ignoring case), 991.18Schristos then B must not start with '/', as a regular file cannot have 1001.18Schristos the same name as a directory in POSIX. For example, 1011.18Schristos 'America/New_York' precludes 'America/New_York/Bronx'. 1021.18Schristos Uninhabited regions like the North Pole and Bouvet Island 1031.18Schristos do not need locations, since local time is not defined there. 1041.18Schristos There should typically be at least one name for each ISO 3166-1 1051.18Schristos officially assigned two-letter code for an inhabited country 1061.18Schristos or territory. 1071.18Schristos If all the clocks in a region have agreed since 1970, 1081.18Schristos don't bother to include more than one location 1091.18Schristos even if subregions' clocks disagreed before 1970. 1101.18Schristos Otherwise these tables would become annoyingly large. 1111.18Schristos If a name is ambiguous, use a less ambiguous alternative; 1121.18Schristos e.g. many cities are named San José and Georgetown, so 1131.18Schristos prefer 'Costa_Rica' to 'San_Jose' and 'Guyana' to 'Georgetown'. 1141.18Schristos Keep locations compact. Use cities or small islands, not countries 1151.18Schristos or regions, so that any future time zone changes do not split 1161.18Schristos locations into different time zones. E.g. prefer 'Paris' 1171.18Schristos to 'France', since France has had multiple time zones. 1181.18Schristos Use mainstream English spelling, e.g. prefer 'Rome' to 'Roma', and 1191.18Schristos prefer 'Athens' to the Greek 'Αθήνα' or the Romanized 'Athína'. 1201.18Schristos The POSIX file name restrictions encourage this rule. 1211.18Schristos Use the most populous among locations in a zone, 1221.18Schristos e.g. prefer 'Shanghai' to 'Beijing'. Among locations with 1231.18Schristos similar populations, pick the best-known location, 1241.18Schristos e.g. prefer 'Rome' to 'Milan'. 1251.18Schristos Use the singular form, e.g. prefer 'Canary' to 'Canaries'. 1261.18Schristos Omit common suffixes like '_Islands' and '_City', unless that 1271.18Schristos would lead to ambiguity. E.g. prefer 'Cayman' to 1281.18Schristos 'Cayman_Islands' and 'Guatemala' to 'Guatemala_City', 1291.18Schristos but prefer 'Mexico_City' to 'Mexico' because the country 1301.18Schristos of Mexico has several time zones. 1311.18Schristos Use '_' to represent a space. 1321.18Schristos Omit '.' from abbreviations in names, e.g. prefer 'St_Helena' 1331.18Schristos to 'St._Helena'. 1341.18Schristos Do not change established names if they only marginally 1351.18Schristos violate the above rules. For example, don't change 1361.18Schristos the existing name 'Rome' to 'Milan' merely because 1371.18Schristos Milan's population has grown to be somewhat greater 1381.18Schristos than Rome's. 1391.18Schristos If a name is changed, put its old spelling in the 'backward' file. 1401.18Schristos This means old spellings will continue to work. 1411.1Sjtc 1421.18SchristosThe file 'zone1970.tab' lists geographical locations used to name time 1431.18Schristoszone rules. It is intended to be an exhaustive list of names for 1441.18Schristosgeographic regions as described above; this is a subset of the names 1451.18Schristosin the data. Although a 'zone1970.tab' location's longitude 1461.18Schristoscorresponds to its LMT offset with one hour for every 15 degrees east 1471.18Schristoslongitude, this relationship is not exact. 1481.1Sjtc 1491.18SchristosOlder versions of this package used a different naming scheme, 1501.18Schristosand these older names are still supported. 1511.18SchristosSee the file 'backward' for most of these older names 1521.18Schristos(e.g., 'US/Eastern' instead of 'America/New_York'). 1531.18SchristosThe other old-fashioned names still supported are 1541.18Schristos'WET', 'CET', 'MET', and 'EET' (see the file 'europe'). 1551.1Sjtc 1561.18SchristosOlder versions of this package defined legacy names that are 1571.18Schristosincompatible with the first rule of location names, but which are 1581.18Schristosstill supported. These legacy names are mostly defined in the file 1591.18Schristos'etcetera'. Also, the file 'backward' defines the legacy names 1601.18Schristos'GMT0', 'GMT-0', 'GMT+0' and 'Canada/East-Saskatchewan', and the file 1611.18Schristos'northamerica' defines the legacy names 'EST5EDT', 'CST6CDT', 1621.18Schristos'MST7MDT', and 'PST8PDT'. 1631.14Schristos 1641.18SchristosExcluding 'backward' should not affect the other data. If 1651.18Schristos'backward' is excluded, excluding 'etcetera' should not affect the 1661.18Schristosremaining data. 1671.1Sjtc 1681.1Sjtc 1691.18Schristos----- Time zone abbreviations ----- 1701.1Sjtc 1711.18SchristosWhen this package is installed, it generates time zone abbreviations 1721.18Schristoslike 'EST' to be compatible with human tradition and POSIX. 1731.18SchristosHere are the general rules used for choosing time zone abbreviations, 1741.18Schristosin decreasing order of importance: 1751.1Sjtc 1761.19Schristos Use three or more characters that are ASCII alphanumerics or '+' or '-'. 1771.18Schristos Previous editions of this database also used characters like 1781.18Schristos ' ' and '?', but these characters have a special meaning to 1791.18Schristos the shell and cause commands like 1801.18Schristos set `date` 1811.18Schristos to have unexpected effects. 1821.18Schristos Previous editions of this rule required upper-case letters, 1831.18Schristos but the Congressman who introduced Chamorro Standard Time 1841.19Schristos preferred "ChST", so lower-case letters are now allowed. 1851.19Schristos Also, POSIX from 2001 on relaxed the rule to allow '-', '+', 1861.19Schristos and alphanumeric characters from the portable character set 1871.19Schristos in the current locale. In practice ASCII alphanumerics and 1881.19Schristos '+' and '-' are safe in all locales. 1891.1Sjtc 1901.19Schristos In other words, in the C locale the POSIX extended regular 1911.19Schristos expression [-+[:alnum:]]{3,} should match the abbreviation. 1921.19Schristos This guarantees that all abbreviations could have been 1931.19Schristos specified by a POSIX TZ string. 1941.1Sjtc 1951.18Schristos Use abbreviations that are in common use among English-speakers, 1961.18Schristos e.g. 'EST' for Eastern Standard Time in North America. 1971.18Schristos We assume that applications translate them to other languages 1981.18Schristos as part of the normal localization process; for example, 1991.18Schristos a French application might translate 'EST' to 'HNE'. 2001.1Sjtc 2011.18Schristos For zones whose times are taken from a city's longitude, use the 2021.18Schristos traditional xMT notation, e.g. 'PMT' for Paris Mean Time. 2031.18Schristos The only name like this in current use is 'GMT'. 2041.14Schristos 2051.18Schristos Use 'LMT' for local mean time of locations before the introduction 2061.18Schristos of standard time; see "Scope of the tz database". 2071.1Sjtc 2081.18Schristos If there is no common English abbreviation, use numeric offsets like 2091.18Schristos -05 and +0830 that are generated by zic's %z notation. 2101.2Sperry 2111.18Schristos [The remaining guidelines predate the introduction of %z. 2121.18Schristos They are problematic as they mean tz data entries invent 2131.18Schristos notation rather than record it. These guidelines are now 2141.18Schristos deprecated and the plan is to gradually move to %z for 2151.18Schristos inhabited locations and to "-00" for uninhabited locations.] 2161.2Sperry 2171.18Schristos If there is no common English abbreviation, abbreviate the English 2181.18Schristos translation of the usual phrase used by native speakers. 2191.18Schristos If this is not available or is a phrase mentioning the country 2201.18Schristos (e.g. "Cape Verde Time"), then: 2211.2Sperry 2221.18Schristos When a country is identified with a single or principal zone, 2231.18Schristos append 'T' to the country's ISO code, e.g. 'CVT' for 2241.18Schristos Cape Verde Time. For summer time append 'ST'; 2251.18Schristos for double summer time append 'DST'; etc. 2261.18Schristos Otherwise, take the first three letters of an English place 2271.18Schristos name identifying each zone and append 'T', 'ST', etc. 2281.18Schristos as before; e.g. 'VLAST' for VLAdivostok Summer Time. 2291.1Sjtc 2301.18Schristos Use UT (with time zone abbreviation 'zzz') for locations while 2311.18Schristos uninhabited. The 'zzz' mnemonic is that these locations are, 2321.18Schristos in some sense, asleep. 2331.2Sperry 2341.18SchristosApplication writers should note that these abbreviations are ambiguous 2351.18Schristosin practice: e.g. 'CST' has a different meaning in China than 2361.18Schristosit does in the United States. In new applications, it's often better 2371.18Schristosto use numeric UT offsets like '-0600' instead of time zone 2381.18Schristosabbreviations like 'CST'; this avoids the ambiguity. 2391.10Schristos 2401.14Schristos 2411.14Schristos----- Accuracy of the tz database ----- 2421.14Schristos 2431.14SchristosThe tz database is not authoritative, and it surely has errors. 2441.16SchristosCorrections are welcome and encouraged; see the file CONTRIBUTING. 2451.16SchristosUsers requiring authoritative data should consult national standards 2461.16Schristosbodies and the references cited in the database's comments. 2471.10Schristos 2481.14SchristosErrors in the tz database arise from many sources: 2491.14Schristos 2501.14Schristos * The tz database predicts future time stamps, and current predictions 2511.14Schristos will be incorrect after future governments change the rules. 2521.14Schristos For example, if today someone schedules a meeting for 13:00 next 2531.14Schristos October 1, Casablanca time, and tomorrow Morocco changes its 2541.14Schristos daylight saving rules, software can mess up after the rule change 2551.14Schristos if it blithely relies on conversions made before the change. 2561.14Schristos 2571.16Schristos * The pre-1970 entries in this database cover only a tiny sliver of how 2581.14Schristos clocks actually behaved; the vast majority of the necessary 2591.14Schristos information was lost or never recorded. Thousands more zones would 2601.14Schristos be needed if the tz database's scope were extended to cover even 2611.14Schristos just the known or guessed history of standard time; for example, 2621.14Schristos the current single entry for France would need to split into dozens 2631.19Schristos of entries, perhaps hundreds. And in most of the world even this 2641.19Schristos approach would be misleading due to widespread disagreement or 2651.19Schristos indifference about what times should be observed. In her 2015 book 2661.19Schristos "The Global Transformation of Time, 1870-1950", Vanessa Ogle writes 2671.19Schristos "Outside of Europe and North America there was no system of time 2681.19Schristos zones at all, often not even a stable landscape of mean times, 2691.19Schristos prior to the middle decades of the twentieth century". See: 2701.19Schristos Timothy Shenk, Booked: A Global History of Time. Dissent 2015-12-17 2711.19Schristos https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanessa-ogle 2721.14Schristos 2731.16Schristos * Most of the pre-1970 data entries come from unreliable sources, often 2741.14Schristos astrology books that lack citations and whose compilers evidently 2751.14Schristos invented entries when the true facts were unknown, without 2761.14Schristos reporting which entries were known and which were invented. 2771.14Schristos These books often contradict each other or give implausible entries, 2781.16Schristos and on the rare occasions when they are checked they are 2791.14Schristos typically found to be incorrect. 2801.14Schristos 2811.14Schristos * For the UK the tz database relies on years of first-class work done by 2821.14Schristos Joseph Myers and others; see <http://www.polyomino.org.uk/british-time/>. 2831.14Schristos Other countries are not done nearly as well. 2841.14Schristos 2851.14Schristos * Sometimes, different people in the same city would maintain clocks 2861.14Schristos that differed significantly. Railway time was used by railroad 2871.14Schristos companies (which did not always agree with each other), 2881.14Schristos church-clock time was used for birth certificates, etc. 2891.14Schristos Often this was merely common practice, but sometimes it was set by law. 2901.14Schristos For example, from 1891 to 1911 the UT offset in France was legally 2911.14Schristos 0:09:21 outside train stations and 0:04:21 inside. 2921.14Schristos 2931.14Schristos * Although a named location in the tz database stands for the 2941.14Schristos containing region, its pre-1970 data entries are often accurate for 2951.14Schristos only a small subset of that region. For example, Europe/London 2961.14Schristos stands for the United Kingdom, but its pre-1847 times are valid 2971.14Schristos only for locations that have London's exact meridian, and its 1847 2981.14Schristos transition to GMT is known to be valid only for the L&NW and the 2991.14Schristos Caledonian railways. 3001.14Schristos 3011.16Schristos * The tz database does not record the earliest time for which a zone's 3021.16Schristos data entries are thereafter valid for every location in the region. 3031.14Schristos For example, Europe/London is valid for all locations in its 3041.14Schristos region after GMT was made the standard time, but the date of 3051.14Schristos standardization (1880-08-02) is not in the tz database, other than 3061.14Schristos in commentary. For many zones the earliest time of validity is 3071.14Schristos unknown. 3081.14Schristos 3091.14Schristos * The tz database does not record a region's boundaries, and in many 3101.14Schristos cases the boundaries are not known. For example, the zone 3111.14Schristos America/Kentucky/Louisville represents a region around the city of 3121.14Schristos Louisville, the boundaries of which are unclear. 3131.14Schristos 3141.14Schristos * Changes that are modeled as instantaneous transitions in the tz 3151.14Schristos database were often spread out over hours, days, or even decades. 3161.14Schristos 3171.14Schristos * Even if the time is specified by law, locations sometimes 3181.14Schristos deliberately flout the law. 3191.14Schristos 3201.14Schristos * Early timekeeping practices, even assuming perfect clocks, were 3211.14Schristos often not specified to the accuracy that the tz database requires. 3221.14Schristos 3231.14Schristos * Sometimes historical timekeeping was specified more precisely 3241.14Schristos than what the tz database can handle. For example, from 1909 to 3251.14Schristos 1937 Netherlands clocks were legally UT+00:19:32.13, but the tz 3261.14Schristos database cannot represent the fractional second. 3271.14Schristos 3281.14Schristos * Even when all the timestamp transitions recorded by the tz database 3291.14Schristos are correct, the tz rules that generate them may not faithfully 3301.14Schristos reflect the historical rules. For example, from 1922 until World 3311.14Schristos War II the UK moved clocks forward the day following the third 3321.14Schristos Saturday in April unless that was Easter, in which case it moved 3331.14Schristos clocks forward the previous Sunday. Because the tz database has no 3341.14Schristos way to specify Easter, these exceptional years are entered as 3351.14Schristos separate tz Rule lines, even though the legal rules did not change. 3361.14Schristos 3371.16Schristos * The tz database models pre-standard time using the proleptic Gregorian 3381.14Schristos calendar and local mean time (LMT), but many people used other 3391.14Schristos calendars and other timescales. For example, the Roman Empire used 3401.14Schristos the Julian calendar, and had 12 varying-length daytime hours with a 3411.14Schristos non-hour-based system at night. 3421.14Schristos 3431.16Schristos * Early clocks were less reliable, and data entries do not represent 3441.16Schristos this unreliability. 3451.14Schristos 3461.14Schristos * As for leap seconds, civil time was not based on atomic time before 3471.14Schristos 1972, and we don't know the history of earth's rotation accurately 3481.14Schristos enough to map SI seconds to historical solar time to more than 3491.14Schristos about one-hour accuracy. See: Morrison LV, Stephenson FR. 3501.14Schristos Historical values of the Earth's clock error Delta T and the 3511.14Schristos calculation of eclipses. J Hist Astron. 2004;35:327-36 3521.14Schristos <http://adsabs.harvard.edu/full/2004JHA....35..327M>; 3531.14Schristos Historical values of the Earth's clock error. J Hist Astron. 2005;36:339 3541.14Schristos <http://adsabs.harvard.edu/full/2005JHA....36..339M>. 3551.14Schristos 3561.14Schristos * The relationship between POSIX time (that is, UTC but ignoring leap 3571.14Schristos seconds) and UTC is not agreed upon after 1972. Although the POSIX 3581.14Schristos clock officially stops during an inserted leap second, at least one 3591.14Schristos proposed standard has it jumping back a second instead; and in 3601.14Schristos practice POSIX clocks more typically either progress glacially during 3611.14Schristos a leap second, or are slightly slowed while near a leap second. 3621.14Schristos 3631.14Schristos * The tz database does not represent how uncertain its information is. 3641.16Schristos Ideally it would contain information about when data entries are 3651.14Schristos incomplete or dicey. Partial temporal knowledge is a field of 3661.14Schristos active research, though, and it's not clear how to apply it here. 3671.14Schristos 3681.14SchristosIn short, many, perhaps most, of the tz database's pre-1970 and future 3691.14Schristostime stamps are either wrong or misleading. Any attempt to pass the 3701.14Schristostz database off as the definition of time should be unacceptable to 3711.14Schristosanybody who cares about the facts. In particular, the tz database's 3721.14SchristosLMT offsets should not be considered meaningful, and should not prompt 3731.14Schristoscreation of zones merely because two locations differ in LMT or 3741.14Schristostransitioned to standard time at different dates. 3751.14Schristos 3761.10Schristos 3771.18Schristos----- Time and date functions ----- 3781.18Schristos 3791.18SchristosThe tz code contains time and date functions that are upwards 3801.18Schristoscompatible with those of POSIX. 3811.18Schristos 3821.18SchristosPOSIX has the following properties and limitations. 3831.18Schristos 3841.18Schristos* In POSIX, time display in a process is controlled by the 3851.18Schristos environment variable TZ. Unfortunately, the POSIX TZ string takes 3861.18Schristos a form that is hard to describe and is error-prone in practice. 3871.18Schristos Also, POSIX TZ strings can't deal with other (for example, Israeli) 3881.18Schristos daylight saving time rules, or situations where more than two 3891.18Schristos time zone abbreviations are used in an area. 3901.18Schristos 3911.18Schristos The POSIX TZ string takes the following form: 3921.18Schristos 3931.18Schristos stdoffset[dst[offset][,date[/time],date[/time]]] 3941.18Schristos 3951.18Schristos where: 3961.18Schristos 3971.18Schristos std and dst 3981.18Schristos are 3 or more characters specifying the standard 3991.18Schristos and daylight saving time (DST) zone names. 4001.18Schristos Starting with POSIX.1-2001, std and dst may also be 4011.18Schristos in a quoted form like "<UTC+10>"; this allows 4021.18Schristos "+" and "-" in the names. 4031.18Schristos offset 4041.18Schristos is of the form '[+-]hh:[mm[:ss]]' and specifies the 4051.18Schristos offset west of UT. 'hh' may be a single digit; 0<=hh<=24. 4061.18Schristos The default DST offset is one hour ahead of standard time. 4071.18Schristos date[/time],date[/time] 4081.18Schristos specifies the beginning and end of DST. If this is absent, 4091.18Schristos the system supplies its own rules for DST, and these can 4101.18Schristos differ from year to year; typically US DST rules are used. 4111.18Schristos time 4121.18Schristos takes the form 'hh:[mm[:ss]]' and defaults to 02:00. 4131.18Schristos This is the same format as the offset, except that a 4141.18Schristos leading '+' or '-' is not allowed. 4151.18Schristos date 4161.18Schristos takes one of the following forms: 4171.18Schristos Jn (1<=n<=365) 4181.18Schristos origin-1 day number not counting February 29 4191.18Schristos n (0<=n<=365) 4201.18Schristos origin-0 day number counting February 29 if present 4211.18Schristos Mm.n.d (0[Sunday]<=d<=6[Saturday], 1<=n<=5, 1<=m<=12) 4221.18Schristos for the dth day of week n of month m of the year, 4231.18Schristos where week 1 is the first week in which day d appears, 4241.18Schristos and '5' stands for the last week in which day d appears 4251.18Schristos (which may be either the 4th or 5th week). 4261.18Schristos Typically, this is the only useful form; 4271.18Schristos the n and Jn forms are rarely used. 4281.18Schristos 4291.18Schristos Here is an example POSIX TZ string, for US Pacific time using rules 4301.18Schristos appropriate from 1987 through 2006: 4311.2Sperry 4321.18Schristos TZ='PST8PDT,M4.1.0/02:00,M10.5.0/02:00' 4331.6Skleink 4341.18Schristos This POSIX TZ string is hard to remember, and mishandles time stamps 4351.18Schristos before 1987 and after 2006. With this package you can use this 4361.18Schristos instead: 4371.6Skleink 4381.18Schristos TZ='America/Los_Angeles' 4391.6Skleink 4401.18Schristos* POSIX does not define the exact meaning of TZ values like "EST5EDT". 4411.18Schristos Typically the current US DST rules are used to interpret such values, 4421.18Schristos but this means that the US DST rules are compiled into each program 4431.18Schristos that does time conversion. This means that when US time conversion 4441.18Schristos rules change (as in the United States in 1987), all programs that 4451.18Schristos do time conversion must be recompiled to ensure proper results. 4461.6Skleink 4471.18Schristos* In POSIX, there's no tamper-proof way for a process to learn the 4481.18Schristos system's best idea of local wall clock. (This is important for 4491.18Schristos applications that an administrator wants used only at certain times - 4501.18Schristos without regard to whether the user has fiddled the "TZ" environment 4511.18Schristos variable. While an administrator can "do everything in UTC" to get 4521.18Schristos around the problem, doing so is inconvenient and precludes handling 4531.18Schristos daylight saving time shifts - as might be required to limit phone 4541.18Schristos calls to off-peak hours.) 4551.2Sperry 4561.18Schristos* POSIX requires that systems ignore leap seconds. 4571.2Sperry 4581.18Schristos* The tz code attempts to support all the time_t implementations 4591.18Schristos allowed by POSIX. The time_t type represents a nonnegative count of 4601.18Schristos seconds since 1970-01-01 00:00:00 UTC, ignoring leap seconds. 4611.18Schristos In practice, time_t is usually a signed 64- or 32-bit integer; 32-bit 4621.18Schristos signed time_t values stop working after 2038-01-19 03:14:07 UTC, so 4631.18Schristos new implementations these days typically use a signed 64-bit integer. 4641.18Schristos Unsigned 32-bit integers are used on one or two platforms, 4651.18Schristos and 36-bit and 40-bit integers are also used occasionally. 4661.18Schristos Although earlier POSIX versions allowed time_t to be a 4671.18Schristos floating-point type, this was not supported by any practical 4681.18Schristos systems, and POSIX.1-2013 and the tz code both require time_t 4691.18Schristos to be an integer type. 4701.2Sperry 4711.18SchristosThese are the extensions that have been made to the POSIX functions: 4721.2Sperry 4731.18Schristos* The "TZ" environment variable is used in generating the name of a file 4741.18Schristos from which time zone information is read (or is interpreted a la 4751.18Schristos POSIX); "TZ" is no longer constrained to be a three-letter time zone 4761.18Schristos name followed by a number of hours and an optional three-letter 4771.18Schristos daylight time zone name. The daylight saving time rules to be used 4781.18Schristos for a particular time zone are encoded in the time zone file; 4791.18Schristos the format of the file allows U.S., Australian, and other rules to be 4801.18Schristos encoded, and allows for situations where more than two time zone 4811.18Schristos abbreviations are used. 4821.2Sperry 4831.18Schristos It was recognized that allowing the "TZ" environment variable to 4841.18Schristos take on values such as "America/New_York" might cause "old" programs 4851.18Schristos (that expect "TZ" to have a certain form) to operate incorrectly; 4861.18Schristos consideration was given to using some other environment variable 4871.18Schristos (for example, "TIMEZONE") to hold the string used to generate the 4881.18Schristos time zone information file name. In the end, however, it was decided 4891.18Schristos to continue using "TZ": it is widely used for time zone purposes; 4901.18Schristos separately maintaining both "TZ" and "TIMEZONE" seemed a nuisance; 4911.18Schristos and systems where "new" forms of "TZ" might cause problems can simply 4921.18Schristos use TZ values such as "EST5EDT" which can be used both by 4931.18Schristos "new" programs (a la POSIX) and "old" programs (as zone names and 4941.18Schristos offsets). 4951.2Sperry 4961.18Schristos* To handle places where more than two time zone abbreviations are used, 4971.18Schristos the functions "localtime" and "gmtime" set tzname[tmp->tm_isdst] 4981.18Schristos (where "tmp" is the value the function returns) to the time zone 4991.18Schristos abbreviation to be used. This differs from POSIX, where the elements 5001.18Schristos of tzname are only changed as a result of calls to tzset. 5011.15Schristos 5021.18Schristos* Since the "TZ" environment variable can now be used to control time 5031.18Schristos conversion, the "daylight" and "timezone" variables are no longer 5041.18Schristos needed. (These variables are defined and set by "tzset"; however, their 5051.18Schristos values will not be used by "localtime.") 5061.15Schristos 5071.18Schristos* The "localtime" function has been set up to deliver correct results 5081.18Schristos for near-minimum or near-maximum time_t values. (A comment in the 5091.18Schristos source code tells how to get compatibly wrong results). 5101.2Sperry 5111.18Schristos* A function "tzsetwall" has been added to arrange for the system's 5121.18Schristos best approximation to local wall clock time to be delivered by 5131.18Schristos subsequent calls to "localtime." Source code for portable 5141.18Schristos applications that "must" run on local wall clock time should call 5151.18Schristos "tzsetwall();" if such code is moved to "old" systems that don't 5161.18Schristos provide tzsetwall, you won't be able to generate an executable program. 5171.18Schristos (These time zone functions also arrange for local wall clock time to be 5181.18Schristos used if tzset is called - directly or indirectly - and there's no "TZ" 5191.18Schristos environment variable; portable applications should not, however, rely 5201.18Schristos on this behavior since it's not the way SVR2 systems behave.) 5211.2Sperry 5221.18Schristos* Negative time_t values are supported, on systems where time_t is signed. 5231.2Sperry 5241.18Schristos* These functions can account for leap seconds, thanks to Bradley White. 5251.6Skleink 5261.18SchristosPoints of interest to folks with other systems: 5271.6Skleink 5281.18Schristos* This package is already part of many POSIX-compliant hosts, 5291.18Schristos including BSD, HP, Linux, Network Appliance, SCO, SGI, and Sun. 5301.18Schristos On such hosts, the primary use of this package 5311.18Schristos is to update obsolete time zone rule tables. 5321.18Schristos To do this, you may need to compile the time zone compiler 5331.18Schristos 'zic' supplied with this package instead of using the system 'zic', 5341.18Schristos since the format of zic's input changed slightly in late 1994, 5351.18Schristos and many vendors still do not support the new input format. 5361.6Skleink 5371.18Schristos* The UNIX Version 7 "timezone" function is not present in this package; 5381.18Schristos it's impossible to reliably map timezone's arguments (a "minutes west 5391.18Schristos of GMT" value and a "daylight saving time in effect" flag) to a 5401.18Schristos time zone abbreviation, and we refuse to guess. 5411.18Schristos Programs that in the past used the timezone function may now examine 5421.18Schristos tzname[localtime(&clock)->tm_isdst] to learn the correct time 5431.18Schristos zone abbreviation to use. Alternatively, use 5441.18Schristos localtime(&clock)->tm_zone if this has been enabled. 5451.6Skleink 5461.18Schristos* The 4.2BSD gettimeofday function is not used in this package. 5471.18Schristos This formerly let users obtain the current UTC offset and DST flag, 5481.18Schristos but this functionality was removed in later versions of BSD. 5491.2Sperry 5501.18Schristos* In SVR2, time conversion fails for near-minimum or near-maximum 5511.18Schristos time_t values when doing conversions for places that don't use UT. 5521.18Schristos This package takes care to do these conversions correctly. 5531.2Sperry 5541.18SchristosThe functions that are conditionally compiled if STD_INSPIRED is defined 5551.18Schristosshould, at this point, be looked on primarily as food for thought. They are 5561.18Schristosnot in any sense "standard compatible" - some are not, in fact, specified in 5571.18Schristos*any* standard. They do, however, represent responses of various authors to 5581.18Schristosstandardization proposals. 5591.14Schristos 5601.18SchristosOther time conversion proposals, in particular the one developed by folks at 5611.18SchristosHewlett Packard, offer a wider selection of functions that provide capabilities 5621.18Schristosbeyond those provided here. The absence of such functions from this package 5631.18Schristosis not meant to discourage the development, standardization, or use of such 5641.18Schristosfunctions. Rather, their absence reflects the decision to make this package 5651.18Schristoscontain valid extensions to POSIX, to ensure its broad acceptability. If 5661.18Schristosmore powerful time conversion functions can be standardized, so much the 5671.18Schristosbetter. 5681.4Skleink 5691.4Skleink 5701.4Skleink----- Calendrical issues ----- 5711.4Skleink 5721.4SkleinkCalendrical issues are a bit out of scope for a time zone database, 5731.4Skleinkbut they indicate the sort of problems that we would run into if we 5741.4Skleinkextended the time zone database further into the past. An excellent 5751.10Schristosresource in this area is Nachum Dershowitz and Edward M. Reingold, 5761.15SchristosCalendrical Calculations: Third Edition, Cambridge University Press (2008) 5771.15Schristos<http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/>. 5781.15SchristosOther information and sources are given below. They sometimes disagree. 5791.4Skleink 5801.4Skleink 5811.4SkleinkFrance 5821.4Skleink 5831.4SkleinkGregorian calendar adopted 1582-12-20. 5841.4SkleinkFrench Revolutionary calendar used 1793-11-24 through 1805-12-31, 5851.4Skleinkand (in Paris only) 1871-05-06 through 1871-05-23. 5861.4Skleink 5871.4Skleink 5881.4SkleinkRussia 5891.4Skleink 5901.9SmlelstvFrom Chris Carrier (1996-12-02): 5911.14SchristosOn 1929-10-01 the Soviet Union instituted an "Eternal Calendar" 5921.4Skleinkwith 30-day months plus 5 holidays, with a 5-day week. 5931.4SkleinkOn 1931-12-01 it changed to a 6-day week; in 1934 it reverted to the 5941.4SkleinkGregorian calendar while retaining the 6-day week; on 1940-06-27 it 5951.4Skleinkreverted to the 7-day week. With the 6-day week the usual days 5961.4Skleinkoff were the 6th, 12th, 18th, 24th and 30th of the month. 5971.4Skleink(Source: Evitiar Zerubavel, _The Seven Day Circle_) 5981.4Skleink 5991.4Skleink 6001.4SkleinkMark Brader reported a similar story in "The Book of Calendars", edited 6011.4Skleinkby Frank Parise (1982, Facts on File, ISBN 0-8719-6467-8), page 377. But: 6021.4Skleink 6031.4SkleinkFrom: Petteri Sulonen (via Usenet) 6041.4SkleinkDate: 14 Jan 1999 00:00:00 GMT 6051.9Smlelstv... 6061.4Skleink 6071.15SchristosIf your source is correct, how come documents between 1929 and 1940 were 6081.4Skleinkstill dated using the conventional, Gregorian calendar? 6091.4Skleink 6101.4SkleinkI can post a scan of a document dated December 1, 1934, signed by 6111.4SkleinkYenukidze, the secretary, on behalf of Kalinin, the President of the 6121.4SkleinkExecutive Committee of the Supreme Soviet, if you like. 6131.4Skleink 6141.4Skleink 6151.4Skleink 6161.4SkleinkSweden (and Finland) 6171.4Skleink 6181.9SmlelstvFrom: Mark Brader 6191.15SchristosSubject: Re: Gregorian reform - a part of locale? 6201.15Schristos<news:1996Jul6.012937.29190@sq.com> 6211.4SkleinkDate: 1996-07-06 6221.4Skleink 6231.4SkleinkIn 1700, Denmark made the transition from Julian to Gregorian. Sweden 6241.4Skleinkdecided to *start* a transition in 1700 as well, but rather than have one of 6251.4Skleinkthose unsightly calendar gaps :-), they simply decreed that the next leap 6261.15Schristosyear after 1696 would be in 1744 - putting the whole country on a calendar 6271.4Skleinkdifferent from both Julian and Gregorian for a period of 40 years. 6281.4Skleink 6291.4SkleinkHowever, in 1704 something went wrong and the plan was not carried through; 6301.4Skleinkthey did, after all, have a leap year that year. And one in 1708. In 1712 6311.4Skleinkthey gave it up and went back to Julian, putting 30 days in February that 6321.4Skleinkyear!... 6331.4Skleink 6341.4SkleinkThen in 1753, Sweden made the transition to Gregorian in the usual manner, 6351.4Skleinkgetting there only 13 years behind the original schedule. 6361.4Skleink 6371.4Skleink(A previous posting of this story was challenged, and Swedish readers 6381.15Schristosproduced the following references to support it: "Tideräkning och historia" 6391.15Schristosby Natanael Beckman (1924) and "Tid, en bok om tideräkning och 6401.15Schristoskalenderväsen" by Lars-Olof Lodén (1968). 6411.4Skleink 6421.4Skleink 6431.4SkleinkGrotefend's data 6441.4Skleink 6451.9SmlelstvFrom: "Michael Palmer" [with one obvious typo fixed] 6461.4SkleinkSubject: Re: Gregorian Calendar (was Re: Another FHC related question 6471.4SkleinkNewsgroups: soc.genealogy.german 6481.4SkleinkDate: Tue, 9 Feb 1999 02:32:48 -800 6491.9Smlelstv... 6501.4Skleink 6511.6SkleinkThe following is a(n incomplete) listing, arranged chronologically, of 6521.6SkleinkEuropean states, with the date they converted from the Julian to the 6531.4SkleinkGregorian calendar: 6541.4Skleink 6551.4Skleink04/15 Oct 1582 - Italy (with exceptions), Spain, Portugal, Poland (Roman 6561.4Skleink Catholics and Danzig only) 6571.4Skleink09/20 Dec 1582 - France, Lorraine 6581.4Skleink 6591.4Skleink21 Dec 1582/ 6601.4Skleink 01 Jan 1583 - Holland, Brabant, Flanders, Hennegau 6611.15Schristos10/21 Feb 1583 - bishopric of Liege (Lüttich) 6621.4Skleink13/24 Feb 1583 - bishopric of Augsburg 6631.4Skleink04/15 Oct 1583 - electorate of Trier 6641.4Skleink05/16 Oct 1583 - Bavaria, bishoprics of Freising, Eichstedt, Regensburg, 6651.4Skleink Salzburg, Brixen 6661.15Schristos13/24 Oct 1583 - Austrian Oberelsaß and Breisgau 6671.4Skleink20/31 Oct 1583 - bishopric of Basel 6681.15Schristos02/13 Nov 1583 - duchy of Jülich-Berg 6691.15Schristos02/13 Nov 1583 - electorate and city of Köln 6701.15Schristos04/15 Nov 1583 - bishopric of Würzburg 6711.4Skleink11/22 Nov 1583 - electorate of Mainz 6721.4Skleink16/27 Nov 1583 - bishopric of Strassburg and the margraviate of Baden 6731.15Schristos17/28 Nov 1583 - bishopric of Münster and duchy of Cleve 6741.4Skleink14/25 Dec 1583 - Steiermark 6751.4Skleink 6761.4Skleink06/17 Jan 1584 - Austria and Bohemia 6771.15Schristos11/22 Jan 1584 - Lucerne, Uri, Schwyz, Zug, Freiburg, Solothurn 6781.4Skleink12/23 Jan 1584 - Silesia and the Lausitz 6791.4Skleink22 Jan/ 6801.4Skleink 02 Feb 1584 - Hungary (legally on 21 Oct 1587) 6811.4Skleink Jun 1584 - Unterwalden 6821.4Skleink01/12 Jul 1584 - duchy of Westfalen 6831.4Skleink 6841.4Skleink16/27 Jun 1585 - bishopric of Paderborn 6851.4Skleink 6861.4Skleink14/25 Dec 1590 - Transylvania 6871.4Skleink 6881.4Skleink22 Aug/ 6891.4Skleink 02 Sep 1612 - duchy of Prussia 6901.4Skleink 6911.4Skleink13/24 Dec 1614 - Pfalz-Neuburg 6921.4Skleink 6931.4Skleink 1617 - duchy of Kurland (reverted to the Julian calendar in 6941.4Skleink 1796) 6951.4Skleink 6961.15Schristos 1624 - bishopric of Osnabrück 6971.4Skleink 6981.4Skleink 1630 - bishopric of Minden 6991.4Skleink 7001.4Skleink15/26 Mar 1631 - bishopric of Hildesheim 7011.4Skleink 7021.4Skleink 1655 - Kanton Wallis 7031.4Skleink 7041.4Skleink05/16 Feb 1682 - city of Strassburg 7051.4Skleink 7061.4Skleink18 Feb/ 7071.4Skleink 01 Mar 1700 - Protestant Germany (including Swedish possessions in 7081.4Skleink Germany), Denmark, Norway 7091.4Skleink30 Jun/ 7101.4Skleink 12 Jul 1700 - Gelderland, Zutphen 7111.4Skleink10 Nov/ 7121.4Skleink 12 Dec 1700 - Utrecht, Overijssel 7131.4Skleink 7141.4Skleink31 Dec 1700/ 7151.15Schristos 12 Jan 1701 - Friesland, Groningen, Zürich, Bern, Basel, Geneva, 7161.4Skleink Turgau, and Schaffhausen 7171.4Skleink 7181.4Skleink 1724 - Glarus, Appenzell, and the city of St. Gallen 7191.4Skleink 7201.4Skleink01 Jan 1750 - Pisa and Florence 7211.4Skleink 7221.4Skleink02/14 Sep 1752 - Great Britain 7231.4Skleink 7241.4Skleink17 Feb/ 7251.4Skleink 01 Mar 1753 - Sweden 7261.4Skleink 7271.15Schristos1760-1812 - Graubünden 7281.4Skleink 7291.6SkleinkThe Russian empire (including Finland and the Baltic states) did not 7301.4Skleinkconvert to the Gregorian calendar until the Soviet revolution of 1917. 7311.4Skleink 7321.16SchristosSource: H. Grotefend, _Taschenbuch der Zeitrechnung des deutschen 7331.6SkleinkMittelalters und der Neuzeit_, herausgegeben von Dr. O. Grotefend 7341.16Schristos(Hannover: Hahnsche Buchhandlung, 1941), pp. 26-28. 7351.8Skleink 7361.8Skleink 7371.8Skleink----- Time and time zones on Mars ----- 7381.8Skleink 7391.17SchristosSome people's work schedules use Mars time. Jet Propulsion Laboratory 7401.17Schristos(JPL) coordinators have kept Mars time on and off at least since 1997 7411.17Schristosfor the Mars Pathfinder mission. Some of their family members have 7421.17Schristosalso adapted to Mars time. Dozens of special Mars watches were built 7431.17Schristosfor JPL workers who kept Mars time during the Mars Exploration 7441.8SkleinkRovers mission (2004). These timepieces look like normal Seikos and 7451.8SkleinkCitizens but use Mars seconds rather than terrestrial seconds. 7461.8Skleink 7471.8SkleinkA Mars solar day is called a "sol" and has a mean period equal to 7481.8Skleinkabout 24 hours 39 minutes 35.244 seconds in terrestrial time. It is 7491.8Skleinkdivided into a conventional 24-hour clock, so each Mars second equals 7501.8Skleinkabout 1.02749125 terrestrial seconds. 7511.8Skleink 7521.8SkleinkThe prime meridian of Mars goes through the center of the crater 7531.8SkleinkAiry-0, named in honor of the British astronomer who built the 7541.8SkleinkGreenwich telescope that defines Earth's prime meridian. Mean solar 7551.8Skleinktime on the Mars prime meridian is called Mars Coordinated Time (MTC). 7561.8Skleink 7571.8SkleinkEach landed mission on Mars has adopted a different reference for 7581.8Skleinksolar time keeping, so there is no real standard for Mars time zones. 7591.8SkleinkFor example, the Mars Exploration Rover project (2004) defined two 7601.8Skleinktime zones "Local Solar Time A" and "Local Solar Time B" for its two 7611.8Skleinkmissions, each zone designed so that its time equals local true solar 7621.8Skleinktime at approximately the middle of the nominal mission. Such a "time 7631.8Skleinkzone" is not particularly suited for any application other than the 7641.8Skleinkmission itself. 7651.8Skleink 7661.8SkleinkMany calendars have been proposed for Mars, but none have achieved 7671.8Skleinkwide acceptance. Astronomers often use Mars Sol Date (MSD) which is a 7681.8Skleinksequential count of Mars solar days elapsed since about 1873-12-29 7691.8Skleink12:00 GMT. 7701.8Skleink 7711.8SkleinkThe tz database does not currently support Mars time, but it is 7721.8Skleinkdocumented here in the hopes that support will be added eventually. 7731.8Skleink 7741.8SkleinkSources: 7751.8Skleink 7761.8SkleinkMichael Allison and Robert Schmunk, 7771.8Skleink"Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock" 7781.13Schristos<http://www.giss.nasa.gov/tools/mars24/help/notes.html> (2012-08-08). 7791.8Skleink 7801.8SkleinkJia-Rui Chong, "Workdays Fit for a Martian", Los Angeles Times 7811.13Schristos<http://articles.latimes.com/2004/jan/14/science/sci-marstime14> 7821.8Skleink(2004-01-14), pp A1, A20-A21. 7831.15Schristos 7841.17SchristosTom Chmielewski, "Jet Lag Is Worse on Mars", The Atlantic (2015-02-26) 7851.17Schristos<http://www.theatlantic.com/technology/archive/2015/02/jet-lag-is-worse-on-mars/386033/> 7861.15Schristos 7871.15Schristos----- 7881.18Schristos 7891.18SchristosThis file is in the public domain, so clarified as of 2009-05-17 by 7901.18SchristosArthur David Olson. 7911.18Schristos 7921.18Schristos----- 7931.15SchristosLocal Variables: 7941.15Schristoscoding: utf-8 7951.15SchristosEnd: 796