diff options
author | Stuart Bishop <stuart@stuartbishop.net> | 2015-05-13 12:47:57 +0200 |
---|---|---|
committer | Stuart Bishop <stuart@stuartbishop.net> | 2015-05-13 12:47:57 +0200 |
commit | a86f9f4ad3db3220acf07dbbda328352c42c046b (patch) | |
tree | 8672d429136a03b4e55d082c181268a1a7e4a68a | |
parent | 0b9d95f6caec79698ace872366cf88c720912f66 (diff) | |
download | pytz-a86f9f4ad3db3220acf07dbbda328352c42c046b.tar.gz |
Import IANA 2015d
-rw-r--r-- | elsie.nci.nih.gov/src/Makefile | 23 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/NEWS | 74 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/africa | 67 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/antarctica | 51 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/backward | 1 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/backzone | 40 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/checktab.awk | 3 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/europe | 2 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/northamerica | 167 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/private.h | 12 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/southamerica | 156 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/tz-link.htm | 7 | ||||
-rw-r--r-- | elsie.nci.nih.gov/src/zic.c | 232 |
13 files changed, 511 insertions, 324 deletions
diff --git a/elsie.nci.nih.gov/src/Makefile b/elsie.nci.nih.gov/src/Makefile index fbb027a..b398727 100644 --- a/elsie.nci.nih.gov/src/Makefile +++ b/elsie.nci.nih.gov/src/Makefile @@ -5,7 +5,7 @@ PACKAGE= tzcode # Version numbers of the code and data distributions. -VERSION= 2015b +VERSION= 2015d # Email address for bug reports. BUGEMAIL= tz@iana.org @@ -120,6 +120,7 @@ LDLIBS= # -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h" # -DHAVE_STRFTIME_L=1 if <time.h> declares locale_t and strftime_l # This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise. +# -DHAVE_STRDUP=0 if your system lacks the strdup function # -DHAVE_SYMLINK=0 if your system lacks the symlink function # -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h" # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h" @@ -149,18 +150,18 @@ LDLIBS= # $(GCC_DEBUG_FLAGS) if you are using GCC and want lots of checking GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \ -Wall -Wextra \ - -Wbad-function-cast -Wcast-align -Wcast-qual \ + -Wbad-function-cast -Wcast-align -Wdate-time \ -Wdeclaration-after-statement \ + -Wdouble-promotion \ -Wformat=2 -Winit-self -Wjump-misses-init \ - -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \ - -Wnested-externs -Wno-address -Wno-cast-qual \ - -Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \ - -Wno-type-limits \ - -Wno-unused-parameter -Woverlength-strings -Wpointer-arith \ + -Wlogical-op -Wmissing-prototypes -Wnested-externs \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \ -Wsuggest-attribute=format -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=pure -Wtrampolines \ - -Wwrite-strings + -Wunused -Wwrite-strings \ + -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ + -Wno-type-limits -Wno-unused-parameter # # If you want to use System V compatibility code, add # -DUSG_COMPAT @@ -330,13 +331,13 @@ AR= ar # ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. RANLIB= : -TZCOBJS= zic.o scheck.o ialloc.o +TZCOBJS= zic.o TZDOBJS= zdump.o localtime.o asctime.o DATEOBJS= date.o localtime.o strftime.o asctime.o LIBSRCS= localtime.c asctime.c difftime.c LIBOBJS= localtime.o asctime.o difftime.o HEADERS= tzfile.h private.h -NONLIBSRCS= zic.c zdump.c scheck.c ialloc.c +NONLIBSRCS= zic.c zdump.c NEWUCBSRCS= date.c strftime.c SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ tzselect.ksh workman.sh @@ -654,9 +655,7 @@ zonenames: $(TDATA) asctime.o: private.h tzfile.h date.o: private.h difftime.o: private.h -ialloc.o: private.h localtime.o: private.h tzfile.h -scheck.o: private.h strftime.o: private.h tzfile.h zdump.o: version.h zic.o: private.h tzfile.h version.h diff --git a/elsie.nci.nih.gov/src/NEWS b/elsie.nci.nih.gov/src/NEWS index ce6ac40..c14df78 100644 --- a/elsie.nci.nih.gov/src/NEWS +++ b/elsie.nci.nih.gov/src/NEWS @@ -1,5 +1,79 @@ News for the tz database +Release 2015d - 2015-04-24 08:09:46 -0700 + + Changes affecting future time stamps + + Egypt will not observe DST in 2015 and will consider canceling it + permanently. For now, assume no DST indefinitely. + (Thanks to Ahmed Nazmy and Tim Parenti.) + + Changes affecting past time stamps + + America/Whitehorse switched from UTC-9 to UTC-8 on 1967-05-28, not + 1966-07-01. Also, Yukon's time zone history is documented better. + (Thanks to Brian Inglis and Dennis Ferguson.) + + Change affecting past and future time zone abbreviations + + The abbreviations for Hawaii-Aleutian standard and daylight times + have been changed from HAST/HADT to HST/HDT, as per US Government + Printing Office style. This affects only America/Adak since 1983, + as America/Honolulu was already using the new style. + + Changes affecting code + + zic has some minor performance improvements. + + +Release 2015c - 2015-04-11 08:55:55 -0700 + + Changes affecting future time stamps + + Egypt's spring-forward transition is at 24:00 on April's last Thursday, + not 00:00 on April's last Friday. 2015's transition will therefore be on + Thursday, April 30 at 24:00, not Friday, April 24 at 00:00. Similar fixes + apply to 2026, 2037, 2043, etc. (Thanks to Steffen Thorsen.) + + Changes affecting past time stamps + + The following changes affect some pre-1991 Chile-related time stamps + in America/Santiago, Antarctica/Palmer, and Pacific/Easter. + + The 1910 transition was January 10, not January 1. + + The 1918 transition was September 10, not September 1. + + The UTC-4 time observed from 1932 to 1942 is now considered to be + standard time, not year-round DST. + + Santiago observed DST (UTC-3) from 1946-07-15 through 1946-08-31, + then reverted to standard time, then switched its time zone to + UTC-5 on 1947-04-01. + + Assume transitions before 1968 were at 00:00, since we have no data + saying otherwise. + + The spring 1988 transition was 1988-10-09, not 1988-10-02. + The fall 1990 transition was 1990-03-11, not 1990-03-18. + + Assume no UTC offset change for Pacific/Easter on 1890-01-01, + and omit all transitions on Pacific/Easter from 1942 through 1946 + since we have no data suggesting that they existed. + + One more zone has been turned into a link, as it differed + from an existing zone only for older time stamps. As usual, + this change affects UTC offsets in pre-1970 time stamps only. + The zone's old contents have been moved to the 'backzone' file. + The affected zone is America/Montreal. + + Changes affecting commentary + + Mention the TZUpdater tool. + + Mention "The Time Now". (Thanks to Brandon Ramsey.) + + Release 2015b - 2015-03-19 23:28:11 -0700 Changes affecting future time stamps diff --git a/elsie.nci.nih.gov/src/africa b/elsie.nci.nih.gov/src/africa index 1b9bf50..ea0171a 100644 --- a/elsie.nci.nih.gov/src/africa +++ b/elsie.nci.nih.gov/src/africa @@ -319,35 +319,29 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # above) says DST had no affect on electricity consumption. There is # no information about when DST will end this fall. See: # http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 + +# From Steffen Thorsen (2015-04-08): +# Egypt will start DST on midnight after Thursday, April 30, 2015. +# This is based on a law (no 35) from May 15, 2014 saying it starts the last +# Thursday of April.... Clocks will still be turned back for Ramadan, but +# dates not yet announced.... +# http://almogaz.com/news/weird-news/2015/04/05/1947105 ... +# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html + +# From Ahmed Nazmy (2015-04-20): +# Egypt's ministers cabinet just announced ... that it will cancel DST at +# least for 2015. # -# For now, guess that later spring and fall transitions will use -# 2010's rules, and guess that Egypt will switch to standard time at -# 24:00 the last Thursday before Ramadan, and back to DST at 00:00 the -# first Friday after Ramadan. To implement this, -# transition dates for 2015 through 2037 were determined by running -# the following program under GNU Emacs 24.3, with the results integrated -# by hand into the table below. Ramadan again intrudes on the guessed -# DST starting in 2038, but that's beyond our somewhat-arbitrary cutoff. -# (let ((islamic-year 1436)) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (friday 5)) -# (while (/= friday (mod a 7)) -# (setq a (1- a))) -# (while (/= friday (mod b 7)) -# (setq b (1+ b))) -# (setq a (1- a)) -# (setq b (1- b)) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t0\t-\n" -# "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Tim Parenti (2015-04-20): +# http://english.ahram.org.eg/WriterArticles/NewsContentP/1/128195/Egypt/No-daylight-saving-this-summer-Egypts-prime-minist.aspx +# "Egypt's cabinet agreed on Monday not to switch clocks for daylight saving +# time this summer, and carry out studies on the possibility of canceling the +# practice altogether in future years." +# +# From Paul Eggert (2015-04-20): +# For now, assume DST will be canceled. Any resumption would likely +# use different rules anyway. + Rule Egypt 2008 only - Aug lastThu 24:00 0 - Rule Egypt 2009 only - Aug 20 24:00 0 - Rule Egypt 2010 only - Aug 10 24:00 0 - @@ -356,22 +350,7 @@ Rule Egypt 2010 only - Sep lastThu 24:00 0 - Rule Egypt 2014 only - May 15 24:00 1:00 S Rule Egypt 2014 only - Jun 26 24:00 0 - Rule Egypt 2014 only - Jul 31 24:00 1:00 S -Rule Egypt 2014 max - Sep lastThu 24:00 0 - -Rule Egypt 2015 2019 - Apr lastFri 0:00s 1:00 S -Rule Egypt 2015 only - Jun 11 24:00 0 - -Rule Egypt 2015 only - Jul 23 24:00 1:00 S -Rule Egypt 2016 only - Jun 2 24:00 0 - -Rule Egypt 2016 only - Jul 7 24:00 1:00 S -Rule Egypt 2017 only - May 25 24:00 0 - -Rule Egypt 2017 only - Jun 29 24:00 1:00 S -Rule Egypt 2018 only - May 10 24:00 0 - -Rule Egypt 2018 only - Jun 14 24:00 1:00 S -Rule Egypt 2019 only - May 2 24:00 0 - -Rule Egypt 2019 only - Jun 6 24:00 1:00 S -Rule Egypt 2020 only - May 28 24:00 1:00 S -Rule Egypt 2021 only - May 13 24:00 1:00 S -Rule Egypt 2022 only - May 5 24:00 1:00 S -Rule Egypt 2023 max - Apr lastFri 0:00s 1:00 S +Rule Egypt 2014 only - Sep lastThu 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:09 - LMT 1900 Oct diff --git a/elsie.nci.nih.gov/src/antarctica b/elsie.nci.nih.gov/src/antarctica index ebae994..2af088f 100644 --- a/elsie.nci.nih.gov/src/antarctica +++ b/elsie.nci.nih.gov/src/antarctica @@ -15,41 +15,6 @@ # I made up all time zone abbreviations mentioned here; corrections welcome! # FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited. -# These rules are stolen from the 'southamerica' file. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule ArgAQ 1964 1966 - Mar 1 0:00 0 - -Rule ArgAQ 1964 1966 - Oct 15 0:00 1:00 S -Rule ArgAQ 1967 only - Apr 2 0:00 0 - -Rule ArgAQ 1967 1968 - Oct Sun>=1 0:00 1:00 S -Rule ArgAQ 1968 1969 - Apr Sun>=1 0:00 0 - -Rule ArgAQ 1974 only - Jan 23 0:00 1:00 S -Rule ArgAQ 1974 only - May 1 0:00 0 - -Rule ChileAQ 1972 1986 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1974 1987 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1987 only - Apr 12 3:00u 0 - -Rule ChileAQ 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule ChileAQ 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1990 only - Mar 18 3:00u 0 - -Rule ChileAQ 1990 only - Sep 16 4:00u 1:00 S -Rule ChileAQ 1991 1996 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1991 1997 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1997 only - Mar 30 3:00u 0 - -Rule ChileAQ 1998 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1998 only - Sep 27 4:00u 1:00 S -Rule ChileAQ 1999 only - Apr 4 3:00u 0 - -Rule ChileAQ 1999 2010 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 2000 2007 - Mar Sun>=9 3:00u 0 - -# N.B.: the end of March 29 in Chile is March 30 in Universal time, -# which is used below in specifying the transition. -Rule ChileAQ 2008 only - Mar 30 3:00u 0 - -Rule ChileAQ 2009 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 2010 only - Apr Sun>=1 3:00u 0 - -Rule ChileAQ 2011 only - May Sun>=2 3:00u 0 - -Rule ChileAQ 2011 only - Aug Sun>=16 4:00u 1:00 S -Rule ChileAQ 2012 2015 - Apr Sun>=23 3:00u 0 - -Rule ChileAQ 2012 2014 - Sep Sun>=2 4:00u 1:00 S - # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 # Carlini, Potter Cove, King George Island, -6414-0602320, since 1982-01 @@ -344,21 +309,7 @@ Zone Antarctica/Rothera 0 - zzz 1976 Dec 1 # USA - year-round bases # # Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) -# -# From Ethan Dicks (1996-10-06): -# It keeps the same time as Punta Arenas, Chile, because, just like us -# and the South Pole, that's the other end of their supply line.... -# I verified with someone who was there that since 1980, -# Palmer has followed Chile. Prior to that, before the Falklands War, -# Palmer used to be supplied from Argentina. -# -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Palmer 0 - zzz 1965 - -4:00 ArgAQ AR%sT 1969 Oct 5 - -3:00 ArgAQ AR%sT 1982 May - -4:00 ChileAQ CL%sT 2015 Apr 26 3:00u - -3:00 - CLT -# +# See 'southamerica' for Antarctica/Palmer, since it uses South American DST. # # McMurdo Station, Ross Island, since 1955-12 # Amundsen-Scott South Pole Station, continuously occupied since 1956-11-20 diff --git a/elsie.nci.nih.gov/src/backward b/elsie.nci.nih.gov/src/backward index 3ceda88..8b0fef5 100644 --- a/elsie.nci.nih.gov/src/backward +++ b/elsie.nci.nih.gov/src/backward @@ -20,6 +20,7 @@ Link America/Argentina/Jujuy America/Jujuy Link America/Indiana/Knox America/Knox_IN Link America/Kentucky/Louisville America/Louisville Link America/Argentina/Mendoza America/Mendoza +Link America/Toronto America/Montreal Link America/Rio_Branco America/Porto_Acre Link America/Argentina/Cordoba America/Rosario Link America/Denver America/Shiprock diff --git a/elsie.nci.nih.gov/src/backzone b/elsie.nci.nih.gov/src/backzone index 31a3f5a..6b392bd 100644 --- a/elsie.nci.nih.gov/src/backzone +++ b/elsie.nci.nih.gov/src/backzone @@ -311,6 +311,46 @@ Zone America/Grenada -4:07:00 - LMT 1911 Jul # St George's Zone America/Guadeloupe -4:06:08 - LMT 1911 Jun 8 # Pointe-à-Pitre -4:00 - AST +# Canada +# +# From Paul Eggert (2015-03-24): +# Since 1970 most of Quebec has been like Toronto; see +# America/Toronto. However, earlier versions of the tz database +# mistakenly relied on data from Shanks & Pottenger saying that Quebec +# differed from Ontario after 1970, and the following rules and zone +# were created for most of Quebec from the incorrect Shanks & +# Pottenger data. The post-1970 entries have been corrected, but the +# pre-1970 entries are unchecked and probably have errors. +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Mont 1917 only - Mar 25 2:00 1:00 D +Rule Mont 1917 only - Apr 24 0:00 0 S +Rule Mont 1919 only - Mar 31 2:30 1:00 D +Rule Mont 1919 only - Oct 25 2:30 0 S +Rule Mont 1920 only - May 2 2:30 1:00 D +Rule Mont 1920 1922 - Oct Sun>=1 2:30 0 S +Rule Mont 1921 only - May 1 2:00 1:00 D +Rule Mont 1922 only - Apr 30 2:00 1:00 D +Rule Mont 1924 only - May 17 2:00 1:00 D +Rule Mont 1924 1926 - Sep lastSun 2:30 0 S +Rule Mont 1925 1926 - May Sun>=1 2:00 1:00 D +Rule Mont 1927 1937 - Apr lastSat 24:00 1:00 D +Rule Mont 1927 1937 - Sep lastSat 24:00 0 S +Rule Mont 1938 1940 - Apr lastSun 0:00 1:00 D +Rule Mont 1938 1939 - Sep lastSun 0:00 0 S +Rule Mont 1946 1973 - Apr lastSun 2:00 1:00 D +Rule Mont 1945 1948 - Sep lastSun 2:00 0 S +Rule Mont 1949 1950 - Oct lastSun 2:00 0 S +Rule Mont 1951 1956 - Sep lastSun 2:00 0 S +Rule Mont 1957 1973 - Oct lastSun 2:00 0 S +Zone America/Montreal -4:54:16 - LMT 1884 + -5:00 Mont E%sT 1918 + -5:00 Canada E%sT 1919 + -5:00 Mont E%sT 1942 Feb 9 2:00s + -5:00 Canada E%sT 1946 + -5:00 Mont E%sT 1974 + -5:00 Canada E%sT + # Montserrat # From Paul Eggert (2006-03-22): # In 1995 volcanic eruptions forced evacuation of Plymouth, the capital. diff --git a/elsie.nci.nih.gov/src/checktab.awk b/elsie.nci.nih.gov/src/checktab.awk index cf2c726..de98299 100644 --- a/elsie.nci.nih.gov/src/checktab.awk +++ b/elsie.nci.nih.gov/src/checktab.awk @@ -9,9 +9,6 @@ BEGIN { if (!zone_table) zone_table = "zone1970.tab" if (!want_warnings) want_warnings = -1 - # A special (and we hope temporary) case. - tztab["America/Montreal"] = 1 - while (getline <iso_table) { iso_NR++ if ($0 ~ /^#/) continue diff --git a/elsie.nci.nih.gov/src/europe b/elsie.nci.nih.gov/src/europe index 4109723..c64c41b 100644 --- a/elsie.nci.nih.gov/src/europe +++ b/elsie.nci.nih.gov/src/europe @@ -76,7 +76,7 @@ # 1:00:14 SET Swedish (1879-1899)* # 2:00 EET EEST Eastern Europe # 3:00 FET Further-eastern Europe (2011-2014)* -# 3:00 MSK MSD MSM* Moscow +# 3:00 MSK MSD MSM* Minsk, Moscow # From Peter Ilieve (1994-12-04), # The original six [EU members]: Belgium, France, (West) Germany, Italy, diff --git a/elsie.nci.nih.gov/src/northamerica b/elsie.nci.nih.gov/src/northamerica index 77463da..c3af9eb 100644 --- a/elsie.nci.nih.gov/src/northamerica +++ b/elsie.nci.nih.gov/src/northamerica @@ -227,9 +227,14 @@ Zone PST8PDT -8:00 US P%sT # The law doesn't give abbreviations. # # From Paul Eggert (2000-01-08), following a heads-up from Rives McDow: -# Public law 106-564 (2000-12-23) introduced the abbreviation -# "Chamorro Standard Time" for time in Guam and the Northern Marianas. -# See the file "australasia". +# Public law 106-564 (2000-12-23) introduced ... "Chamorro Standard Time" +# for time in Guam and the Northern Marianas. See the file "australasia". +# +# From Paul Eggert (2015-04-17): +# HST and HDT are standardized abbreviations for Hawaii-Aleutian +# standard and daylight times. See section 9.47 (p 234) of the +# U.S. Government Printing Office Style Manual (2008) +# http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf # From Arthur David Olson, 2005-08-09 # The following was signed into law on 2005-08-08. @@ -536,7 +541,7 @@ Zone America/Adak 12:13:21 - LMT 1867 Oct 18 -11:00 - BST 1969 -11:00 US B%sT 1983 Oct 30 2:00 -10:00 US AH%sT 1983 Nov 30 - -10:00 US HA%sT + -10:00 US H%sT # The following switches don't quite make our 1970 cutoff. # # Shanks writes that part of southwest Alaska (e.g. Aniak) @@ -1331,14 +1336,9 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # Quebec -# From Paul Eggert (2013-08-30): -# Since 1970 most of Quebec has been like Toronto. -# However, because earlier versions of the tz database mistakenly relied on data -# from Shanks & Pottenger saying that Quebec differed from Ontario after 1970, -# a separate entry was created for most of Quebec. We're loath to lose -# its pre-1970 info, even though the tz database is normally limited to -# zones that differ after 1970, so keep this otherwise out-of-scope entry. - +# From Paul Eggert (2015-03-24): +# See America/Toronto for most of Quebec, including Montreal. +# # Matthews and Vincent (1998) also write that Quebec east of the -63 # meridian is supposed to observe AST, but residents as far east as # Natashquan use EST/EDT, and residents east of Natashquan use AST. @@ -1352,39 +1352,10 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # For lack of better info, guess this practice began around 1970, contra to # Shanks & Pottenger who have this region observing AST/ADT. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mont 1917 only - Mar 25 2:00 1:00 D -Rule Mont 1917 only - Apr 24 0:00 0 S -Rule Mont 1919 only - Mar 31 2:30 1:00 D -Rule Mont 1919 only - Oct 25 2:30 0 S -Rule Mont 1920 only - May 2 2:30 1:00 D -Rule Mont 1920 1922 - Oct Sun>=1 2:30 0 S -Rule Mont 1921 only - May 1 2:00 1:00 D -Rule Mont 1922 only - Apr 30 2:00 1:00 D -Rule Mont 1924 only - May 17 2:00 1:00 D -Rule Mont 1924 1926 - Sep lastSun 2:30 0 S -Rule Mont 1925 1926 - May Sun>=1 2:00 1:00 D -Rule Mont 1927 1937 - Apr lastSat 24:00 1:00 D -Rule Mont 1927 1937 - Sep lastSat 24:00 0 S -Rule Mont 1938 1940 - Apr lastSun 0:00 1:00 D -Rule Mont 1938 1939 - Sep lastSun 0:00 0 S -Rule Mont 1946 1973 - Apr lastSun 2:00 1:00 D -Rule Mont 1945 1948 - Sep lastSun 2:00 0 S -Rule Mont 1949 1950 - Oct lastSun 2:00 0 S -Rule Mont 1951 1956 - Sep lastSun 2:00 0 S -Rule Mont 1957 1973 - Oct lastSun 2:00 0 S - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Blanc-Sablon -3:48:28 - LMT 1884 -4:00 Canada A%sT 1970 -4:00 - AST -Zone America/Montreal -4:54:16 - LMT 1884 - -5:00 Mont E%sT 1918 - -5:00 Canada E%sT 1919 - -5:00 Mont E%sT 1942 Feb 9 2:00s - -5:00 Canada E%sT 1946 - -5:00 Mont E%sT 1974 - -5:00 Canada E%sT # Ontario @@ -1875,17 +1846,115 @@ Zone America/Creston -7:46:04 - LMT 1884 # Dawson switched to PST in 1973. Inuvik switched to MST in 1979. # Mathew Englander (1996-10-07) gives the following refs: # * 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68, -# c. 7 defines Yukon standard time as UTC-9. This is still valid; +# c. 7 defines Yukon standard time as UTC-9.... # see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1). +# [http://canlii.ca/t/7vhg] # * C.O. 1973/214 switched Yukon to PST on 1973-10-28 00:00. # * O.I.C. 1980/02 established DST. # * O.I.C. 1987/056 changed DST to Apr firstSun 2:00 to Oct lastSun 2:00. -# Shanks & Pottenger say Yukon's 1973-10-28 switch was at 2:00; go -# with Englander. -# From Chris Walton (2006-06-26): -# Here is a link to the old daylight saving portion of the interpretation -# act which was last updated in 1987: -# http://www.gov.yk.ca/legislation/regs/oic1987_056.pdf + +# From Brian Inglis (2015-04-14): +# +# I tried to trace the history of Yukon time and found the following +# regulations, giving the reference title and URL if found, regulation name, +# and relevant quote if available. Each regulation specifically revokes its +# predecessor. The final reference is to the current Interpretation Act +# authorizing and resulting from these regulatory changes. +# +# Only recent regulations were retrievable via Yukon government site search or +# index, and only some via Canadian legal sources. Other sources used include +# articles titled "Standard Time and Time Zones in Canada" from JRASC via ADS +# Abstracts, cited by ADO for 1932 ..., and updated versions from 1958 and +# 1970 quoted below; each article includes current extracts from provincial +# and territorial ST and DST regulations at the end, summaries and details of +# standard times and daylight saving time at many locations across Canada, +# with time zone maps, tables and calculations for Canadian Sunrise, Sunset, +# and LMST; they also cover many countries and global locations, with a chart +# and table showing current Universal Time offsets, and may be useful as +# another source of information for 1970 and earlier. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; JRASC, Vol. 26, +# pp.49-77; February 1932; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1932JRASC..26...49S from p.75: +# Yukon Interpretation Ordinance +# Yukon standard time is the local mean time at the one hundred and +# thirty-fifth meridian. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; Thomson, Malcolm M.; +# JRASC, Vol. 52, pp.193-223; October 1958; SAO/NASA Astrophysics Data System +# (ADS) http://adsabs.harvard.edu/abs/1958JRASC..52..193S from pp.220-1: +# Yukon Interpretation Ordinance, 1955, Chap. 16. +# +# (1) Subject to this section, standard time shall be reckoned as nine +# hours behind Greenwich Time and called Yukon Standard Time. +# +# (2) Notwithstanding subsection (1), the Commissioner may make regulations +# varying the manner of reckoning standard time. +# +# * Yukon Territory Commissioner's Order 1966-20 Interpretation Ordinance +# http://? - no online source found +# +# * Standard Time and Time Zones in Canada; Thomson, Malcolm M.; JRASC, +# Vol. 64, pp.129-162; June 1970; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1970JRASC..64..129T from p.156: Yukon +# Territory Commissioner's Order 1967-59 Interpretation Ordinance ... +# +# 1. Commissioner's Order 1966-20 dated at Whitehorse in the Yukon +# Territory on 27th January, 1966, is hereby revoked. +# +# 2. Yukon (East) Standard Time as defined by section 36 of the +# Interpretation Ordinance from and after mid-night on the 28th day of May, +# 1967 shall be reckoned in the same manner as Pacific Standard Time, that +# is to say, eight hours behind Greenwich Time in the area of the Yukon +# Territory lying east of the 138th degree longitude west. +# +# 3. In the remainder of the Territory, lying west of the 138th degree +# longitude west, Yukon (West) Standard Time shall be reckoned as nine +# hours behind Greenwich Time. +# +# * Yukon Standard Time defined as Pacific Standard Time, YCO 1973/214 +# http://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html +# C.O. 1973/214 INTERPRETATION ACT ... +# +# 1. Effective October 28, 1973 Commissioner's Order 1967/59 is hereby +# revoked. +# +# 2. Yukon Standard Time as defined by section 36 of the Interpretation +# Act from and after midnight on the twenty-eighth day of October, 1973 +# shall be reckoned in the same manner as Pacific Standard Time, that is +# to say eight hours behind Greenwich Time. +# +# * O.I.C. 1980/02 INTERPRETATION ACT +# http://? - no online source found +# +# * Yukon Daylight Saving Time, YOIC 1987/56 +# http://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html +# O.I.C. 1987/056 INTERPRETATION ACT ... +# +# In every year between +# (a) two o'clock in the morning in the first Sunday in April, and +# (b) two o'clock in the morning in the last Sunday in October, +# Standard Time shall be reckoned as seven hours behind Greenwich Time and +# called Yukon Daylight Saving Time. +# ... +# Dated ... 9th day of March, A.D., 1987. +# +# * Yukon Daylight Saving Time 2006, YOIC 2006/127 +# http://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html +# O.I.C. 2006/127 INTERPRETATION ACT ... +# +# 1. In Yukon each year the time for general purposes shall be 7 hours +# behind Greenwich mean time during the period commencing at two o'clock +# in the forenoon on the second Sunday of March and ending at two o'clock +# in the forenoon on the first Sunday of November and shall be called +# Yukon Daylight Saving Time. +# +# 2. Order-in-Council 1987/56 is revoked. +# +# 3. This order comes into force January 1, 2007. +# +# * Interpretation Act, RSY 2002, c 125 +# http://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html # From Rives McDow (1999-09-04): # Nunavut ... moved ... to incorporate the whole territory into one time zone. @@ -2111,7 +2180,7 @@ Zone America/Inuvik 0 - zzz 1953 # Inuvik founded -7:00 NT_YK M%sT 1980 -7:00 Canada M%sT Zone America/Whitehorse -9:00:12 - LMT 1900 Aug 20 - -9:00 NT_YK Y%sT 1966 Jul 1 2:00 + -9:00 NT_YK Y%sT 1967 May 28 0:00 -8:00 NT_YK P%sT 1980 -8:00 Canada P%sT Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 diff --git a/elsie.nci.nih.gov/src/private.h b/elsie.nci.nih.gov/src/private.h index de9c13e..61cf922 100644 --- a/elsie.nci.nih.gov/src/private.h +++ b/elsie.nci.nih.gov/src/private.h @@ -42,6 +42,10 @@ #define HAVE_SETTIMEOFDAY 3 #endif /* !defined HAVE_SETTIMEOFDAY */ +#ifndef HAVE_STRDUP +#define HAVE_STRDUP 1 +#endif + #ifndef HAVE_SYMLINK #define HAVE_SYMLINK 1 #endif /* !defined HAVE_SYMLINK */ @@ -449,14 +453,6 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_PURE; #endif /* -** Private function declarations. -*/ - -char * icatalloc(char * old, const char * new); -char * icpyalloc(const char * string); -const char * scheck(const char * string, const char * format); - -/* ** Finally, some convenience items. */ diff --git a/elsie.nci.nih.gov/src/southamerica b/elsie.nci.nih.gov/src/southamerica index 77e3584..be63a88 100644 --- a/elsie.nci.nih.gov/src/southamerica +++ b/elsie.nci.nih.gov/src/southamerica @@ -1098,6 +1098,60 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # Chile +# From Paul Eggert (2015-04-03): +# Shanks & Pottenger says America/Santiago introduced standard time in +# 1890 and rounds its UTC offset to 70W40; guess that in practice this +# was the same offset as in 1916-1919. It also says Pacific/Easter +# standardized on 109W22 in 1890; assume this didn't change the clocks. +# +# Dates for America/Santiago from 1910 to 2004 are primarily from +# the following source, cited by Oscar van Vlijmen (2006-10-08): +# [1] Chile Law +# http://www.webexhibits.org/daylightsaving/chile.html +# This contains a copy of a this official table: +# Cambios en la hora oficial de Chile desde 1900 (retrieved 2008-03-30) +# http://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm +# [1] needs several corrections, though. +# +# The first set of corrections is from: +# [2] History of the Official Time of Chile +# http://www.horaoficial.cl/ing/horaof_ing.html (retrieved 2012-03-06). See: +# http://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html +# This is an English translation of: +# Historia de la hora oficial de Chile (retrieved 2012-10-24). See: +# http://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm +# A fancier Spanish version (requiring mouse-clicking) is at: +# http://www.horaoficial.cl/historia_hora.html +# Conflicts between [1] and [2] were resolved as follows: +# +# - [1] says the 1910 transition was Jan 1, [2] says Jan 10 and cites +# Boletín Nº 1, Aviso Nº 1 (1910). Go with [2]. +# +# - [1] says SMT was -4:42:45, [2] says Chile's official time from +# 1916 to 1919 was -4:42:46.3, the meridian of Chile's National +# Astronomical Observatory (OAN), then located in what is now +# Quinta Normal in Santiago. Go with [2], rounding it to -4:42:46. +# +# - [1] says the 1918 transition was Sep 1, [2] says Sep 10 and cites +# Boletín Nº 22, Aviso Nº 129/1918 (1918-08-23). Go with [2]. +# +# - [1] does not give times for transitions; assume they occur +# at midnight mainland time, the current common practice. However, +# go with [2]'s specification of 23:00 for the 1947-05-21 transition. +# +# Another correction to [1] is from Jesper Nørgaard Welen, who +# wrote (2006-10-08), "I think that there are some obvious mistakes in +# the suggested link from Oscar van Vlijmen,... for instance entry 66 +# says that GMT-4 ended 1990-09-12 while entry 67 only begins GMT-3 at +# 1990-09-15 (they should have been 1990-09-15 and 1990-09-16 +# respectively), but anyhow it clears up some doubts too." +# +# Data for Pacific/Easter from 1910 through 1967 come from Shanks & +# Pottenger. After that, for lack of better info assume +# Pacific/Easter is always two hours behind America/Santiago; +# this is known to work for DST transitions starting in 2008 and +# may well be true for earlier transitions. + # From Eduardo Krell (1995-10-19): # The law says to switch to DST at midnight [24:00] on the second SATURDAY # of October.... The law is the same for March and October. @@ -1110,78 +1164,35 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # Because of the same drought, the government decided to end DST later, # on April 3, (one-time change). -# From Oscar van Vlijmen (2006-10-08): -# http://www.horaoficial.cl/cambio.htm - -# From Jesper Nørgaard Welen (2006-10-08): -# I think that there are some obvious mistakes in the suggested link -# from Oscar van Vlijmen,... for instance entry 66 says that GMT-4 -# ended 1990-09-12 while entry 67 only begins GMT-3 at 1990-09-15 -# (they should have been 1990-09-15 and 1990-09-16 respectively), but -# anyhow it clears up some doubts too. - -# From Paul Eggert (2014-08-12): -# The following data entries for Chile and America/Santiago are from -# <http://www.horaoficial.cl/horaof.htm> (2006-09-20), transcribed by -# Jesper Nørgaard Welen. The data entries for Pacific/Easter are from Shanks -# & Pottenger, except with DST transitions after 1932 cloned from -# America/Santiago. The pre-1980 Pacific/Easter data entries are dubious, -# but we have no other source. - # From Germán Poo-Caamaño (2008-03-03): # Due to drought, Chile extends Daylight Time in three weeks. This # is one-time change (Saturday 3/29 at 24:00 for America/Santiago # and Saturday 3/29 at 22:00 for Pacific/Easter) # The Supreme Decree is located at # http://www.shoa.cl/servicios/supremo316.pdf -# and the instructions for 2008 are located in: -# http://www.horaoficial.cl/cambio.htm - +# # From José Miguel Garrido (2008-03-05): -# ... -# You could see the announces of the change on # http://www.shoa.cl/noticias/2008/04hora/hora.htm # From Angel Chiang (2010-03-04): # Subject: DST in Chile exceptionally extended to 3 April due to earthquake # http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098 -# (in Spanish, last paragraph). # -# This is breaking news. There should be more information available later. - # From Arthur David Olson (2010-03-06): # Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch. -# From Glenn Eychaner (2011-03-02): -# It appears that the Chilean government has decided to postpone the -# change from summer time to winter time again, by three weeks to April -# 2nd: -# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651 -# -# This is not yet reflected in the official "cambio de hora" site, but -# probably will be soon: -# http://www.horaoficial.cl/cambio.htm - -# From Arthur David Olson (2011-03-02): -# The emol.com article mentions a water shortage as the cause of the -# postponement, which may mean that it's not a permanent change. - # From Glenn Eychaner (2011-03-28): -# The article: # http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E} -# # In English: # Chile's clocks will go back an hour this year on the 7th of May instead # of this Saturday. They will go forward again the 3rd Saturday in -# August, not in October as they have since 1968. This is a pilot plan -# which will be reevaluated in 2012. +# August, not in October as they have since 1968. # From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23): # As stated in the website of the Chilean Energy Ministry # http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html # The Chilean Government has decided to postpone the entrance into winter time -# (to leave DST) from March 11 2012 to April 28th 2012. The decision has not -# been yet formalized but it will within the next days. +# (to leave DST) from March 11 2012 to April 28th 2012.... # Quote from the website communication: # # 6. For the year 2012, the dates of entry into winter time will be as follows: @@ -1214,17 +1225,9 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # From Paul Eggert (2015-03-03): # For now, assume that the extension will persist indefinitely. -# NOTE: ChileAQ rules for Antarctic bases are stored separately in the -# 'antarctica' file. - # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Chile 1927 1932 - Sep 1 0:00 1:00 S +Rule Chile 1927 1931 - Sep 1 0:00 1:00 S Rule Chile 1928 1932 - Apr 1 0:00 0 - -Rule Chile 1942 only - Jun 1 4:00u 0 - -Rule Chile 1942 only - Aug 1 5:00u 1:00 S -Rule Chile 1946 only - Jul 15 4:00u 1:00 S -Rule Chile 1946 only - Sep 1 3:00u 0:00 - -Rule Chile 1947 only - Apr 1 4:00u 0 - Rule Chile 1968 only - Nov 3 4:00u 1:00 S Rule Chile 1969 only - Mar 30 3:00u 0 - Rule Chile 1969 only - Nov 23 4:00u 1:00 S @@ -1235,10 +1238,8 @@ Rule Chile 1972 1986 - Mar Sun>=9 3:00u 0 - Rule Chile 1973 only - Sep 30 4:00u 1:00 S Rule Chile 1974 1987 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1987 only - Apr 12 3:00u 0 - -Rule Chile 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule Chile 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule Chile 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule Chile 1990 only - Mar 18 3:00u 0 - +Rule Chile 1988 1990 - Mar Sun>=9 3:00u 0 - +Rule Chile 1988 1989 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1990 only - Sep 16 4:00u 1:00 S Rule Chile 1991 1996 - Mar Sun>=9 3:00u 0 - Rule Chile 1991 1997 - Oct Sun>=9 4:00u 1:00 S @@ -1261,15 +1262,21 @@ Rule Chile 2012 2014 - Sep Sun>=2 4:00u 1:00 S # (1996-09) says 1998-03-08. Ignore these. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Santiago -4:42:46 - LMT 1890 - -4:42:46 - SMT 1910 # Santiago Mean Time + -4:42:46 - SMT 1910 Jan 10 # Santiago Mean Time -5:00 - CLT 1916 Jul 1 # Chile Time - -4:42:46 - SMT 1918 Sep 1 # Santiago Mean Time - -4:00 - CLT 1919 Jul 1 # Chile Time - -4:42:46 - SMT 1927 Sep 1 # Santiago Mean Time - -5:00 Chile CL%sT 1947 May 22 # Chile Time + -4:42:46 - SMT 1918 Sep 10 + -4:00 - CLT 1919 Jul 1 + -4:42:46 - SMT 1927 Sep 1 + -5:00 Chile CL%sT 1932 Sep 1 + -4:00 - CLT 1942 Jun 1 + -5:00 - CLT 1942 Aug 1 + -4:00 - CLT 1946 Jul 15 + -4:00 1:00 CLST 1946 Sep 1 # central Chile + -4:00 - CLT 1947 Apr 1 + -5:00 - CLT 1947 May 21 23:00 -4:00 Chile CL%sT 2015 Apr 26 3:00u -3:00 - CLT -Zone Pacific/Easter -7:17:44 - LMT 1890 +Zone Pacific/Easter -7:17:28 - LMT 1890 -7:17:28 - EMT 1932 Sep # Easter Mean Time -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time -6:00 Chile EAS%sT 2015 Apr 26 3:00u @@ -1279,6 +1286,25 @@ Zone Pacific/Easter -7:17:44 - LMT 1890 # Other Chilean locations, including Juan Fernández Is, Desventuradas Is, # and Antarctic bases, are like America/Santiago. +# Antarctic base using South American rules +# (See the file 'antarctica' for more.) +# +# Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) +# +# From Ethan Dicks (1996-10-06): +# It keeps the same time as Punta Arenas, Chile, because, just like us +# and the South Pole, that's the other end of their supply line.... +# I verified with someone who was there that since 1980, +# Palmer has followed Chile. Prior to that, before the Falklands War, +# Palmer used to be supplied from Argentina. +# +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Antarctica/Palmer 0 - zzz 1965 + -4:00 Arg AR%sT 1969 Oct 5 + -3:00 Arg AR%sT 1982 May + -4:00 Chile CL%sT 2015 Apr 26 3:00u + -3:00 - CLT + # Colombia # Milne gives 4:56:16.4 for Bogotá time in 1899; round to nearest. He writes, diff --git a/elsie.nci.nih.gov/src/tz-link.htm b/elsie.nci.nih.gov/src/tz-link.htm index 092da5f..242be84 100644 --- a/elsie.nci.nih.gov/src/tz-link.htm +++ b/elsie.nci.nih.gov/src/tz-link.htm @@ -8,7 +8,7 @@ <meta http-equiv="Content-type" content='text/html; charset="UTF-8"'> <meta name="DC.Creator" content="Eggert, Paul"> <meta name="DC.Contributor" content="Olson, Arthur David"> -<meta name="DC.Date" content="2015-01-29"> +<meta name="DC.Date" content="2015-03-25"> <meta name="DC.Description" content="Sources of information about time zones and daylight saving time"> <meta name="DC.Identifier" @@ -194,6 +194,7 @@ multiple time zones.</li> <li><a href="http://www.zeitverschiebung.net/en/">Time Difference</a> calculates the current time difference between locations.</li> <li><a href="http://www.wx-now.com">Weather Now</a> lists the weather too.</li> +<li><a href="http://www.thetimenow.com">The Time Now</a> also lists weather.</li> <li><a href="http://worldtime.io">worldtime.io</a> also contains data about time zone boundaries; it supports queries via place names and shows location maps.</li> @@ -282,6 +283,10 @@ and from <abbr title="Common Locale Data Repository">CLDR</abbr> data into an <abbr>ICU</abbr>-specific format. <abbr>ICU</abbr> is freely available under a <abbr>BSD</abbr>-style license.</li> +<li>The <a +href="http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html">TZUpdater +tool</a> compiles <code><abbr>tz</abbr></code> source into the format used by +Oracle Java.</li> <li><a href="http://www.joda.org/joda-time/">Joda-Time – Java date and time <abbr title="Application Program Interface">API</abbr></a> contains a class diff --git a/elsie.nci.nih.gov/src/zic.c b/elsie.nci.nih.gov/src/zic.c index 5d0501d..636649b 100644 --- a/elsie.nci.nih.gov/src/zic.c +++ b/elsie.nci.nih.gov/src/zic.c @@ -31,8 +31,6 @@ typedef int_fast64_t zic_t; #define MKDIR_UMASK 0755 #endif -#define end(cp) (strchr((cp), '\0')) - struct rule { const char * r_filename; int r_linenum; @@ -368,18 +366,40 @@ size_product(size_t nitems, size_t itemsize) return nitems * itemsize; } +#if !HAVE_STRDUP +static char * +strdup(char const *str) +{ + char *result = malloc(strlen(str) + 1); + return result ? strcpy(result, str) : result; +} +#endif + static ATTRIBUTE_PURE void * -memcheck(void *const ptr) +memcheck(void *ptr) { if (ptr == NULL) memory_exhausted(strerror(errno)); return ptr; } -#define emalloc(size) memcheck(malloc(size)) -#define erealloc(ptr, size) memcheck(realloc(ptr, size)) -#define ecpyalloc(ptr) memcheck(icpyalloc(ptr)) -#define ecatalloc(oldp, newp) memcheck(icatalloc((oldp), (newp))) +static void * +emalloc(size_t size) +{ + return memcheck(malloc(size)); +} + +static void * +erealloc(void *ptr, size_t size) +{ + return memcheck(realloc(ptr, size)); +} + +static char * +ecpyalloc (char const *str) +{ + return memcheck(strdup(str)); +} static void * growalloc(void *ptr, size_t itemsize, int nitems, int *nitems_alloc) @@ -634,6 +654,11 @@ componentcheck(char const *name, char const *component, { enum { component_len_max = 14 }; size_t component_len = component_end - component; + if (component_len == 0) { + fprintf(stderr, _("%s: file name '%s' contains empty component"), + progname, name); + exit(EXIT_FAILURE); + } if (0 < component_len && component_len <= 2 && component[0] == '.' && component_end[-1] == '.') { fprintf(stderr, _("%s: file name '%s' contains" @@ -686,6 +711,21 @@ namecheck(const char *name) componentcheck(name, component, cp); } +static char * +relname(char const *dir, char const *base) +{ + if (*base == '/') + return ecpyalloc(base); + else { + size_t dir_len = strlen(dir); + bool needs_slash = dir_len && dir[dir_len - 1] != '/'; + char *result = emalloc(dir_len + needs_slash + strlen(base) + 1); + result[dir_len] = '/'; + strcpy(result + dir_len + needs_slash, base); + return memcpy(result, dir, dir_len); + } +} + static void dolink(const char *const fromfield, const char *const tofield) { @@ -694,20 +734,8 @@ dolink(const char *const fromfield, const char *const tofield) register int fromisdir; namecheck(tofield); - if (fromfield[0] == '/') - fromname = ecpyalloc(fromfield); - else { - fromname = ecpyalloc(directory); - fromname = ecatalloc(fromname, "/"); - fromname = ecatalloc(fromname, fromfield); - } - if (tofield[0] == '/') - toname = ecpyalloc(tofield); - else { - toname = ecpyalloc(directory); - toname = ecatalloc(toname, "/"); - toname = ecatalloc(toname, tofield); - } + fromname = relname(directory, fromfield); + toname = relname(directory, tofield); /* ** We get to be careful here since ** there's a fair chance of root running us. @@ -731,6 +759,8 @@ dolink(const char *const fromfield, const char *const tofield) if (result != 0) { const char *s = fromfield; const char *t; + char *p; + size_t dotdots = 0; register char * symlinkcontents = NULL; do @@ -739,13 +769,13 @@ dolink(const char *const fromfield, const char *const tofield) && ! strncmp (fromfield, tofield, ++s - fromfield)); - for (s = tofield + (t - fromfield); - (s = strchr(s, '/')); - s++) - symlinkcontents = - ecatalloc(symlinkcontents, - "../"); - symlinkcontents = ecatalloc(symlinkcontents, t); + for (s = tofield + (t - fromfield); *s; s++) + dotdots += *s == '/'; + symlinkcontents + = emalloc(3 * dotdots + strlen(t) + 1); + for (p = symlinkcontents; dotdots-- != 0; p += 3) + memcpy(p, "../", 3); + strcpy(p, t); result = symlink(symlinkcontents, toname); if (result == 0) warning(_("hard link failed, symbolic link used")); @@ -828,7 +858,7 @@ itsdir(const char *const name) return S_ISDIR(st.st_mode) != 0; #else { - char *nameslashdot = ecatalloc(ecpyalloc(name), "/."); + char *nameslashdot = relname(name, "."); res = stat(nameslashdot, &st); free(nameslashdot); return res == 0; @@ -1023,6 +1053,7 @@ gethms(char const *string, char const *errstring, bool signable) { zic_t hh; int mm, ss, sign; + char xs; if (string == NULL || *string == '\0') return 0; @@ -1032,12 +1063,12 @@ gethms(char const *string, char const *errstring, bool signable) sign = -1; ++string; } else sign = 1; - if (sscanf(string, scheck(string, "%"SCNdZIC), &hh) == 1) + if (sscanf(string, "%"SCNdZIC"%c", &hh, &xs) == 1) mm = ss = 0; - else if (sscanf(string, scheck(string, "%"SCNdZIC":%d"), &hh, &mm) == 2) + else if (sscanf(string, "%"SCNdZIC":%d%c", &hh, &mm, &xs) == 2) ss = 0; - else if (sscanf(string, scheck(string, "%"SCNdZIC":%d:%d"), - &hh, &mm, &ss) != 3) { + else if (sscanf(string, "%"SCNdZIC":%d:%d%c", &hh, &mm, &ss, &xs) + != 3) { error("%s", errstring); return 0; } @@ -1215,6 +1246,7 @@ inleap(register char ** const fields, const int nfields) int month, day; zic_t dayoff, tod; zic_t t; + char xs; if (nfields != LEAP_FIELDS) { error(_("wrong number of fields on Leap line")); @@ -1222,7 +1254,7 @@ inleap(register char ** const fields, const int nfields) } dayoff = 0; cp = fields[LP_YEAR]; - if (sscanf(cp, scheck(cp, "%"SCNdZIC), &year) != 1) { + if (sscanf(cp, "%"SCNdZIC"%c", &year, &xs) != 1) { /* ** Leapin' Lizards! */ @@ -1257,7 +1289,7 @@ inleap(register char ** const fields, const int nfields) ++j; } cp = fields[LP_DAY]; - if (sscanf(cp, scheck(cp, "%d"), &day) != 1 || + if (sscanf(cp, "%d%c", &day, &xs) != 1 || day <= 0 || day > len_months[isleap(year)][month]) { error(_("invalid day of month")); return; @@ -1347,6 +1379,7 @@ rulesub(register struct rule *const rp, register const char * cp; register char * dp; register char * ep; + char xs; if ((lp = byword(monthp, mon_names)) == NULL) { error(_("invalid month name")); @@ -1398,7 +1431,7 @@ rulesub(register struct rule *const rp, _("%s: panic: Invalid l_value %d\n"), progname, lp->l_value); exit(EXIT_FAILURE); - } else if (sscanf(cp, scheck(cp, "%"SCNdZIC), &rp->r_loyear) != 1) { + } else if (sscanf(cp, "%"SCNdZIC"%c", &rp->r_loyear, &xs) != 1) { error(_("invalid starting year")); return; } @@ -1420,7 +1453,7 @@ rulesub(register struct rule *const rp, _("%s: panic: Invalid l_value %d\n"), progname, lp->l_value); exit(EXIT_FAILURE); - } else if (sscanf(cp, scheck(cp, "%"SCNdZIC), &rp->r_hiyear) != 1) { + } else if (sscanf(cp, "%"SCNdZIC"%c", &rp->r_hiyear, &xs) != 1) { error(_("invalid ending year")); return; } @@ -1473,7 +1506,7 @@ rulesub(register struct rule *const rp, } rp->r_wday = lp->l_value; } - if (sscanf(ep, scheck(ep, "%d"), &rp->r_dayofmonth) != 1 || + if (sscanf(ep, "%d%c", &rp->r_dayofmonth, &xs) != 1 || rp->r_dayofmonth <= 0 || (rp->r_dayofmonth > len_months[1][rp->r_month])) { error(_("invalid day of month")); @@ -1547,7 +1580,7 @@ writezone(const char *const name, const char *const string, char version) register int leapcnt32, leapi32; register int timecnt32, timei32; register int pass; - static char * fullname; + char * fullname; static const struct tzhead tzh0; static struct tzhead tzh; zic_t *ats = emalloc(size_product(timecnt, sizeof *ats + 1)); @@ -1633,9 +1666,7 @@ writezone(const char *const name, const char *const string, char version) --leapcnt32; ++leapi32; } - fullname = erealloc(fullname, - strlen(directory) + 1 + strlen(name) + 1); - sprintf(fullname, "%s/%s", directory, name); + fullname = relname(directory, name); /* ** Remove old file, if any, to snap links. */ @@ -1850,15 +1881,16 @@ writezone(const char *const name, const char *const string, char version) fprintf(fp, "\n%s\n", string); close_file(fp, fullname); free(ats); + free(fullname); } -static void +static size_t doabbr(char *const abbr, const char *const format, const char *const letters, bool isdst, bool doquotes) { register char * cp; register char * slashp; - register int len; + register size_t len; slashp = strchr(format, '/'); if (slashp == NULL) { @@ -1871,18 +1903,18 @@ doabbr(char *const abbr, const char *const format, const char *const letters, memcpy(abbr, format, slashp - format); abbr[slashp - format] = '\0'; } + len = strlen(abbr); if (!doquotes) - return; + return len; for (cp = abbr; is_alpha(*cp); cp++) continue; - len = strlen(abbr); if (len > 0 && *cp == '\0') - return; + return len; abbr[len + 2] = '\0'; abbr[len + 1] = '>'; - for ( ; len > 0; --len) - abbr[len] = abbr[len - 1]; + memmove(abbr + 1, abbr, len); abbr[0] = '<'; + return len + 2; } static void @@ -1894,17 +1926,18 @@ updateminmax(const zic_t x) max_year = x; } -static bool +static int stringoffset(char *result, zic_t offset) { register int hours; register int minutes; register int seconds; + bool negative = offset < 0; + int len = negative; - result[0] = '\0'; - if (offset < 0) { - strcpy(result, "-"); + if (negative) { offset = -offset; + result[0] = '-'; } seconds = offset % SECSPERMIN; offset /= SECSPERMIN; @@ -1913,15 +1946,15 @@ stringoffset(char *result, zic_t offset) hours = offset; if (hours >= HOURSPERDAY * DAYSPERWEEK) { result[0] = '\0'; - return false; + return 0; } - sprintf(end(result), "%d", hours); + len += sprintf(result + len, "%d", hours); if (minutes != 0 || seconds != 0) { - sprintf(end(result), ":%02d", minutes); + len += sprintf(result + len, ":%02d", minutes); if (seconds != 0) - sprintf(end(result), ":%02d", seconds); + len += sprintf(result + len, ":%02d", seconds); } - return true; + return len; } static int @@ -1931,7 +1964,6 @@ stringrule(char *result, const struct rule *const rp, const zic_t dstoff, register zic_t tod = rp->r_tod; register int compat = 0; - result = end(result); if (rp->r_dycode == DC_DOM) { register int month, total; @@ -1942,9 +1974,9 @@ stringrule(char *result, const struct rule *const rp, const zic_t dstoff, total += len_months[0][month]; /* Omit the "J" in Jan and Feb, as that's shorter. */ if (rp->r_month <= 1) - sprintf(result, "%d", total + rp->r_dayofmonth - 1); + result += sprintf(result, "%d", total + rp->r_dayofmonth - 1); else - sprintf(result, "J%d", total + rp->r_dayofmonth); + result += sprintf(result, "J%d", total + rp->r_dayofmonth); } else { register int week; register int wday = rp->r_wday; @@ -1971,16 +2003,16 @@ stringrule(char *result, const struct rule *const rp, const zic_t dstoff, } else return -1; /* "cannot happen" */ if (wday < 0) wday += DAYSPERWEEK; - sprintf(result, "M%d.%d.%d", - rp->r_month + 1, week, wday); + result += sprintf(result, "M%d.%d.%d", + rp->r_month + 1, week, wday); } if (rp->r_todisgmt) tod += gmtoff; if (rp->r_todisstd && rp->r_stdoff == 0) tod += dstoff; if (tod != 2 * SECSPERMIN * MINSPERHOUR) { - strcat(result, "/"); - if (! stringoffset(end(result), tod)) + *result++ = '/'; + if (! stringoffset(result, tod)) return -1; if (tod < 0) { if (compat < 2013) @@ -2020,6 +2052,8 @@ stringzone(char *result, const struct zone *const zpfirst, const int zonecount) register const char * abbrvar; register int compat = 0; register int c; + size_t len; + int offsetlen; struct rule stdr, dstr; result[0] = '\0'; @@ -2087,30 +2121,36 @@ stringzone(char *result, const struct zone *const zpfirst, const int zonecount) if (stdrp == NULL && (zp->z_nrules != 0 || zp->z_stdoff != 0)) return -1; abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar; - doabbr(result, zp->z_format, abbrvar, false, true); - if (! stringoffset(end(result), -zp->z_gmtoff)) { + len = doabbr(result, zp->z_format, abbrvar, false, true); + offsetlen = stringoffset(result + len, -zp->z_gmtoff); + if (! offsetlen) { result[0] = '\0'; return -1; } + len += offsetlen; if (dstrp == NULL) return compat; - doabbr(end(result), zp->z_format, dstrp->r_abbrvar, true, true); - if (dstrp->r_stdoff != SECSPERMIN * MINSPERHOUR) - if (! stringoffset(end(result), - -(zp->z_gmtoff + dstrp->r_stdoff))) { - result[0] = '\0'; - return -1; - } - strcat(result, ","); - c = stringrule(result, dstrp, dstrp->r_stdoff, zp->z_gmtoff); + len += doabbr(result + len, zp->z_format, dstrp->r_abbrvar, true, true); + if (dstrp->r_stdoff != SECSPERMIN * MINSPERHOUR) { + offsetlen = stringoffset(result + len, + -(zp->z_gmtoff + dstrp->r_stdoff)); + if (! offsetlen) { + result[0] = '\0'; + return -1; + } + len += offsetlen; + } + result[len++] = ','; + c = stringrule(result + len, dstrp, dstrp->r_stdoff, zp->z_gmtoff); if (c < 0) { result[0] = '\0'; return -1; } if (compat < c) compat = c; - strcat(result, ","); - c = stringrule(result, stdrp, dstrp->r_stdoff, zp->z_gmtoff); + len += strlen(result + len); + result[len++] = ','; + c = stringrule(result + len, stdrp, dstrp->r_stdoff, zp->z_gmtoff); if (c < 0) { result[0] = '\0'; return -1; @@ -2718,28 +2758,38 @@ getfields(register char *cp) return array; } +static _Noreturn void +time_overflow(void) +{ + error(_("time overflow")); + exit(EXIT_FAILURE); +} + static ATTRIBUTE_PURE zic_t oadd(const zic_t t1, const zic_t t2) { - if (t1 < 0 ? t2 < ZIC_MIN - t1 : ZIC_MAX - t1 < t2) { - error(_("time overflow")); - exit(EXIT_FAILURE); - } + if (t1 < 0 ? t2 < ZIC_MIN - t1 : ZIC_MAX - t1 < t2) + time_overflow(); return t1 + t2; } static ATTRIBUTE_PURE zic_t tadd(const zic_t t1, const zic_t t2) { - if (t1 == max_time && t2 > 0) - return max_time; - if (t1 == min_time && t2 < 0) - return min_time; - if (t1 < 0 ? t2 < min_time - t1 : max_time - t1 < t2) { - error(_("time overflow")); - exit(EXIT_FAILURE); - } - return t1 + t2; + if (t1 < 0) { + if (t2 < min_time - t1) { + if (t1 != min_time) + time_overflow(); + return min_time; + } + } else { + if (max_time - t1 < t2) { + if (t1 != max_time) + time_overflow(); + return max_time; + } + } + return t1 + t2; } /* |