diff --git a/tz/CONTRIBUTING b/tz/CONTRIBUTING index 4c0f56a..6d800e4 100644 --- a/tz/CONTRIBUTING +++ b/tz/CONTRIBUTING @@ -18,7 +18,7 @@ To email small changes, please run a POSIX shell command like 'diff -u old/europe new/europe >myfix.patch', and attach 'myfix.patch' to the email. -For more-elaborate or possibly-controversial changes, +For more-elaborate or possibly controversial changes, such as renaming, adding or removing zones, please read "Theory and pragmatics of the tz code and data" . diff --git a/tz/Makefile b/tz/Makefile index afb9d53..6edc73c 100644 --- a/tz/Makefile +++ b/tz/Makefile @@ -35,22 +35,14 @@ DATAFORM= main LOCALTIME= Factory -# The POSIXRULES macro controls interpretation of nonstandard and obsolete -# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules. -# Such a setting uses the rules in a template file to determine -# "spring forward" and "fall back" days and times; the environment -# variable itself specifies UT offsets of standard and daylight saving time. -# +# The POSIXRULES macro controls interpretation of POSIX-like TZ +# settings like TZ='EET-2EEST' that lack DST transition rules. # If POSIXRULES is '-', no template is installed; this is the default. -# # Any other value for POSIXRULES is obsolete and should not be relied on, as: # * It does not work correctly in popular implementations such as GNU/Linux. # * It does not work even in tzcode, except for historical timestamps # that precede the last explicit transition in the POSIXRULES file. # Hence it typically does not work for current and future timestamps. -# In short, software should avoid ruleless settings like TZ='EET-2EEST' -# and so should not depend on the value of POSIXRULES. -# # If, despite the above, you want a template for handling these settings, # you can change the line below (after finding the timezone you want in the # one of the $(TDATA) source files, or adding it to a source file). @@ -63,7 +55,7 @@ LOCALTIME= Factory POSIXRULES= - # Also see TZDEFRULESTRING below, which takes effect only -# if the time zone files cannot be accessed. +# if POSIXRULES is '-' or if the template file cannot be accessed. # Installation locations. @@ -211,7 +203,7 @@ LDLIBS= # -DHAVE_DECL_ENVIRON if declares 'environ' # -DHAVE_DECL_TIMEGM=0 if does not declare timegm # -DHAVE_DIRECT_H if mkdir needs (MS-Windows) -# -DHAVE_GENERIC=0 if _Generic does not work* +# -DHAVE__GENERIC=0 if _Generic does not work* # -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), # -DHAVE_GETRANDOM=0 to avoid using getrandom # -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), @@ -220,7 +212,7 @@ LDLIBS= # -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares # ctime_r and asctime_r incompatibly with the POSIX standard # (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). -# -DHAVE_INTTYPES_H=0 if does not work* +# -DHAVE_INTTYPES_H=0 if does not work*+ # -DHAVE_LINK=0 if your system lacks a link function # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz @@ -229,22 +221,24 @@ LDLIBS= # -DHAVE_POSIX_DECLS=0 if your system's include files do not declare # functions like 'link' or variables like 'tzname' required by POSIX # -DHAVE_SETENV=0 if your system lacks the setenv function -# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ # -DHAVE_STDCKDINT_H=0 if neither nor substitutes like # __builtin_add_overflow work* -# -DHAVE_STDINT_H=0 if does not work* +# -DHAVE_STDINT_H=0 if does not work*+ # -DHAVE_STRFTIME_L if declares locale_t and strftime_l # -DHAVE_STRDUP=0 if your system lacks the strdup function -# -DHAVE_STRTOLL=0 if your system lacks the strtoll function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ # -DHAVE_SYMLINK=0 if your system lacks the symlink function # -DHAVE_SYS_STAT_H=0 if does not work* # -DHAVE_TZSET=0 if your system lacks a tzset function # -DHAVE_UNISTD_H=0 if does not work* # -DHAVE_UTMPX_H=0 if does not work* # -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DPORT_TO_C89 if tzcode should also run on C89 platforms+ # -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers # with external linkage, e.g., applications cannot define 'localtime'. # -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -DSUPPORT_C89 if the tzcode library should support C89 callers+ # -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has # security implications and is not recommended for general use # -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; @@ -256,7 +250,13 @@ LDLIBS= # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; # the default is system-supplied, typically "/usr/lib/locale" # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified -# DST transitions if the time zone files cannot be accessed +# DST transitions for POSIX-style TZ strings lacking them, +# in the usual case where POSIXRULES is '-'. If not specified, +# TZDEFRULESTRING defaults to US rules for future DST transitions. +# This mishandles some past timestamps, as US DST rules have changed. +# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, +# as Europe and US DST rules differ. +# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255) # -DUNINIT_TRAP if reading uninitialized storage can cause problems # other than simply getting garbage data # -DUSE_LTZ=0 to build zdump with the system time zone library @@ -273,6 +273,8 @@ LDLIBS= # $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking # # * Options marked "*" can be omitted if your compiler is C23 compatible. +# * Options marked "+" are obsolescent and are planned to be removed +# once the code assumes C99 or later. # # Select instrumentation via "make GCC_INSTRUMENT='whatever'". GCC_INSTRUMENT = \ @@ -363,7 +365,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # -DNETBSD_INSPIRED=0 # to the end of the "CFLAGS=" line. Otherwise, the functions # "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the -# time library, and if STD_INSPIRED is also defined the functions +# time library, and if STD_INSPIRED is also defined to nonzero the functions # "posix2time_z" and "time2posix_z" are added as well. # The functions ending in "_z" (or "_rz") are like their unsuffixed # (or suffixed-by-"_r") counterparts, except with an extra first @@ -455,16 +457,13 @@ SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' -# These characters are Latin-1, and so are likely to be displayable -# even in editors with limited character sets. -UNUSUAL_OK_LATIN_1 = «°±»½¾× -# This IPA symbol is represented in Unicode as the composition of -# U+0075 and U+032F, and U+032F is not considered alphabetic by some -# grep implementations that do not grok composition. -UNUSUAL_OK_IPA = u̯ +# These non-alphabetic, non-ASCII printable characters are Latin-1, +# and so are likely displayable even in editors like XEmacs 21 +# that have limited display capabilities. +UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ # Non-ASCII non-letters that OK_CHAR allows, as these characters are # useful in commentary. -UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA) +UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) # Put this in a bracket expression to match spaces. s = [:space:] @@ -833,7 +832,7 @@ check_slashed_abbrs: $(TDATA_TO_CHECK) CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } -check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab +check_sorted: backward backzone $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ backward | LC_ALL=C sort -cu $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu diff --git a/tz/NEWS b/tz/NEWS index 701e490..9b235a2 100644 --- a/tz/NEWS +++ b/tz/NEWS @@ -1,5 +1,111 @@ News for the tz database +Release 2023b - 2023-03-23 19:50:38 -0700 + + Briefly: + Lebanon delays the start of DST this year. + + Changes to future timestamps + + This year Lebanon springs forward April 20/21 not March 25/26. + (Thanks to Saadallah Itani.) + + +Release 2023a - 2023-03-22 12:39:33 -0700 + + Briefly: + Egypt now uses DST again, from April through October. + This year Morocco springs forward April 23, not April 30. + Palestine delays the start of DST this year. + Much of Greenland still uses DST from 2024 on. + America/Yellowknife now links to America/Edmonton. + tzselect can now use current time to help infer timezone. + The code now defaults to C99 or later. + Fix use of C23 attributes. + + Changes to future timestamps + + Starting in 2023, Egypt will observe DST from April's last Friday + through October's last Thursday. (Thanks to Ahmad ElDardiry.) + Assume the transition times are 00:00 and 24:00, respectively. + + In 2023 Morocco's spring-forward transition after Ramadan + will occur April 23, not April 30. (Thanks to Milamber.) + Adjust predictions for future years accordingly. This affects + predictions for 2023, 2031, 2038, and later years. + + This year Palestine will delay its spring forward from + March 25 to April 29 due to Ramadan. (Thanks to Heba Hamad.) + Make guesses for future Ramadans too. + + Much of Greenland, represented by America/Nuuk, will continue to + observe DST using European Union rules. When combined with + Greenland's decision not to change the clocks in fall 2023, + America/Nuuk therefore changes from -03/-02 to -02/-01 effective + 2023-10-29 at 01:00 UTC. (Thanks to Thomas M. Steenholdt.) + This change from 2022g doesn't affect timestamps until 2024-03-30, + and doesn't affect tm_isdst until 2023-03-25. + + Changes to past timestamps + + America/Yellowknife has changed from a Zone to a backward + compatibility Link, as it no longer differs from America/Edmonton + since 1970. (Thanks to Almaz Mingaleev.) This affects some + pre-1948 timestamps. The old data are now in 'backzone'. + + Changes to past time zone abbreviations + + When observing Moscow time, Europe/Kirov and Europe/Volgograd now + use the abbreviations MSK/MSD instead of numeric abbreviations, + for consistency with other timezones observing Moscow time. + + Changes to code + + You can now tell tzselect local time, to simplify later choices. + Select the 'time' option in its first prompt. + + You can now compile with -DTZNAME_MAXIMUM=N to limit time zone + abbreviations to N bytes (default 255). The reference runtime + library now rejects POSIX-style TZ strings that contain longer + abbreviations, treating them as UTC. Previously the limit was + platform dependent and abbreviations were silently truncated to + 16 bytes even when the limit was greater than 16. + + The code by default is now designed for C99 or later. To build in + a C89 environment, compile with -DPORT_TO_C89. To support C89 + callers of the tzcode library, compile with -DSUPPORT_C89. The + two new macros are transitional aids planned to be removed in a + future version, when C99 or later will be required. + + The code now builds again on pre-C99 platforms, if you compile + with -DPORT_TO_C89. This fixes a bug introduced in 2022f. + + On C23-compatible platforms tzcode no longer uses syntax like + 'static [[noreturn]] void usage(void);'. Instead, it uses + '[[noreturn]] static void usage(void);' as strict C23 requires. + (Problem reported by Houge Langley.) + + The code's functions now constrain their arguments with the C + 'restrict' keyword consistently with their documentation. + This may allow future optimizations. + + zdump again builds standalone with ckdadd and without setenv, + fixing a bug introduced in 2022g. (Problem reported by panic.) + + leapseconds.awk can now process a leap seconds file that never + expires; this might be useful if leap seconds are discontinued. + + Changes to commentary + + tz-link.html has a new section "Coordinating with governments and + distributors". (Thanks to Neil Fuller for some of the text.) + + To improve tzselect diagnostics, zone1970.tab's comments column is + now limited to countries that have multiple timezones. + + Note that leap seconds are planned to be discontinued by 2035. + + Release 2022g - 2022-11-29 08:58:31 -0800 Briefly: @@ -596,7 +702,7 @@ Release 2021b - 2021-09-24 16:23:00 -0700 Starting with 2020a, zic -L truncated its output according to the "Expires" directive or "#expires" comment in the leapseconds file. The resulting TZif files omitted daylight saving transitions after - the leap second table expired, which led to far less-accurate + the leap second table expired, which led to far less accurate predictions of times after the expiry. Although future timestamps cannot be converted accurately in the presence of leap seconds, it is more accurate to convert near-future timestamps with a few @@ -616,7 +722,7 @@ Release 2021b - 2021-09-24 16:23:00 -0700 zic -L LEAPFILE -r @LO no longer generates an invalid TZif file that omits leap second information for the range LO..B when LO falls between two leap seconds A and B. Instead, it generates a - TZif version 4 file that represents the previously-missing + TZif version 4 file that represents the previously missing information. The TZif reader now allows the leap second table to begin with a @@ -670,7 +776,7 @@ Release 2021b - 2021-09-24 16:23:00 -0700 Fix a bug with 'zic -r @X' when X is a negative leap second that has a nonnegative correction. Without the fix, the output file was truncated so that X appeared to be a positive leap second. - Fix a similar, even-less-likely bug when truncating at a positive + Fix a similar, even less likely bug when truncating at a positive leap second that has a nonpositive correction. zic -r now reports an error if given rolling leap seconds, as this @@ -691,7 +797,7 @@ Release 2021b - 2021-09-24 16:23:00 -0700 fixing a bug introduced in 2014g. zdump -v now outputs timestamps at boundaries of what localtime - and gmtime can represent, instead of the less-useful timestamps + and gmtime can represent, instead of the less useful timestamps one day after the minimum and one day before the maximum. (Thanks to Arthur David Olson for prototype code, and to Manuela Friedrich for debugging help.) @@ -2311,7 +2417,7 @@ Release 2016g - 2016-09-13 08:56:38 -0700 names internally. zdump has a new -i option to generate transitions in a - more-compact but still human-readable format. This option is + smaller but still human-readable format. This option is experimental, and the output format may change in future versions. (Thanks to Jon Skeet for suggesting that an option was needed, and thanks to Tim Parenti and Chris Rovick for further comments.) @@ -2333,7 +2439,7 @@ Release 2016g - 2016-09-13 08:56:38 -0700 release 2016g, the version number is now something like '2016g-23-g50556e3-dirty' instead of the misleading '2016g'. Tagged releases use the same version number format as before, - e.g., '2016g'. To support the more-accurate version number, its + e.g., '2016g'. To support the more accurate version number, its specification has moved from a line in the Makefile to a new source file 'version'. @@ -2964,7 +3070,7 @@ Release 2014i - 2014-10-21 22:04:57 -0700 Since Belarus is not changing its clocks even though Moscow is, the time zone abbreviation in Europe/Minsk is changing from FET - to its more-traditional value MSK on 2014-10-26 at 01:00. + to its more traditional value MSK on 2014-10-26 at 01:00. (Thanks to Alexander Bokovoy for the heads-up about Belarus.) The new abbreviation IDT stands for the pre-1976 use of UT +08 in @@ -3056,7 +3162,7 @@ Release 2014h - 2014-09-25 18:59:03 -0700 Changes affecting build procedure - 'make check' now checks better for properly-sorted data. + 'make check' now checks better for properly sorted data. Changes affecting documentation and commentary @@ -3557,7 +3663,7 @@ Release 2014a - 2014-03-07 23:30:29 -0800 Changes affecting past timestamps - Fiji ended DST on 2014-01-19 at 02:00, not the previously-scheduled 03:00. + Fiji ended DST on 2014-01-19 at 02:00, not the previously scheduled 03:00. (Thanks to Steffen Thorsen.) Ukraine switched from Moscow to Eastern European time on 1990-07-01 @@ -3811,7 +3917,7 @@ Release 2013e - 2013-09-19 23:50:04 -0700 Allow POSIX-like TZ strings where the transition time's hour can range from -167 through 167, instead of the POSIX-required 0 through 24. E.g., TZ='FJT-12FJST,M10.3.1/146,M1.3.4/75' for the - new Fiji rules. This is a more-compact way to represent + new Fiji rules. This is a more compact way to represent far-future timestamps for America/Godthab, America/Santiago, Antarctica/Palmer, Asia/Gaza, Asia/Hebron, Asia/Jerusalem, Pacific/Easter, and Pacific/Fiji. Other zones are unaffected by @@ -3819,7 +3925,7 @@ Release 2013e - 2013-09-19 23:50:04 -0700 Allow POSIX-like TZ strings where daylight saving time is in effect all year. E.g., TZ='WART4WARST,J1/0,J365/25' for Western - Argentina Summer Time all year. This supports a more-compact way + Argentina Summer Time all year. This supports a more compact way to represent the 2013d data for America/Argentina/San_Luis. Because of the change for San Luis noted above this change does not affect the current data. (Thanks to Andrew Main (Zefram) for @@ -3908,13 +4014,13 @@ Release 2013e - 2013-09-19 23:50:04 -0700 zdump now outputs "UT" when referring to Universal Time, not "UTC". "UTC" does not make sense for timestamps that predate the introduction - of UTC, whereas "UT", a more-generic term, does. (Thanks to Steve Allen + of UTC, whereas "UT", a more generic term, does. (Thanks to Steve Allen for clarifying UT vs UTC.) Data changes affecting behavior of tzselect and similar programs - Country code BQ is now called the more-common name "Caribbean Netherlands" - rather than the more-official "Bonaire, St Eustatius & Saba". + Country code BQ is now called the more common name "Caribbean Netherlands" + rather than the more official "Bonaire, St Eustatius & Saba". Remove from zone.tab the names America/Montreal, America/Shiprock, and Antarctica/South_Pole, as they are equivalent to existing @@ -4098,7 +4204,7 @@ Release 2013c - 2013-04-19 16:17:40 -0700 Macquarie Island is politically part of Australia, not Antarctica. (Thanks to Tobias Conradi.) - Sort Macquarie more-consistently with other parts of Australia. + Sort Macquarie more consistently with other parts of Australia. (Thanks to Tim Parenti.) @@ -5322,7 +5428,7 @@ Release data1998g - 1998-08-11 03:28:35 -0000 Release data1998f - 1998-07-20 13:50:00 -0000 [tzdata1998f.tar.gz is missing!] - Update the "leapseconds" file to include the newly-announced + Update the "leapseconds" file to include the newly announced insertion at the end of 1998. diff --git a/tz/africa b/tz/africa index cfb9283..6cf4e39 100644 --- a/tz/africa +++ b/tz/africa @@ -321,6 +321,14 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # From Mina Samuel (2016-07-04): # Egyptian government took the decision to cancel the DST, +# From Ahmad ElDardiry (2023-03-01): +# Egypt officially announced today that daylight savings will be +# applied from last Friday of April to last Thursday of October. +# From Paul Eggert (2023-03-01): +# Assume transitions are at 00:00 and 24:00 respectively. +# From Amir Adib (2023-03-07): +# https://www.facebook.com/EgyptianCabinet/posts/638829614954129/ + 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 - @@ -330,6 +338,8 @@ 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 only - Sep lastThu 24:00 0 - +Rule Egypt 2023 max - Apr lastFri 0:00 1:00 S +Rule Egypt 2023 max - Oct lastThu 24:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] #STDOFF 2:05:08.9 @@ -429,7 +439,7 @@ Zone Africa/Nairobi 2:27:16 - LMT 1908 May # President William R. Tolbert, Jr., July 23, 1971-July 31, 1972. # Monrovia: Executive Mansion. # -# Use the abbreviation "MMT" before 1972, as the more-accurate numeric +# Use the abbreviation "MMT" before 1972, as the more accurate numeric # abbreviation "-004430" would be one byte over the POSIX limit. # # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -566,8 +576,8 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 # DST the coming summer... # # Some sources, in French: -# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB -# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints- +# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-«-L%E2%80%99heure-d%E2%80%99été-ne-sera-pas-appliquée-cette-année-» +# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-économie-d-énergie-de-l-heure-d-été-ont-été-atteints- # # Our wrap-up: # https://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html @@ -698,7 +708,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # More articles in the press # https://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html # http://www.lematin.ma/Actualite/Express/Article.asp?id=148923 -# http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim +# http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT+1-a-partir-de-dim # From Petr Machata (2011-03-30): # They have it written in English here: @@ -713,7 +723,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # According to Infomédiaire web site from Morocco (infomediaire.ma), # on March 9, 2012, (in French) Heure légale: # Le Maroc adopte officiellement l'heure d'été -# http://www.infomediaire.ma/news/maroc/heure-l%C3%A9gale-le-maroc-adopte-officiellement-lheure-d%C3%A9t%C3%A9 +# http://www.infomediaire.ma/news/maroc/heure-légale-le-maroc-adopte-officiellement-lheure-dété # Governing Council adopted draft decree, that Morocco DST starts on # the last Sunday of March (March 25, 2012) and ends on # last Sunday of September (September 30, 2012) @@ -837,19 +847,28 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # Friday or Saturday (and so the 2 days off are on a weekend), the next time # shift will be the next weekend. # -# From Paul Eggert (2020-05-31): +# From Milamber (2021-03-31, 2022-03-10): +# https://www.mmsp.gov.ma/fr/actualites.aspx?id=2076 +# https://www.ecoactu.ma/horaires-administration-ramadan-gmtheure-gmt-a-partir-de-dimanche-27-mars/ +# +# From Milamber (2023-03-14, 2023-03-15): +# The return to legal GMT time will take place this Sunday, March 19 at 3 a.m. +# ... the return to GMT+1 will be made on Sunday April 23, 2023 at 2 a.m. +# https://www.mmsp.gov.ma/fr/actualites/passage-à-l%E2%80%99heure-gmt-à-partir-du-dimanche-19-mars-2023 +# +# From Paul Eggert (2023-03-14): # For now, guess that in the future Morocco will fall back at 03:00 # the last Sunday before Ramadan, and spring forward at 02:00 the -# first Sunday after two days after Ramadan. To implement this, +# first Sunday after one day after Ramadan. To implement this, # transition dates and times for 2019 through 2087 were determined by -# running the following program under GNU Emacs 26.3. (This algorithm +# running the following program under GNU Emacs 28.2. (This algorithm # also produces the correct transition dates for 2016 through 2018, # though the times differ due to Morocco's time zone change in 2018.) # (let ((islamic-year 1440)) # (require 'cal-islam) # (while (< islamic-year 1511) # (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (+ 2 (calendar-islamic-to-absolute (list 10 1 islamic-year)))) +# (b (+ 1 (calendar-islamic-to-absolute (list 10 1 islamic-year)))) # (sunday 0)) # (while (/= sunday (mod (setq a (1- a)) 7))) # (while (/= sunday (mod b 7)) @@ -863,10 +882,6 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # (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 Milamber (2021-03-31, 2022-03-10), confirming these predictions: -# https://www.mmsp.gov.ma/fr/actualites.aspx?id=2076 -# https://www.ecoactu.ma/horaires-administration-ramadan-gmtheure-gmt-a-partir-de-dimanche-27-mars/ # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Morocco 1939 only - Sep 12 0:00 1:00 - @@ -919,7 +934,7 @@ Rule Morocco 2021 only - May 16 2:00 0 - Rule Morocco 2022 only - Mar 27 3:00 -1:00 - Rule Morocco 2022 only - May 8 2:00 0 - Rule Morocco 2023 only - Mar 19 3:00 -1:00 - -Rule Morocco 2023 only - Apr 30 2:00 0 - +Rule Morocco 2023 only - Apr 23 2:00 0 - Rule Morocco 2024 only - Mar 10 3:00 -1:00 - Rule Morocco 2024 only - Apr 14 2:00 0 - Rule Morocco 2025 only - Feb 23 3:00 -1:00 - @@ -935,7 +950,7 @@ Rule Morocco 2029 only - Feb 18 2:00 0 - Rule Morocco 2029 only - Dec 30 3:00 -1:00 - Rule Morocco 2030 only - Feb 10 2:00 0 - Rule Morocco 2030 only - Dec 22 3:00 -1:00 - -Rule Morocco 2031 only - Feb 2 2:00 0 - +Rule Morocco 2031 only - Jan 26 2:00 0 - Rule Morocco 2031 only - Dec 14 3:00 -1:00 - Rule Morocco 2032 only - Jan 18 2:00 0 - Rule Morocco 2032 only - Nov 28 3:00 -1:00 - @@ -951,7 +966,7 @@ Rule Morocco 2036 only - Nov 23 2:00 0 - Rule Morocco 2037 only - Oct 4 3:00 -1:00 - Rule Morocco 2037 only - Nov 15 2:00 0 - Rule Morocco 2038 only - Sep 26 3:00 -1:00 - -Rule Morocco 2038 only - Nov 7 2:00 0 - +Rule Morocco 2038 only - Oct 31 2:00 0 - Rule Morocco 2039 only - Sep 18 3:00 -1:00 - Rule Morocco 2039 only - Oct 23 2:00 0 - Rule Morocco 2040 only - Sep 2 3:00 -1:00 - @@ -967,7 +982,7 @@ Rule Morocco 2044 only - Aug 28 2:00 0 - Rule Morocco 2045 only - Jul 9 3:00 -1:00 - Rule Morocco 2045 only - Aug 20 2:00 0 - Rule Morocco 2046 only - Jul 1 3:00 -1:00 - -Rule Morocco 2046 only - Aug 12 2:00 0 - +Rule Morocco 2046 only - Aug 5 2:00 0 - Rule Morocco 2047 only - Jun 23 3:00 -1:00 - Rule Morocco 2047 only - Jul 28 2:00 0 - Rule Morocco 2048 only - Jun 7 3:00 -1:00 - @@ -983,7 +998,7 @@ Rule Morocco 2052 only - Jun 2 2:00 0 - Rule Morocco 2053 only - Apr 13 3:00 -1:00 - Rule Morocco 2053 only - May 25 2:00 0 - Rule Morocco 2054 only - Apr 5 3:00 -1:00 - -Rule Morocco 2054 only - May 17 2:00 0 - +Rule Morocco 2054 only - May 10 2:00 0 - Rule Morocco 2055 only - Mar 28 3:00 -1:00 - Rule Morocco 2055 only - May 2 2:00 0 - Rule Morocco 2056 only - Mar 12 3:00 -1:00 - @@ -999,7 +1014,7 @@ Rule Morocco 2060 only - Mar 7 2:00 0 - Rule Morocco 2061 only - Jan 16 3:00 -1:00 - Rule Morocco 2061 only - Feb 27 2:00 0 - Rule Morocco 2062 only - Jan 8 3:00 -1:00 - -Rule Morocco 2062 only - Feb 19 2:00 0 - +Rule Morocco 2062 only - Feb 12 2:00 0 - Rule Morocco 2062 only - Dec 31 3:00 -1:00 - Rule Morocco 2063 only - Feb 4 2:00 0 - Rule Morocco 2063 only - Dec 16 3:00 -1:00 - @@ -1015,7 +1030,7 @@ Rule Morocco 2067 only - Dec 11 2:00 0 - Rule Morocco 2068 only - Oct 21 3:00 -1:00 - Rule Morocco 2068 only - Dec 2 2:00 0 - Rule Morocco 2069 only - Oct 13 3:00 -1:00 - -Rule Morocco 2069 only - Nov 24 2:00 0 - +Rule Morocco 2069 only - Nov 17 2:00 0 - Rule Morocco 2070 only - Oct 5 3:00 -1:00 - Rule Morocco 2070 only - Nov 9 2:00 0 - Rule Morocco 2071 only - Sep 20 3:00 -1:00 - @@ -1031,7 +1046,7 @@ Rule Morocco 2075 only - Sep 15 2:00 0 - Rule Morocco 2076 only - Jul 26 3:00 -1:00 - Rule Morocco 2076 only - Sep 6 2:00 0 - Rule Morocco 2077 only - Jul 18 3:00 -1:00 - -Rule Morocco 2077 only - Aug 29 2:00 0 - +Rule Morocco 2077 only - Aug 22 2:00 0 - Rule Morocco 2078 only - Jul 10 3:00 -1:00 - Rule Morocco 2078 only - Aug 14 2:00 0 - Rule Morocco 2079 only - Jun 25 3:00 -1:00 - @@ -1041,13 +1056,13 @@ Rule Morocco 2080 only - Jul 21 2:00 0 - Rule Morocco 2081 only - Jun 1 3:00 -1:00 - Rule Morocco 2081 only - Jul 13 2:00 0 - Rule Morocco 2082 only - May 24 3:00 -1:00 - -Rule Morocco 2082 only - Jul 5 2:00 0 - +Rule Morocco 2082 only - Jun 28 2:00 0 - Rule Morocco 2083 only - May 16 3:00 -1:00 - Rule Morocco 2083 only - Jun 20 2:00 0 - Rule Morocco 2084 only - Apr 30 3:00 -1:00 - Rule Morocco 2084 only - Jun 11 2:00 0 - Rule Morocco 2085 only - Apr 22 3:00 -1:00 - -Rule Morocco 2085 only - Jun 3 2:00 0 - +Rule Morocco 2085 only - May 27 2:00 0 - Rule Morocco 2086 only - Apr 14 3:00 -1:00 - Rule Morocco 2086 only - May 19 2:00 0 - Rule Morocco 2087 only - Mar 30 3:00 -1:00 - @@ -1190,15 +1205,15 @@ Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 # From P Chan (2020-12-03): # GMT was adopted as the standard time of Lagos on 1905-07-01. # Lagos Weekly Record, 1905-06-24, p 3 -# http://ddsnext.crl.edu/titles/31558#?c=0&m=668&s=0&cv=2&r=0&xywh=1446%2C5221%2C1931%2C1235 +# http://ddsnext.crl.edu/titles/31558#?c=0&m=668&s=0&cv=2&r=0&xywh=1446,5221,1931,1235 # says "It is officially notified that on and after the 1st of July 1905 -# Greenwich Mean Solar Time will be adopted thought the Colony and +# Greenwich Mean Solar Time will be adopted throughout the Colony and # Protectorate, and that it will be necessary to put all clocks 13 minutes and # 35 seconds back, recording local mean time." # # It seemed that Lagos returned to LMT on 1908-07-01. # [The Lagos Standard], 1908-07-01, p 5 -# http://ddsnext.crl.edu/titles/31556#?c=0&m=78&s=0&cv=4&r=0&xywh=-92%2C3590%2C3944%2C2523 +# http://ddsnext.crl.edu/titles/31556#?c=0&m=78&s=0&cv=4&r=0&xywh=-92,3590,3944,2523 # says "Scarcely have the people become accustomed to this new time, when # another official notice has now appeared announcing that from and after the # 1st July next, return will be made to local mean time." @@ -1210,7 +1225,7 @@ Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 # https://libsysdigi.library.illinois.edu/ilharvest/Africana/Books2011-05/3064634/3064634_1914/3064634_1914_opt.pdf#page=27 # "On January 1st [1914], a universal standard time for Nigeria was adopted, # viz., half an hour fast on Greenwich mean time, corresponding to the meridian -# 7 [degrees] 30' E. long." +# 7° 30' E. long." # Lloyd's Register of Shipping (1915) says "Hitherto the time observed in Lagos # was the local mean time. On 1st January, 1914, standard time for the whole of # Nigeria was introduced ... Lagos time has been advanced about 16 minutes @@ -1228,7 +1243,7 @@ Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 # The Lagos Weekly Record, 1919-09-20, p 3 details discussion on the first # reading of this Bill by the Legislative Council of the Colony of Nigeria on # Thursday 1919-08-28: -# http://ddsnext.crl.edu/titles/31558?terms&item_id=303484#?m=1118&c=1&s=0&cv=2&r=0&xywh=1261%2C3408%2C2994%2C1915 +# http://ddsnext.crl.edu/titles/31558?terms&item_id=303484#?m=1118&c=1&s=0&cv=2&r=0&xywh=1261,3408,2994,1915 # "The proposal is that the Globe should be divided into twelve zones East and # West of Greenwich, of one hour each, Nigeria falling into the zone with a # standard of one hour fast on Greenwich Mean Time. Nigeria standard time is diff --git a/tz/antarctica b/tz/antarctica index f02755a..fc603e9 100644 --- a/tz/antarctica +++ b/tz/antarctica @@ -292,7 +292,7 @@ Zone Antarctica/Rothera 0 - -00 1976 Dec 1 # but that he found it more convenient to keep GMT+12 # as supplies for the station were coming from McMurdo Sound, # which was on GMT+12 because New Zealand was on GMT+12 all year -# at that time (1957). (Source: Siple's book 90 Degrees South.) +# at that time (1957). (Source: Siple's book 90° South.) # # From Susan Smith # http://www.cybertours.com/whs/pole10.html diff --git a/tz/asctime.c b/tz/asctime.c index f0159f8..a40661f 100644 --- a/tz/asctime.c +++ b/tz/asctime.c @@ -50,8 +50,18 @@ enum { STD_ASCTIME_BUF_SIZE = 26 }; */ static char buf_asctime[2*3 + 5*INT_STRLEN_MAXIMUM(int) + 7 + 2 + 1 + 1]; +/* A similar buffer for ctime. + C89 requires that they be the same buffer. + This requirement was removed in C99, so support it only if requested, + as support is more likely to lead to bugs in badly written programs. */ +#if SUPPORT_C89 +# define buf_ctime buf_asctime +#else +static char buf_ctime[sizeof buf_asctime]; +#endif + char * -asctime_r(register const struct tm *timeptr, char *buf) +asctime_r(struct tm const *restrict timeptr, char *restrict buf) { static const char wday_name[][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" @@ -91,7 +101,8 @@ asctime_r(register const struct tm *timeptr, char *buf) timeptr->tm_mday, timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec, year); - if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) + if (strlen(result) < STD_ASCTIME_BUF_SIZE + || buf == buf_ctime || buf == buf_asctime) return strcpy(buf, result); else { errno = EOVERFLOW; @@ -104,3 +115,17 @@ asctime(register const struct tm *timeptr) { return asctime_r(timeptr, buf_asctime); } + +char * +ctime_r(const time_t *timep, char *buf) +{ + struct tm mytm; + struct tm *tmp = localtime_r(timep, &mytm); + return tmp ? asctime_r(tmp, buf) : NULL; +} + +char * +ctime(const time_t *timep) +{ + return ctime_r(timep, buf_ctime); +} diff --git a/tz/asia b/tz/asia index 199e6ad..dd06a5f 100644 --- a/tz/asia +++ b/tz/asia @@ -2691,6 +2691,12 @@ Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 # Lebanon +# +# From Saadallah Itani (2023-03-23): +# Lebanon too announced today delay of Spring forward from March 25 to April 20. +# From Paul Eggert (2023-03-23): +# https://www.mtv.com.lb/en/News/Local/1352516/lebanon-postpones-daylight-saving-time-adoption +# # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Lebanon 1920 only - Mar 28 0:00 1:00 S Rule Lebanon 1920 only - Oct 25 0:00 0 - @@ -2713,9 +2719,11 @@ Rule Lebanon 1988 only - Jun 1 0:00 1:00 S Rule Lebanon 1989 only - May 10 0:00 1:00 S Rule Lebanon 1990 1992 - May 1 0:00 1:00 S Rule Lebanon 1992 only - Oct 4 0:00 0 - -Rule Lebanon 1993 max - Mar lastSun 0:00 1:00 S +Rule Lebanon 1993 2022 - Mar lastSun 0:00 1:00 S Rule Lebanon 1993 1998 - Sep lastSun 0:00 0 - Rule Lebanon 1999 max - Oct lastSun 0:00 0 - +Rule Lebanon 2023 only - Apr 21 0:00 1:00 S +Rule Lebanon 2024 max - Mar lastSun 0:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Beirut 2:22:00 - LMT 1880 2:00 Lebanon EE%sT @@ -2954,7 +2962,7 @@ Zone Asia/Kathmandu 5:41:16 - LMT 1920 # 9pm and moving clocks forward by one hour for the next three months. ...." # # http://www.worldtimezone.com/dst_news/dst_news_pakistan01.html -# http://www.dailytimes.com.pk/default.asp?page=2008%5C05%5C15%5Cstory_15-5-2008_pg1_4 +# http://www.dailytimes.com.pk/default.asp?page=2008\05\15\story_15-5-2008_pg1_4 # From Arthur David Olson (2008-05-19): # XXX--midnight transitions is a guess; 2008 only is a guess. @@ -3277,7 +3285,7 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # Some of many sources in Arabic: # http://www.samanews.com/index.php?act=Show&id=122638 # -# http://safa.ps/details/news/74352/%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-%D8%A8%D8%A7%D9%84%D8%B6%D9%81%D8%A9-%D9%88%D8%BA%D8%B2%D8%A9-%D9%84%D9%8A%D9%84%D8%A9-%D8%A7%D9%84%D8%AC%D9%85%D8%B9%D8%A9.html +# http://safa.ps/details/news/74352/بدء-التوقيت-الصيفي-بالضفة-وغزة-ليلة-الجمعة.html # # Our brief summary: # https://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html @@ -3287,7 +3295,7 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # time from midnight on Friday, March 29, 2013" (translated). # [These are in Arabic and are for Gaza and for Ramallah, respectively.] # http://www.samanews.com/index.php?act=Show&id=154120 -# http://safa.ps/details/news/99844/%D8%B1%D8%A7%D9%85-%D8%A7%D9%84%D9%84%D9%87-%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-29-%D8%A7%D9%84%D8%AC%D8%A7%D8%B1%D9%8A.html +# http://safa.ps/details/news/99844/رام-الله-بدء-التوقيت-الصيفي-29-الجاري.html # From Steffen Thorsen (2013-09-24): # The Gaza and West Bank are ending DST Thursday at midnight @@ -3385,9 +3393,41 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # (2022-08-31): ... the Saturday before the last Sunday in March and October # at 2:00 AM ,for the years from 2023 to 2026. # (2022-09-05): https://mtit.pna.ps/Site/New/1453 -# -# From Paul Eggert (2022-08-31): -# For now, assume that this rule will also be used after 2026. + +# From Heba Hamad (2023-03-22): +# ... summer time will begin in Palestine from Saturday 04-29-2023, +# 02:00 AM by 60 minutes forward. +# +# From Paul Eggert (2023-03-22): +# For now, guess that spring and fall transitions will normally +# continue to use 2022's rules, that during DST Palestine will switch +# to standard time at 02:00 the last Saturday before Ramadan and back +# to DST at 02:00 the first Saturday after Ramadan, and that +# if the normal spring-forward or fall-back transition occurs during +# Ramadan the former is delayed and the latter advanced. +# To implement this, I predicted Ramadan-oriented transition dates for +# 2023 through 2086 by running the following program under GNU Emacs 28.2, +# with the results integrated by hand into the table below. +# Predictions after 2086 are approximated without Ramadan. +# +# (let ((islamic-year 1444)) +# (require 'cal-islam) +# (while (< islamic-year 1510) +# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) +# (b (+ 1 (calendar-islamic-to-absolute (list 10 1 islamic-year)))) +# (saturday 6)) +# (while (/= saturday (mod (setq a (1- a)) 7))) +# (while (/= saturday (mod b 7)) +# (setq b (1+ b))) +# (setq a (calendar-gregorian-from-absolute a)) +# (setq b (calendar-gregorian-from-absolute b)) +# (insert +# (format +# (concat "Rule Palestine\t%d\tonly\t-\t%s\t%2d\t2:00\t0\t-\n" +# "Rule Palestine\t%d\tonly\t-\t%s\t%2d\t2: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)))) # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S @@ -3427,8 +3467,86 @@ Rule Palestine 2020 2021 - Mar Sat<=30 0:00 1:00 S Rule Palestine 2020 only - Oct 24 1:00 0 - Rule Palestine 2021 only - Oct 29 1:00 0 - Rule Palestine 2022 only - Mar 27 0:00 1:00 S -Rule Palestine 2022 max - Oct Sat<=30 2:00 0 - -Rule Palestine 2023 max - Mar Sat<=30 2:00 1:00 S +Rule Palestine 2022 2035 - Oct Sat<=30 2:00 0 - +Rule Palestine 2023 only - Apr 29 2:00 1:00 S +Rule Palestine 2024 only - Apr 13 2:00 1:00 S +Rule Palestine 2025 only - Apr 5 2:00 1:00 S +Rule Palestine 2026 2054 - Mar Sat<=30 2:00 1:00 S +Rule Palestine 2036 only - Oct 18 2:00 0 - +Rule Palestine 2037 only - Oct 10 2:00 0 - +Rule Palestine 2038 only - Sep 25 2:00 0 - +Rule Palestine 2039 only - Sep 17 2:00 0 - +Rule Palestine 2039 only - Oct 22 2:00 1:00 S +Rule Palestine 2039 2067 - Oct Sat<=30 2:00 0 - +Rule Palestine 2040 only - Sep 1 2:00 0 - +Rule Palestine 2040 only - Oct 13 2:00 1:00 S +Rule Palestine 2041 only - Aug 24 2:00 0 - +Rule Palestine 2041 only - Sep 28 2:00 1:00 S +Rule Palestine 2042 only - Aug 16 2:00 0 - +Rule Palestine 2042 only - Sep 20 2:00 1:00 S +Rule Palestine 2043 only - Aug 1 2:00 0 - +Rule Palestine 2043 only - Sep 12 2:00 1:00 S +Rule Palestine 2044 only - Jul 23 2:00 0 - +Rule Palestine 2044 only - Aug 27 2:00 1:00 S +Rule Palestine 2045 only - Jul 15 2:00 0 - +Rule Palestine 2045 only - Aug 19 2:00 1:00 S +Rule Palestine 2046 only - Jun 30 2:00 0 - +Rule Palestine 2046 only - Aug 11 2:00 1:00 S +Rule Palestine 2047 only - Jun 22 2:00 0 - +Rule Palestine 2047 only - Jul 27 2:00 1:00 S +Rule Palestine 2048 only - Jun 6 2:00 0 - +Rule Palestine 2048 only - Jul 18 2:00 1:00 S +Rule Palestine 2049 only - May 29 2:00 0 - +Rule Palestine 2049 only - Jul 3 2:00 1:00 S +Rule Palestine 2050 only - May 21 2:00 0 - +Rule Palestine 2050 only - Jun 25 2:00 1:00 S +Rule Palestine 2051 only - May 6 2:00 0 - +Rule Palestine 2051 only - Jun 17 2:00 1:00 S +Rule Palestine 2052 only - Apr 27 2:00 0 - +Rule Palestine 2052 only - Jun 1 2:00 1:00 S +Rule Palestine 2053 only - Apr 12 2:00 0 - +Rule Palestine 2053 only - May 24 2:00 1:00 S +Rule Palestine 2054 only - Apr 4 2:00 0 - +Rule Palestine 2054 only - May 16 2:00 1:00 S +Rule Palestine 2055 only - May 1 2:00 1:00 S +Rule Palestine 2056 only - Apr 22 2:00 1:00 S +Rule Palestine 2057 only - Apr 7 2:00 1:00 S +Rule Palestine 2058 max - Mar Sat<=30 2:00 1:00 S +Rule Palestine 2068 only - Oct 20 2:00 0 - +Rule Palestine 2069 only - Oct 12 2:00 0 - +Rule Palestine 2070 only - Oct 4 2:00 0 - +Rule Palestine 2071 only - Sep 19 2:00 0 - +Rule Palestine 2072 only - Sep 10 2:00 0 - +Rule Palestine 2072 only - Oct 15 2:00 1:00 S +Rule Palestine 2073 only - Sep 2 2:00 0 - +Rule Palestine 2073 only - Oct 7 2:00 1:00 S +Rule Palestine 2074 only - Aug 18 2:00 0 - +Rule Palestine 2074 only - Sep 29 2:00 1:00 S +Rule Palestine 2075 only - Aug 10 2:00 0 - +Rule Palestine 2075 only - Sep 14 2:00 1:00 S +Rule Palestine 2075 max - Oct Sat<=30 2:00 0 - +Rule Palestine 2076 only - Jul 25 2:00 0 - +Rule Palestine 2076 only - Sep 5 2:00 1:00 S +Rule Palestine 2077 only - Jul 17 2:00 0 - +Rule Palestine 2077 only - Aug 28 2:00 1:00 S +Rule Palestine 2078 only - Jul 9 2:00 0 - +Rule Palestine 2078 only - Aug 13 2:00 1:00 S +Rule Palestine 2079 only - Jun 24 2:00 0 - +Rule Palestine 2079 only - Aug 5 2:00 1:00 S +Rule Palestine 2080 only - Jun 15 2:00 0 - +Rule Palestine 2080 only - Jul 20 2:00 1:00 S +Rule Palestine 2081 only - Jun 7 2:00 0 - +Rule Palestine 2081 only - Jul 12 2:00 1:00 S +Rule Palestine 2082 only - May 23 2:00 0 - +Rule Palestine 2082 only - Jul 4 2:00 1:00 S +Rule Palestine 2083 only - May 15 2:00 0 - +Rule Palestine 2083 only - Jun 19 2:00 1:00 S +Rule Palestine 2084 only - Apr 29 2:00 0 - +Rule Palestine 2084 only - Jun 10 2:00 1:00 S +Rule Palestine 2085 only - Apr 21 2:00 0 - +Rule Palestine 2085 only - Jun 2 2:00 1:00 S +Rule Palestine 2086 only - Apr 13 2:00 0 - +Rule Palestine 2086 only - May 18 2:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct @@ -3632,7 +3750,7 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1 # standard time is SLST. # # From Paul Eggert (2016-10-18): -# "SLST" seems to be reasonably recent and rarely-used outside time +# "SLST" seems to be reasonably recent and rarely used outside time # zone nerd sources. I searched Google News and found three uses of # it in the International Business Times of India in February and # March of this year when discussing cricket match times, but nothing diff --git a/tz/australasia b/tz/australasia index af0410a..0633a30 100644 --- a/tz/australasia +++ b/tz/australasia @@ -323,7 +323,7 @@ Zone Antarctica/Macquarie 0 - -00 1899 Nov # From Steffen Thorsen (2013-01-10): # Fiji will end DST on 2014-01-19 02:00: -# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx +# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-(1).aspx # From Ken Rylander (2014-10-20): # DST will start Nov. 2 this year. @@ -723,7 +723,7 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1892 Jul 5 # # Samoa's Daylight Saving Time Act 2009 is available here, but does not # contain any dates: -# http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf +# http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20(English)%20-%20Final%207-7-091.pdf # From Laupue Raymond Hughes (2010-10-07): # Please see @@ -1808,7 +1808,7 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila # period. It would probably be reasonable to assume Guam use GMT+9 during # that period of time like the surrounding area. -# From Paul Eggert (2018-11-18): +# From Paul Eggert (2023-01-23): # Howse writes (p 153) "The Spaniards, on the other hand, reached the # Philippines and the Ladrones from America," and implies that the Ladrones # (now called the Marianas) kept American date for quite some time. @@ -1821,7 +1821,7 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila # they did as that avoids the need for a separate zone due to our 1970 cutoff. # # US Public Law 106-564 (2000-12-23) made UT +10 the official standard time, -# under the name "Chamorro Standard Time". There is no official abbreviation, +# under the name "Chamorro standard time". There is no official abbreviation, # but Congressman Robert A. Underwood, author of the bill that became law, # wrote in a press release (2000-12-27) that he will seek the use of "ChST". @@ -2199,24 +2199,18 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila # an international standard, there are some places on the high seas where the # correct date is ambiguous. -# From Wikipedia (2005-08-31): -# Before 1920, all ships kept local apparent time on the high seas by setting -# their clocks at night or at the morning sight so that, given the ship's -# speed and direction, it would be 12 o'clock when the Sun crossed the ship's -# meridian (12 o'clock = local apparent noon). During 1917, at the -# Anglo-French Conference on Time-keeping at Sea, it was recommended that all -# ships, both military and civilian, should adopt hourly standard time zones -# on the high seas. Whenever a ship was within the territorial waters of any -# nation it would use that nation's standard time. The captain was permitted -# to change his ship's clocks at a time of his choice following his ship's -# entry into another zone time - he often chose midnight. These zones were -# adopted by all major fleets between 1920 and 1925 but not by many -# independent merchant ships until World War II. - -# From Paul Eggert, using references suggested by Oscar van Vlijmen -# (2005-03-20): -# -# The American Practical Navigator (2002) -# http://pollux.nss.nima.mil/pubs/pubs_j_apn_sections.html?rid=187 -# talks only about the 180-degree meridian with respect to ships in -# international waters; it ignores the international date line. +# From Wikipedia (2023-01-23): +# The nautical time zone system is analogous to the terrestrial time zone +# system for use on high seas. Under the system time changes are required for +# changes of longitude in one-hour steps. The one-hour step corresponds to a +# time zone width of 15° longitude. The 15° gore that is offset from GMT or +# UT1 (not UTC) by twelve hours is bisected by the nautical date line into two +# 7°30' gores that differ from GMT by ±12 hours. A nautical date line is +# implied but not explicitly drawn on time zone maps. It follows the 180th +# meridian except where it is interrupted by territorial waters adjacent to +# land, forming gaps: it is a pole-to-pole dashed line. + +# From Paul Eggert (2023-01-23): +# The American Practical Navigator , +# 2019 edition, merely says that the International Date Line +# "coincides with the 180th meridian over most of its length." diff --git a/tz/backward b/tz/backward index 0ae5d74..421f2ec 100644 --- a/tz/backward +++ b/tz/backward @@ -274,6 +274,7 @@ Link America/Argentina/Cordoba America/Rosario Link America/Tijuana America/Santa_Isabel Link America/Denver America/Shiprock Link America/Toronto America/Thunder_Bay +Link America/Edmonton America/Yellowknife Link Pacific/Auckland Antarctica/South_Pole Link Asia/Shanghai Asia/Chongqing Link Asia/Shanghai Asia/Harbin diff --git a/tz/backzone b/tz/backzone index 7803c57..44d81c2 100644 --- a/tz/backzone +++ b/tz/backzone @@ -169,7 +169,7 @@ Zone Africa/Accra -0:00:52 - LMT 1915 Nov 2 # 12-hour clock starting at our 06:00, so their "8 o'clock" is our # 02:00 or 14:00. Keep this in mind when you ask the time in Amharic. # -# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time +# Shanks & Pottenger write that Ethiopia had six narrowly spaced time # zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in # 1890, and that they switched to 3:00 on 1936-05-05. Perhaps 38E50 # was for Adis Dera. Quite likely the Shanks data entries are wrong @@ -499,7 +499,7 @@ Zone America/Aruba -4:40:24 - LMT 1912 Feb 12 # Oranjestad # ever since standard time was introduced, but the information from # McKinnon sounds more authoritative. For now, assume that Atikokan # switched to EST immediately after WWII era daylight saving time -# ended. This matches the old (less-populous) America/Coral_Harbour +# ended. This matches the old (less populous) America/Coral_Harbour # entry since our cutoff date of 1970, so we can move # America/Coral_Harbour to the 'backward' file. @@ -928,6 +928,11 @@ Zone America/Thunder_Bay -5:57:00 - LMT 1895 Zone America/Tortola -4:18:28 - LMT 1911 Jul # Road Town -4:00 - AST +# Yellowknife, Northwest Territories +Zone America/Yellowknife 0 - -00 1935 # Yellowknife founded? + -7:00 NT_YK M%sT 1980 + -7:00 Canada M%sT + # Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11 # (2005-12-05) # @@ -1756,7 +1761,7 @@ Link Pacific/Chuuk Pacific/Yap # Enderbury was inhabited 1860/1880s to mine guano, and 1938-03-06/1942-02-09 # for aviation (ostensibly commercial, but military uses foreseen). # The 19th-century dates are approximate. See Pacific/Kanton for -# the currently-inhabited representative for this timezone. +# the currently inhabited representative for this timezone. Zone Pacific/Enderbury 0 - -00 1860 -11:24:20 - LMT 1885 0 - -00 1938 Mar 6 diff --git a/tz/checktab.awk b/tz/checktab.awk index 23e0a3a..2dbf485 100644 --- a/tz/checktab.awk +++ b/tz/checktab.awk @@ -107,6 +107,7 @@ BEGIN { cc = cca[j] if (used_max < cc_used[cc]) { used_max = cc_used[cc] + used_max_cc = cc } } if (used_max <= 1 && comments) { @@ -114,9 +115,9 @@ BEGIN { zone_table, i, comments \ >>"/dev/stderr" status = 1 - } else if (1 < cc_used[cc] && !comments) { + } else if (1 < used_max && !comments) { printf "%s:%d: missing comment for %s\n", \ - zone_table, i, cc \ + zone_table, i, used_max_cc \ >>"/dev/stderr" status = 1 } diff --git a/tz/date.1 b/tz/date.1 index 043e568..e810721 100644 --- a/tz/date.1 +++ b/tz/date.1 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 2009-05-17 by Arthur David Olson. -.TH date 1 +.TH date 1 "" "Time Zone Database" .SH NAME date \- show and set date and time .SH SYNOPSIS @@ -156,7 +156,8 @@ hexadecimal (leading 0x), preceded by an optional sign. .br /usr/share/zoneinfo timezone information directory .br -/usr/share/zoneinfo/posixrules used with POSIX-style TZ's +/usr/share/zoneinfo/posixrules default DST rules (obsolete, + and can cause bugs if present) .br /usr/share/zoneinfo/GMT for UTC leap seconds .sp diff --git a/tz/date.c b/tz/date.c index 11c5e5f..b62f04d 100644 --- a/tz/date.c +++ b/tz/date.c @@ -42,7 +42,7 @@ static void display(const char *, time_t); static void dogmt(void); static void errensure(void); static void timeout(FILE *, const char *, const struct tm *); -static ATTRIBUTE_NORETURN void usage(void); +ATTRIBUTE_NORETURN static void usage(void); int main(const int argc, char *argv[]) @@ -86,7 +86,9 @@ main(const int argc, char *argv[]) else if (! (TIME_T_MIN <= secs && secs <= TIME_T_MAX)) errno = ERANGE; if (errno) { - perror(optarg); + char const *e = strerror(errno); + fprintf(stderr, _("date: %s: %s\n"), + optarg, e); errensure(); exit(retval); } @@ -124,10 +126,10 @@ dogmt(void) continue; #if defined ckd_add && defined ckd_mul if (!ckd_add(&n, n, 2) && !ckd_mul(&n, n, sizeof *fakeenv) - && n <= SIZE_MAX) + && n <= INDEX_MAX) fakeenv = malloc(n); #else - if (n <= min(PTRDIFF_MAX, SIZE_MAX) / sizeof *fakeenv - 2) + if (n <= INDEX_MAX / sizeof *fakeenv - 2) fakeenv = malloc((n + 2) * sizeof *fakeenv); #endif if (fakeenv == NULL) { @@ -194,10 +196,9 @@ timeout(FILE *fp, char const *format, struct tm const *tmp) for ( ; ; ) { #ifdef ckd_mul - bool bigger = !ckd_mul(&size, size, 2) && size <= SIZE_MAX; + bool bigger = !ckd_mul(&size, size, 2) && size <= INDEX_MAX; #else - bool bigger = (size <= min(PTRDIFF_MAX, SIZE_MAX) / 2 - && (size *= 2, true)); + bool bigger = size <= INDEX_MAX / 2 && (size *= 2, true); #endif char *newcp = bigger ? realloc(cp, size) : NULL; if (!newcp) { diff --git a/tz/europe b/tz/europe index a3547b4..3907c05 100644 --- a/tz/europe +++ b/tz/europe @@ -517,9 +517,7 @@ Zone Europe/London -0:01:15 - LMT 1847 Dec 1 # other form with a traditional approximation for Irish timestamps # after 1971-10-31 02:00 UTC; although this approximation has tm_isdst # flags that are reversed, its UTC offsets are correct and this often -# suffices. This source file currently uses only nonnegative SAVE -# values, but this is intended to change and downstream code should -# not rely on it. +# suffices.... # # The following is like GB-Eire and EU, except with standard time in # summer and negative daylight saving time in winter. It is for when @@ -1113,19 +1111,18 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn # # From Jürgen Appel (2022-11-25): # https://ina.gl/samlinger/oversigt-over-samlinger/samling/dagsordener/dagsorden.aspx?lang=da&day=24-11-2022 -# If I understand this correctly, from the next planned switch to -# summer time, Greenland will permanently stay at that time, i.e. no -# switch back to winter time in 2023 will occur. -# -# From Paul Eggert (2022-11-28): -# The official document in Danish -# https://naalakkersuisut.gl/-/media/naalakkersuisut/filer/kundgoerelser/2022/11/2511/31_da_inatsisartutlov-om-tidens-bestemmelse.pdf?la=da&hash=A33597D8A38CC7038465241119EF34F3 -# says standard time for Greenland is -02, that Naalakkersuisut can lay down -# rules for DST and can require some areas to use a different time zone, -# and that this all takes effect 2023-03-25 22:00. The abovementioned -# "bekymringer" URL says the intent is no transition March 25, that -# Greenland will not go back to winter time in fall 2023, and that -# only America/Nuuk is affected (though further changes may occur). +# +# From Thomas M. Steenholdt (2022-12-02): +# - The bill to move America/Nuuk from UTC-03 to UTC-02 passed. +# - The bill to stop observing DST did not (Greenland will stop observing DST +# when EU does). +# Details on the implementation are here (section 6): +# https://ina.gl/dvd/EM%202022/pdf/media/2553529/pkt17_em2022_tidens_bestemmelse_bem_da.pdf +# This is how the change will be implemented: +# 1. The shift *to* DST in 2023 happens as normal. +# 2. The shift *from* DST in 2023 happens as normal, but coincides with the +# shift to UTC-02 normaltime (people will not change their clocks here). +# 3. After this, DST is still observed, but as -02/-01 instead of -03/-02. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Thule 1991 1992 - Mar lastSun 2:00 1:00 D @@ -1149,8 +1146,8 @@ Zone America/Scoresbysund -1:27:52 - LMT 1916 Jul 28 # Ittoqqortoormiit -1:00 EU -01/+00 Zone America/Nuuk -3:26:56 - LMT 1916 Jul 28 # Godthåb -3:00 - -03 1980 Apr 6 2:00 - -3:00 EU -03/-02 2023 Mar 25 22:00 - -2:00 - -02 + -3:00 EU -03/-02 2023 Oct 29 1:00u + -2:00 EU -02/-01 Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik -4:00 Thule A%sT @@ -1486,9 +1483,9 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 16 Rule Germany 1946 only - Apr 14 2:00s 1:00 S Rule Germany 1946 only - Oct 7 2:00s 0 - Rule Germany 1947 1949 - Oct Sun>=1 2:00s 0 - -# http://www.ptb.de/de/org/4/44/441/salt.htm says the following transition -# occurred at 3:00 MEZ, not the 2:00 MEZ given in Shanks & Pottenger. -# Go with the PTB. +# https://www.ptb.de/cms/en/ptb/fachabteilungen/abt4/fb-44/ag-441/realisation-of-legal-time-in-germany/dst-and-midsummer-dst-in-germany-until-1979.html +# says the following transition occurred at 3:00 MEZ, not the 2:00 MEZ +# given in Shanks & Pottenger. Go with the PTB. Rule Germany 1947 only - Apr 6 3:00s 1:00 S Rule Germany 1947 only - May 11 2:00s 2:00 M Rule Germany 1947 only - Jun 29 3:00 1:00 S @@ -2249,7 +2246,7 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # the State Duma has approved ... the draft bill on returning to # winter time standard and return Russia 11 time zones. The new # regulations will come into effect on October 26, 2014 at 02:00 ... -# http://asozd2.duma.gov.ru/main.nsf/%28Spravka%29?OpenAgent&RN=431985-6&02 +# http://asozd2.duma.gov.ru/main.nsf/(Spravka)?OpenAgent&RN=431985-6&02 # Here is a link where we put together table (based on approved Bill N # 431985-6) with proposed 11 Russian time zones and corresponding # areas/cities/administrative centers in the Russian Federation (in English): @@ -2659,13 +2656,13 @@ Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3 3:00 - +03 1930 Jun 21 4:00 - +04 1961 Nov 11 4:00 Russia +04/+05 1988 Mar 27 2:00s - 3:00 Russia +03/+04 1991 Mar 31 2:00s + 3:00 Russia MSK/MSD 1991 Mar 31 2:00s 4:00 - +04 1992 Mar 29 2:00s - 3:00 Russia +03/+04 2011 Mar 27 2:00s - 4:00 - +04 2014 Oct 26 2:00s - 3:00 - +03 2018 Oct 28 2:00s + 3:00 Russia MSK/MSD 2011 Mar 27 2:00s + 4:00 - MSK 2014 Oct 26 2:00s + 3:00 - MSK 2018 Oct 28 2:00s 4:00 - +04 2020 Dec 27 2:00s - 3:00 - +03 + 3:00 - MSK # From Paul Eggert (2016-11-11): # Europe/Saratov covers: @@ -2696,11 +2693,11 @@ Zone Europe/Saratov 3:04:18 - LMT 1919 Jul 1 0:00u Zone Europe/Kirov 3:18:48 - LMT 1919 Jul 1 0:00u 3:00 - +03 1930 Jun 21 4:00 Russia +04/+05 1989 Mar 26 2:00s - 3:00 Russia +03/+04 1991 Mar 31 2:00s + 3:00 Russia MSK/MSD 1991 Mar 31 2:00s 4:00 - +04 1992 Mar 29 2:00s - 3:00 Russia +03/+04 2011 Mar 27 2:00s - 4:00 - +04 2014 Oct 26 2:00s - 3:00 - +03 + 3:00 Russia MSK/MSD 2011 Mar 27 2:00s + 4:00 - MSK 2014 Oct 26 2:00s + 3:00 - MSK # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25): # Europe/Samara covers... diff --git a/tz/iso3166.tab b/tz/iso3166.tab index 911af5e..be3348d 100644 --- a/tz/iso3166.tab +++ b/tz/iso3166.tab @@ -238,7 +238,7 @@ SY Syria SZ Eswatini (Swaziland) TC Turks & Caicos Is TD Chad -TF French Southern Territories +TF French S. Terr. TG Togo TH Thailand TJ Tajikistan diff --git a/tz/leap-seconds.list b/tz/leap-seconds.list index 5b519b7..17e3a10 100644 --- a/tz/leap-seconds.list +++ b/tz/leap-seconds.list @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C64 -# File expires on: 28 June 2023 +# Updated through IERS Bulletin C65 +# File expires on: 28 December 2023 # -#@ 3896899200 +#@ 3912710400 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 2c413af9 124e1031 f165174 ff527c6b 756ae00b +#h e76a99dc 65f15cc7 e613e040 f5078b5e b23834fe diff --git a/tz/leapseconds.awk b/tz/leapseconds.awk index b6c48bc..7d2556b 100644 --- a/tz/leapseconds.awk +++ b/tz/leapseconds.awk @@ -104,18 +104,23 @@ BEGIN { } END { - sstamp_to_ymdhMs(expires, ss_NTP) - print "" - print "# UTC timestamp when this leap second list expires." - print "# Any additional leap seconds will come after this." - if (! EXPIRES_LINE) { - print "# This Expires line is commented out for now," - print "# so that pre-2020a zic implementations do not reject this file." + + if (expires) { + sstamp_to_ymdhMs(expires, ss_NTP) + + print "# UTC timestamp when this leap second list expires." + print "# Any additional leap seconds will come after this." + if (! EXPIRES_LINE) { + print "# This Expires line is commented out for now," + print "# so that pre-2020a zic implementations do not reject this file." + } + printf "%sExpires %.4d\t%s\t%.2d\t%.2d:%.2d:%.2d\n", \ + EXPIRES_LINE ? "" : "#", \ + ss_year, monthabbr[ss_month], ss_mday, ss_hour, ss_min, ss_sec + } else { + print "# (No Expires line, since the expires time is unknown.)" } - printf "%sExpires %.4d\t%s\t%.2d\t%.2d:%.2d:%.2d\n", \ - EXPIRES_LINE ? "" : "#", \ - ss_year, monthabbr[ss_month], ss_mday, ss_hour, ss_min, ss_sec # The difference between the NTP and POSIX epochs is 70 years # (including 17 leap days), each 24 hours of 60 minutes of 60 @@ -124,15 +129,22 @@ END { print "" print "# POSIX timestamps for the data in this file:" - sstamp_to_ymdhMs(updated, ss_NTP) - printf "#updated %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ - updated - epoch_minus_NTP, \ - ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec - sstamp_to_ymdhMs(expires, ss_NTP) - printf "#expires %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ - expires - epoch_minus_NTP, \ - ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec - + if (updated) { + sstamp_to_ymdhMs(updated, ss_NTP) + printf "#updated %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + updated - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + } else { + print "#(updated time unknown)" + } + if (expires) { + sstamp_to_ymdhMs(expires, ss_NTP) + printf "#expires %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + expires - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + } else { + print "#(expires time unknown)" + } printf "\n%s", last_lines } diff --git a/tz/localtime.c b/tz/localtime.c index 1d22d35..818d58f 100644 --- a/tz/localtime.c +++ b/tz/localtime.c @@ -28,10 +28,6 @@ static int lock(void) { return 0; } static void unlock(void) { } #endif -#ifndef TZ_ABBR_MAX_LEN -# define TZ_ABBR_MAX_LEN 16 -#endif /* !defined TZ_ABBR_MAX_LEN */ - #ifndef TZ_ABBR_CHAR_SET # define TZ_ABBR_CHAR_SET \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._" @@ -109,12 +105,11 @@ static char const UNSPEC[] = "-00"; for ttunspecified to work without crashing. */ enum { CHARS_EXTRA = max(sizeof UNSPEC, 2) - 1 }; -#ifdef TZNAME_MAX -# define MY_TZNAME_MAX TZNAME_MAX -#endif /* defined TZNAME_MAX */ -#ifndef TZNAME_MAX -# define MY_TZNAME_MAX 255 -#endif /* !defined TZNAME_MAX */ +/* Limit to time zone abbreviation length in POSIX-style TZ strings. + This is distinct from TZ_MAX_CHARS, which limits TZif file contents. */ +#ifndef TZNAME_MAXIMUM +# define TZNAME_MAXIMUM 255 +#endif struct state { int leapcnt; @@ -127,7 +122,7 @@ struct state { unsigned char types[TZ_MAX_TIMES]; struct ttinfo ttis[TZ_MAX_TYPES]; char chars[max(max(TZ_MAX_CHARS + CHARS_EXTRA, sizeof "UTC"), - 2 * (MY_TZNAME_MAX + 1))]; + 2 * (TZNAME_MAXIMUM + 1))]; struct lsinfo lsis[TZ_MAX_LEAPS]; /* The time type to use for early times or if no transitions. @@ -186,9 +181,14 @@ static int lcl_is_set; ** ctime, gmtime, localtime] return values in one of two static ** objects: a broken-down time structure and an array of char. ** Thanks to Paul Eggert for noting this. +** +** This requirement was removed in C99, so support it only if requested, +** as support is more likely to lead to bugs in badly written programs. */ +#if SUPPORT_C89 static struct tm tm; +#endif #if 2 <= HAVE_TZNAME + TZ_TIME_T char * tzname[2] = { @@ -340,27 +340,28 @@ settzname(void) #endif } -static void +/* Replace bogus characters in time zone abbreviations. + Return 0 on success, an errno value if a time zone abbreviation is + too long. */ +static int scrub_abbrs(struct state *sp) { int i; - /* - ** First, replace bogus characters. - */ + + /* Reject overlong abbreviations. */ + for (i = 0; i < sp->charcnt - (TZNAME_MAXIMUM + 1); ) { + int len = strlen(&sp->chars[i]); + if (TZNAME_MAXIMUM < len) + return EOVERFLOW; + i += len + 1; + } + + /* Replace bogus characters. */ for (i = 0; i < sp->charcnt; ++i) if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL) sp->chars[i] = TZ_ABBR_ERR_CHAR; - /* - ** Second, truncate long abbreviations. - */ - for (i = 0; i < sp->typecnt; ++i) { - register const struct ttinfo * const ttisp = &sp->ttis[i]; - char *cp = &sp->chars[ttisp->tt_desigidx]; - if (strlen(cp) > TZ_ABBR_MAX_LEN && - strcmp(cp, GRANDPARENTED) != 0) - *(cp + TZ_ABBR_MAX_LEN) = '\0'; - } + return 0; } /* Input buffer for data read from a compiled tz file. */ @@ -838,7 +839,7 @@ is_digit(char c) ** Return a pointer to that character. */ -static ATTRIBUTE_REPRODUCIBLE const char * +ATTRIBUTE_REPRODUCIBLE static const char * getzname(register const char *strp) { register char c; @@ -859,7 +860,7 @@ getzname(register const char *strp) ** We don't do any checking here; checking is done later in common-case code. */ -static ATTRIBUTE_REPRODUCIBLE const char * +ATTRIBUTE_REPRODUCIBLE static const char * getqzname(register const char *strp, const int delim) { register int c; @@ -1139,14 +1140,12 @@ tzparse(const char *name, struct state *sp, struct state *basep) name = getzname(name); stdlen = name - stdname; } - if (!stdlen) + if (! (0 < stdlen && stdlen <= TZNAME_MAXIMUM)) return false; name = getoffset(name, &stdoffset); if (name == NULL) return false; charcnt = stdlen + 1; - if (sizeof sp->chars < charcnt) - return false; if (basep) { if (0 < basep->timecnt) atlo = basep->ats[basep->timecnt - 1]; @@ -1173,11 +1172,9 @@ tzparse(const char *name, struct state *sp, struct state *basep) name = getzname(name); dstlen = name - dstname; /* length of DST abbr. */ } - if (!dstlen) + if (! (0 < dstlen && dstlen <= TZNAME_MAXIMUM)) return false; charcnt += dstlen + 1; - if (sizeof sp->chars < charcnt) - return false; if (*name != '\0' && *name != ',' && *name != ';') { name = getoffset(name, &dstoffset); if (name == NULL) @@ -1420,7 +1417,7 @@ zoneinit(struct state *sp, char const *name) if (err != 0 && name && name[0] != ':' && tzparse(name, sp, NULL)) err = 0; if (err == 0) - scrub_abbrs(sp); + err = scrub_abbrs(sp); return err; } } @@ -1623,7 +1620,8 @@ localsub(struct state const *sp, time_t const *timep, int_fast32_t setname, #if NETBSD_INSPIRED struct tm * -localtime_rz(struct state *sp, time_t const *timep, struct tm *tmp) +localtime_rz(struct state *restrict sp, time_t const *restrict timep, + struct tm *restrict tmp) { return localsub(sp, timep, 0, tmp); } @@ -1648,11 +1646,14 @@ localtime_tzset(time_t const *timep, struct tm *tmp, bool setname) struct tm * localtime(const time_t *timep) { +#if !SUPPORT_C89 + static struct tm tm; +#endif return localtime_tzset(timep, &tm, true); } struct tm * -localtime_r(const time_t *timep, struct tm *tmp) +localtime_r(const time_t *restrict timep, struct tm *restrict tmp) { return localtime_tzset(timep, tmp, false); } @@ -1685,7 +1686,7 @@ gmtsub(ATTRIBUTE_MAYBE_UNUSED struct state const *sp, time_t const *timep, */ struct tm * -gmtime_r(const time_t *timep, struct tm *tmp) +gmtime_r(time_t const *restrict timep, struct tm *restrict tmp) { gmtcheck(); return gmtsub(gmtptr, timep, 0, tmp); @@ -1694,19 +1695,26 @@ gmtime_r(const time_t *timep, struct tm *tmp) struct tm * gmtime(const time_t *timep) { +#if !SUPPORT_C89 + static struct tm tm; +#endif return gmtime_r(timep, &tm); } -#ifdef STD_INSPIRED +#if STD_INSPIRED struct tm * offtime(const time_t *timep, long offset) { gmtcheck(); + +#if !SUPPORT_C89 + static struct tm tm; +#endif return gmtsub(gmtptr, timep, offset, &tm); } -#endif /* defined STD_INSPIRED */ +#endif /* ** Return the number of leap years through the end of the given year @@ -1842,27 +1850,6 @@ timesub(const time_t *timep, int_fast32_t offset, return tmp; } -char * -ctime(const time_t *timep) -{ -/* -** Section 4.12.3.2 of X3.159-1989 requires that -** The ctime function converts the calendar time pointed to by timer -** to local time in the form of a string. It is equivalent to -** asctime(localtime(timer)) -*/ - struct tm *tmp = localtime(timep); - return tmp ? asctime(tmp) : NULL; -} - -char * -ctime_r(const time_t *timep, char *buf) -{ - struct tm mytm; - struct tm *tmp = localtime_r(timep, &mytm); - return tmp ? asctime_r(tmp, buf) : NULL; -} - /* ** Adapted from code provided by Robert Elz, who writes: ** The "best" way to do mktime I think is based on an idea of Bob @@ -2303,7 +2290,7 @@ mktime_tzname(struct state *sp, struct tm *tmp, bool setname) #if NETBSD_INSPIRED time_t -mktime_z(struct state *sp, struct tm *tmp) +mktime_z(struct state *restrict sp, struct tm *restrict tmp) { return mktime_tzname(sp, tmp, false); } @@ -2325,7 +2312,7 @@ mktime(struct tm *tmp) return t; } -#ifdef STD_INSPIRED +#if STD_INSPIRED time_t timelocal(struct tm *tmp) { @@ -2377,7 +2364,7 @@ leapcorr(struct state const *sp, time_t t) ** XXX--is the below the right way to conditionalize?? */ -#ifdef STD_INSPIRED +#if STD_INSPIRED /* NETBSD_INSPIRED_EXTERN functions are exported to callers if NETBSD_INSPIRED is defined, and are private otherwise. */ @@ -2462,7 +2449,7 @@ posix2time(time_t t) return t; } -#endif /* defined STD_INSPIRED */ +#endif /* STD_INSPIRED */ #if TZ_TIME_T diff --git a/tz/newctime.3 b/tz/newctime.3 index e25d841..05bb7de 100644 --- a/tz/newctime.3 +++ b/tz/newctime.3 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 2009-05-17 by Arthur David Olson. -.TH NEWCTIME 3 +.TH newctime 3 "" "Time Zone Database" .SH NAME asctime, ctime, difftime, gmtime, localtime, mktime \- convert date and time .SH SYNOPSIS @@ -11,13 +11,13 @@ asctime, ctime, difftime, gmtime, localtime, mktime \- convert date and time .PP .BR "extern char *tzname[];" " /\(** (optional) \(**/" .PP -.B char *ctime(time_t const *clock); +.B [[deprecated]] char *ctime(time_t const *clock); .PP .B char *ctime_r(time_t const *clock, char *buf); .PP .B double difftime(time_t time1, time_t time0); .PP -.B char *asctime(struct tm const *tm); +.B [[deprecated]] char *asctime(struct tm const *tm); .PP .B "char *asctime_r(struct tm const *restrict tm," .B " char *restrict result);" @@ -91,6 +91,15 @@ introduction of UTC and are some other flavor of Universal Time (UT). Some implementations support leap seconds, in contradiction to POSIX. .PP The +.B ctime +function is deprecated starting in C23. +Callers can use +.B localtime_r +and +.B strftime +instead. +.PP +The .B localtime and .B gmtime @@ -128,6 +137,10 @@ converts a time value contained in a structure to a string, as shown in the above example, and returns a pointer to the string. +This function is deprecated starting in C23. +Callers can use +.B strftime +instead. .PP The .B mktime @@ -283,7 +296,8 @@ continue to exist in this form in future releases of this code. .br /usr/share/zoneinfo/localtime local timezone file .br -/usr/share/zoneinfo/posixrules used with POSIX-style TZ's +/usr/share/zoneinfo/posixrules default DST rules (obsolete, + and can cause bugs if present) .br /usr/share/zoneinfo/GMT for UTC leap seconds .sp diff --git a/tz/newstrftime.3 b/tz/newstrftime.3 index d5d8ee1..432c3e8 100644 --- a/tz/newstrftime.3 +++ b/tz/newstrftime.3 @@ -35,7 +35,7 @@ .\" from: @(#)strftime.3 5.12 (Berkeley) 6/29/91 .\" $Id: strftime.3,v 1.4 1993/12/15 20:33:00 jtc Exp $ .\" -.TH NEWSTRFTIME 3 +.TH newstrftime 3 "" "Time Zone Database" .SH NAME strftime \- format date and time .SH SYNOPSIS diff --git a/tz/newtzset.3 b/tz/newtzset.3 index 1e75acf..78b6b6c 100644 --- a/tz/newtzset.3 +++ b/tz/newtzset.3 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 2009-05-17 by Arthur David Olson. -.TH NEWTZSET 3 +.TH newtzset 3 "" "Time Zone Database" .SH NAME tzset \- initialize time conversion information .SH SYNOPSIS @@ -333,7 +333,8 @@ from the rest of the specification. .br /usr/share/zoneinfo/localtime local timezone file .br -/usr/share/zoneinfo/posixrules used with POSIX-style TZ +/usr/share/zoneinfo/posixrules default DST rules (obsolete, + and can cause bugs if present) .br /usr/share/zoneinfo/GMT for UTC leap seconds .sp diff --git a/tz/northamerica b/tz/northamerica index d50581d..d8e3601 100644 --- a/tz/northamerica +++ b/tz/northamerica @@ -276,9 +276,10 @@ Zone PST8PDT -8:00 US P%sT # -10 Standard Alaska Time (AST) Alaska-Hawaii standard time (AHST) # -11 (unofficial) Nome (NST) Bering standard time (BST) # -# From Paul Eggert (2000-01-08), following a heads-up from Rives McDow: -# Public law 106-564 (2000-12-23) introduced ... "Chamorro Standard Time" +# From Paul Eggert (2023-01-23), from a 2001-01-08 heads-up from Rives McDow: +# Public law 106-564 (2000-12-23) introduced "Chamorro standard time" # for time in Guam and the Northern Marianas. See the file "australasia". +# Also see 15 U.S.C. §263 . # # From Paul Eggert (2015-04-17): # HST and HDT are standardized abbreviations for Hawaii-Aleutian @@ -595,7 +596,7 @@ Zone America/Los_Angeles -7:52:58 - LMT 1883 Nov 18 20:00u # local times of other Alaskan locations so that they change simultaneously. # From Paul Eggert (2014-07-18): -# One opinion of the early-1980s turmoil in Alaska over time zones and +# One opinion of the early 1980s turmoil in Alaska over time zones and # daylight saving time appeared as graffiti on a Juneau airport wall: # "Welcome to Juneau. Please turn your watch back to the 19th century." # See: Turner W. Alaska's four time zones now two. NY Times 1983-11-01. @@ -667,6 +668,10 @@ Zone America/Los_Angeles -7:52:58 - LMT 1883 Nov 18 20:00u # So they won't be waiting for Alaska to join them on 2019-03-10, but will # rather change their clocks twice in seven weeks. +# From Paul Eggert (2023-01-23): +# America/Adak is for the Aleutian Islands that are part of Alaska +# and are west of 169.5° W. + # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Juneau 15:02:19 - LMT 1867 Oct 19 15:33:32 -8:57:41 - LMT 1900 Aug 20 12:00 @@ -2125,10 +2130,6 @@ Zone America/Fort_Nelson -8:10:47 - LMT 1884 # Nunavut ... moved ... to incorporate the whole territory into one time zone. # Nunavut moves to single time zone Oct. 31 # http://www.nunatsiaq.com/nunavut/nvt90903_13.html -# -# From Antoine Leca (1999-09-06): -# We then need to create a new timezone for the Kitikmeot region of Nunavut -# to differentiate it from the Yellowknife region. # From Paul Eggert (1999-09-20): # Basic Facts: The New Territory @@ -2322,9 +2323,6 @@ Zone America/Cambridge_Bay 0 - -00 1920 # trading post est.? -5:00 - EST 2000 Nov 5 0:00 -6:00 - CST 2001 Apr 1 3:00 -7:00 Canada M%sT -Zone America/Yellowknife 0 - -00 1935 # Yellowknife founded? - -7:00 NT_YK M%sT 1980 - -7:00 Canada M%sT Zone America/Inuvik 0 - -00 1953 # Inuvik founded -8:00 NT_YK P%sT 1979 Apr lastSun 2:00 -7:00 NT_YK M%sT 1980 @@ -2561,7 +2559,7 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 # and in addition changes all of Chihuahua to -06 with no DST. # From Heitor David Pinto (2022-11-28): -# Now the northern municipalities want to have the same time zone as the +# Now the northern [municipios] want to have the same time zone as the # respective neighboring cities in the US, for example Juárez in UTC-7 with # DST, matching El Paso, and Ojinaga in UTC-6 with DST, matching Presidio.... # the president authorized the publication of the decree for November 29, @@ -2598,7 +2596,7 @@ Zone America/Merida -5:58:28 - LMT 1922 Jan 1 6:00u -5:00 - EST 1982 Dec 2 -6:00 Mexico C%sT # Coahuila, Nuevo León, Tamaulipas (near US border) -# This includes the following municipalities: +# This includes the following municipios: # in Coahuila: Acuña, Allende, Guerrero, Hidalgo, Jiménez, Morelos, Nava, # Ocampo, Piedras Negras, Villa Unión, Zaragoza # in Nuevo León: Anáhuac @@ -2624,8 +2622,8 @@ Zone America/Mexico_City -6:36:36 - LMT 1922 Jan 1 7:00u -6:00 - CST 2002 Feb 20 -6:00 Mexico C%sT # Chihuahua (near US border - western side) -# This includes the municipalities of Janos, Ascensión, Juárez, Guadalupe, -# and Práxedis G Guerrero. +# This includes the municipios of Janos, Ascensión, Juárez, Guadalupe, and +# Práxedis G Guerrero. # http://gaceta.diputados.gob.mx/PDF/65/2a022/nov/20221124-VII.pdf Zone America/Ciudad_Juarez -7:05:56 - LMT 1922 Jan 1 7:00u -7:00 - MST 1927 Jun 10 23:00 @@ -2639,7 +2637,8 @@ Zone America/Ciudad_Juarez -7:05:56 - LMT 1922 Jan 1 7:00u -6:00 - CST 2022 Nov 30 0:00 -7:00 US M%sT # Chihuahua (near US border - eastern side) -# The municipalities of Coyame del Sotol, Ojinaga, and Manuel Benavides. +# This includes the municipios of Coyame del Sotol, Ojinaga, and Manuel +# Benavides. # http://gaceta.diputados.gob.mx/PDF/65/2a022/nov/20221124-VII.pdf Zone America/Ojinaga -6:57:40 - LMT 1922 Jan 1 7:00u -7:00 - MST 1927 Jun 10 23:00 @@ -3060,7 +3059,7 @@ Zone America/Costa_Rica -5:36:13 - LMT 1890 # San José # # He supplied these references: # -# http://www.prensalatina.com.mx/article.asp?ID=%7B4CC32C1B-A9F7-42FB-8A07-8631AFC923AF%7D&language=ES +# http://www.prensalatina.com.mx/article.asp?ID={4CC32C1B-A9F7-42FB-8A07-8631AFC923AF}&language=ES # http://actualidad.terra.es/sociedad/articulo/cuba_llama_ahorrar_energia_cambio_1957044.htm # # From Alex Krivenyshev (2007-10-25): diff --git a/tz/private.h b/tz/private.h index 7a73eff..838ab2b 100644 --- a/tz/private.h +++ b/tz/private.h @@ -17,12 +17,25 @@ ** Thank you! */ +/* PORT_TO_C89 means the code should work even if the underlying + compiler and library support only C89. SUPPORT_C89 means the + tzcode library should support C89 callers in addition to the usual + support for C99-and-later callers. These macros are obsolescent, + and the plan is to remove them along with any code needed only when + they are nonzero. */ +#ifndef PORT_TO_C89 +# define PORT_TO_C89 0 +#endif +#ifndef SUPPORT_C89 +# define SUPPORT_C89 0 +#endif + #ifndef __STDC_VERSION__ # define __STDC_VERSION__ 0 #endif /* Define true, false and bool if they don't work out of the box. */ -#if __STDC_VERSION__ < 199901 +#if PORT_TO_C89 && __STDC_VERSION__ < 199901 # define true 1 # define false 0 # define bool int @@ -30,6 +43,10 @@ # include #endif +#if __STDC_VERSION__ < 202311 +# define static_assert(cond) extern int static_assert_check[(cond) ? 1 : -1] +#endif + /* ** zdump has been made independent of the rest of the time ** conversion package to increase confidence in the verification it provides. @@ -52,19 +69,19 @@ # define HAVE_DECL_ASCTIME_R 1 #endif -#if !defined HAVE_GENERIC && defined __has_extension +#if !defined HAVE__GENERIC && defined __has_extension # if __has_extension(c_generic_selections) -# define HAVE_GENERIC 1 +# define HAVE__GENERIC 1 # else -# define HAVE_GENERIC 0 +# define HAVE__GENERIC 0 # endif #endif /* _Generic is buggy in pre-4.9 GCC. */ -#if !defined HAVE_GENERIC && defined __GNUC__ && !defined __STRICT_ANSI__ -# define HAVE_GENERIC (4 < __GNUC__ + (9 <= __GNUC_MINOR__)) +#if !defined HAVE__GENERIC && defined __GNUC__ && !defined __STRICT_ANSI__ +# define HAVE__GENERIC (4 < __GNUC__ + (9 <= __GNUC_MINOR__)) #endif -#ifndef HAVE_GENERIC -# define HAVE_GENERIC (201112 <= __STDC_VERSION__) +#ifndef HAVE__GENERIC +# define HAVE__GENERIC (201112 <= __STDC_VERSION__) #endif #if !defined HAVE_GETTEXT && defined __has_include @@ -100,10 +117,6 @@ # define HAVE_STRDUP 1 #endif -#ifndef HAVE_STRTOLL -# define HAVE_STRTOLL 1 -#endif - #ifndef HAVE_SYMLINK # define HAVE_SYMLINK 1 #endif /* !defined HAVE_SYMLINK */ @@ -185,6 +198,9 @@ #include #include +#if !PORT_TO_C89 +# include +#endif #include /* for CHAR_BIT et al. */ #include @@ -254,10 +270,12 @@ # define R_OK 4 #endif /* !defined R_OK */ +#if PORT_TO_C89 + /* ** Define HAVE_STDINT_H's default value here, rather than at the ** start, since __GLIBC__ and INTMAX_MAX's values depend on -** previously-included files. glibc 2.1 and Solaris 10 and later have +** previously included files. glibc 2.1 and Solaris 10 and later have ** stdint.h, even with pre-C99 compilers. */ #if !defined HAVE_STDINT_H && defined __has_include @@ -334,6 +352,9 @@ typedef int int_fast32_t; #ifndef INTMAX_MAX # ifdef LLONG_MAX typedef long long intmax_t; +# ifndef HAVE_STRTOLL +# define HAVE_STRTOLL true +# endif # if HAVE_STRTOLL # define strtoimax strtoll # endif @@ -379,8 +400,10 @@ typedef unsigned long long uint_fast64_t; #ifndef UINTMAX_MAX # ifdef ULLONG_MAX typedef unsigned long long uintmax_t; +# define UINTMAX_MAX ULLONG_MAX # else typedef unsigned long uintmax_t; +# define UINTMAX_MAX ULONG_MAX # endif #endif @@ -396,6 +419,16 @@ typedef unsigned long uintmax_t; # define SIZE_MAX ((size_t) -1) #endif +#endif /* PORT_TO_C89 */ + +/* The maximum size of any created object, as a signed integer. + Although the C standard does not outright prohibit larger objects, + behavior is undefined if the result of pointer subtraction does not + fit into ptrdiff_t, and the code assumes in several places that + pointer subtraction works. As a practical matter it's OK to not + support objects larger than this. */ +#define INDEX_MAX ((ptrdiff_t) min(PTRDIFF_MAX, SIZE_MAX)) + /* Support ckd_add, ckd_sub, ckd_mul on C23 or recent-enough GCC-like hosts, unless compiled with -DHAVE_STDCKDINT_H=0 or with pre-C23 EDG. */ #if !defined HAVE_STDCKDINT_H && defined __has_include @@ -435,12 +468,25 @@ typedef unsigned long uintmax_t; #if (defined __has_c_attribute \ && (202311 <= __STDC_VERSION__ || !defined __STRICT_ANSI__)) -# define HAVE_HAS_C_ATTRIBUTE true +# define HAVE___HAS_C_ATTRIBUTE true #else -# define HAVE_HAS_C_ATTRIBUTE false +# define HAVE___HAS_C_ATTRIBUTE false #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute(deprecated) +# define ATTRIBUTE_DEPRECATED [[deprecated]] +# endif +#endif +#ifndef ATTRIBUTE_DEPRECATED +# if 3 < __GNUC__ + (2 <= __GNUC_MINOR__) +# define ATTRIBUTE_DEPRECATED __attribute__((deprecated)) +# else +# define ATTRIBUTE_DEPRECATED /* empty */ +# endif +#endif + +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(fallthrough) # define ATTRIBUTE_FALLTHROUGH [[fallthrough]] # endif @@ -453,7 +499,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(maybe_unused) # define ATTRIBUTE_MAYBE_UNUSED [[maybe_unused]] # endif @@ -466,7 +512,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(noreturn) # define ATTRIBUTE_NORETURN [[noreturn]] # endif @@ -481,7 +527,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(reproducible) # define ATTRIBUTE_REPRODUCIBLE [[reproducible]] # endif @@ -494,7 +540,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(unsequenced) # define ATTRIBUTE_UNSEQUENCED [[unsequenced]] # endif @@ -507,7 +553,8 @@ typedef unsigned long uintmax_t; # endif #endif -#if __STDC_VERSION__ < 199901 && !defined restrict +#if (__STDC_VERSION__ < 199901 && !defined restrict \ + && (PORT_TO_C89 || defined _MSC_VER)) # define restrict /* empty */ #endif @@ -624,11 +671,16 @@ typedef time_tz tz_time_t; # define altzone tz_altzone # endif -char *asctime(struct tm const *); +# if __STDC_VERSION__ < 202311 +# define DEPRECATED_IN_C23 /* empty */ +# else +# define DEPRECATED_IN_C23 ATTRIBUTE_DEPRECATED +# endif +DEPRECATED_IN_C23 char *asctime(struct tm const *); char *asctime_r(struct tm const *restrict, char *restrict); -char *ctime(time_t const *); +DEPRECATED_IN_C23 char *ctime(time_t const *); char *ctime_r(time_t const *, char *); -double difftime(time_t, time_t) ATTRIBUTE_UNSEQUENCED; +ATTRIBUTE_UNSEQUENCED double difftime(time_t, time_t); size_t strftime(char *restrict, size_t, char const *restrict, struct tm const *restrict); # if HAVE_STRFTIME_L @@ -691,7 +743,10 @@ extern long altzone; ** declarations if time_tz is defined. */ -#ifdef STD_INSPIRED +#ifndef STD_INSPIRED +# define STD_INSPIRED 0 +#endif +#if STD_INSPIRED # if TZ_TIME_T || !defined offtime struct tm *offtime(time_t const *, long); # endif @@ -738,12 +793,12 @@ struct tm *localtime_rz(timezone_t restrict, time_t const *restrict, time_t mktime_z(timezone_t restrict, struct tm *restrict); timezone_t tzalloc(char const *); void tzfree(timezone_t); -# ifdef STD_INSPIRED +# if STD_INSPIRED # if TZ_TIME_T || !defined posix2time_z -time_t posix2time_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; +ATTRIBUTE_REPRODUCIBLE time_t posix2time_z(timezone_t, time_t); # endif # if TZ_TIME_T || !defined time2posix_z -time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; +ATTRIBUTE_REPRODUCIBLE time_t time2posix_z(timezone_t, time_t); # endif # endif #endif @@ -752,7 +807,7 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; ** Finally, some convenience items. */ -#define TYPE_BIT(type) (sizeof(type) * CHAR_BIT) +#define TYPE_BIT(type) (CHAR_BIT * (ptrdiff_t) sizeof(type)) #define TYPE_SIGNED(type) (((type) -1) < 0) #define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0) @@ -780,7 +835,7 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; This implementation assumes no padding if time_t is signed and either the compiler lacks support for _Generic or time_t is not one of the standard signed integer types. */ -#if HAVE_GENERIC +#if HAVE__GENERIC # define TIME_T_MIN \ _Generic((time_t) 0, \ signed char: SCHAR_MIN, short: SHRT_MIN, \ @@ -793,10 +848,23 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; int: INT_MAX, long: LONG_MAX, long long: LLONG_MAX, \ default: TIME_T_MAX_NO_PADDING) \ : (time_t) -1) +enum { SIGNED_PADDING_CHECK_NEEDED + = _Generic((time_t) 0, + signed char: false, short: false, + int: false, long: false, long long: false, + default: true) }; #else # define TIME_T_MIN TIME_T_MIN_NO_PADDING # define TIME_T_MAX TIME_T_MAX_NO_PADDING +enum { SIGNED_PADDING_CHECK_NEEDED = true }; #endif +/* Try to check the padding assumptions. Although TIME_T_MAX and the + following check can both have undefined behavior on oddball + platforms due to shifts exceeding widths of signed integers, these + platforms' compilers are likely to diagnose these issues in integer + constant expressions, so it shouldn't hurt to check statically. */ +static_assert(! TYPE_SIGNED(time_t) || ! SIGNED_PADDING_CHECK_NEEDED + || TIME_T_MAX >> (TYPE_BIT(time_t) - 2) == 1); /* ** 302 / 1000 is log10(2.0) rounded up. @@ -863,7 +931,7 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; #if HAVE_INCOMPATIBLE_CTIME_R #undef asctime_r #undef ctime_r -char *asctime_r(struct tm const *, char *); +char *asctime_r(struct tm const *restrict, char *restrict); char *ctime_r(time_t const *, char *); #endif /* HAVE_INCOMPATIBLE_CTIME_R */ diff --git a/tz/southamerica b/tz/southamerica index 87b71d5..e55c5f0 100644 --- a/tz/southamerica +++ b/tz/southamerica @@ -208,7 +208,7 @@ Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 - # Hora de verano para la República Argentina # http://buenasiembra.com.ar/esoterismo/astrologia/hora-de-verano-de-la-republica-argentina-27.html # says that standard time in Argentina from 1894-10-31 -# to 1920-05-01 was -4:16:48.25. Go with this more-precise value +# to 1920-05-01 was -4:16:48.25. Go with this more precise value # over Shanks & Pottenger. It is upward compatible with Milne, who # says Córdoba time was -4:16:48.2. diff --git a/tz/strftime.c b/tz/strftime.c index b23b610..df16983 100644 --- a/tz/strftime.c +++ b/tz/strftime.c @@ -116,7 +116,8 @@ static char * _yconv(int, int, bool, bool, char *, char const *); #if HAVE_STRFTIME_L size_t -strftime_l(char *s, size_t maxsize, char const *format, struct tm const *t, +strftime_l(char *restrict s, size_t maxsize, char const *restrict format, + struct tm const *restrict t, ATTRIBUTE_MAYBE_UNUSED locale_t locale) { /* Just call strftime, as only the C locale is supported. */ @@ -125,7 +126,8 @@ strftime_l(char *s, size_t maxsize, char const *format, struct tm const *t, #endif size_t -strftime(char *s, size_t maxsize, const char *format, const struct tm *t) +strftime(char *restrict s, size_t maxsize, char const *restrict format, + struct tm const *restrict t) { char * p; int saved_errno = errno; diff --git a/tz/theory.html b/tz/theory.html index 75e347f..369c754 100644 --- a/tz/theory.html +++ b/tz/theory.html @@ -23,7 +23,7 @@

Outline

  • Interface stability
  • Leap seconds
  • Calendrical issues
  • -
  • Time and time zones on other planets
  • +
  • Time and time zones off earth
  • @@ -443,11 +443,11 @@

    Time zone abbreviations

    CAT/CAST Central Africa, CET/CEST/CEMT Central European, ChST Chamorro, - CST/CDT/CWT/CPT/CDDT Central [North America], + CST/CDT/CWT/CPT Central [North America], CST/CDT China, GMT/BST/IST/BDST Greenwich, EAT East Africa, - EST/EDT/EWT/EPT/EDDT Eastern [North America], + EST/EDT/EWT/EPT Eastern [North America], EET/EEST Eastern European, GST/GDT Guam, HST/HDT/HWT/HPT Hawaii, @@ -460,13 +460,13 @@

    Time zone abbreviations

    MET/MEST Middle European (a backward-compatibility alias for Central European), MSK/MSD Moscow, - MST/MDT/MWT/MPT/MDDT Mountain, + MST/MDT/MWT/MPT Mountain, NST/NDT/NWT/NPT/NDDT Newfoundland, NST/NDT/NWT/NPT Nome, NZMT/NZST New Zealand through 1945, NZST/NZDT New Zealand 1946–present, PKT/PKST Pakistan, - PST/PDT/PWT/PPT/PDDT Pacific, + PST/PDT/PWT/PPT Pacific, PST/PDT Philippine, SAST South Africa, SST Samoa, @@ -494,7 +494,7 @@

    Time zone abbreviations

    These abbreviations are: AMT Asunción, Athens; - BMT Baghdad, Bangkok, Batavia, Bermuda, Bern, Bogotá, Bridgetown, + BMT Baghdad, Bangkok, Batavia, Bermuda, Bern, Bogotá, Brussels, Bucharest; CMT Calamarca, Caracas, Chisinau, Colón, Córdoba; DMT Dublin/Dunsink; @@ -506,12 +506,13 @@

    Time zone abbreviations

    IMT Irkutsk, Istanbul; JMT Jerusalem; KMT Kaunas, Kyiv, Kingston; - LMT Lima, Lisbon, local, Luanda; + LMT Lima, Lisbon, local; MMT Macassar, Madras, Malé, Managua, Minsk, Monrovia, Montevideo, Moratuwa, Moscow; PLMT Phù Liễn; PMT Paramaribo, Paris, Perm, Pontianak, Prague; PMMT Port Moresby; + PPMT Port-au-Prince; QMT Quito; RMT Rangoon, Riga, Rome; SDMT Santo Domingo; @@ -519,8 +520,7 @@

    Time zone abbreviations

    SMT Santiago, Simferopol, Singapore, Stanley; TBMT Tbilisi; TMT Tallinn, Tehran; - WMT Warsaw; - ZMT Zomba.
    + WMT Warsaw.

    @@ -791,7 +791,7 @@

    Accuracy of the tz database

    with days starting at midnight. Although UT equals UTC for modern timestamps, UTC was not defined until 1960, so - commentary uses the more-general abbreviation UT for + commentary uses the more general abbreviation UT for timestamps that might predate 1960. Since UT, UT1, etc. disagree slightly, and since pre-1972 UTC seconds varied in length, @@ -818,7 +818,8 @@

    Accuracy of the tz database

  • The relationship between POSIX time (that is, UTC but ignoring leap - seconds) and UTC is not agreed upon after 1972. + seconds) and UTC is not agreed upon. + This affects time stamps during the leap second era (1972–2035). Although the POSIX clock officially stops during an inserted leap second, at least one proposed standard has it jumping back a second instead; and in @@ -877,7 +878,7 @@

    POSIX properties and limitations

    is error-prone in practice. Also, POSIX TZ strings cannot deal with daylight saving time rules not based on the Gregorian calendar (as in - Iran), or with situations where more than two time zone + Morocco), or with situations where more than two time zone abbreviations or UT offsets are used in an area.

    @@ -913,8 +914,8 @@

    POSIX properties and limitations

    date[/time],date[/time]
    specifies the beginning and end of DST. If this is absent, the system supplies its own ruleset - for DST, and its rules can differ from year to year; - typically US DST rules are used. + for DST, typically current US + DST rules.
    time
    takes the form @@ -974,10 +975,11 @@

    POSIX properties and limitations

    Traditionally the current US DST rules were used to interpret such values, but this meant that the US DST rules were compiled into each - program that did time conversion. This meant that when + time conversion package, and when US time conversion rules changed (as in the United - States in 1987), all programs that did time conversion had to be - recompiled to ensure proper results. + States in 1987 and again in 2007), all packages that + interpreted TZ values had to be updated + to ensure proper results.
  • The TZ environment variable is process-global, which @@ -1173,7 +1175,7 @@

    Other portability notes

  • The functions that are conditionally compiled - if STD_INSPIRED is defined should, at this point, be + if STD_INSPIRED is nonzero should, at this point, be looked on primarily as food for thought. They are not in any sense "standard compatible" – some are not, in fact, specified in any standard. @@ -1240,7 +1242,7 @@

    Interface stability

    Interface changes in a release attempt to preserve compatibility with recent releases. For example, tz data files typically do not -rely on recently-added zic features, so that users can +rely on recently added zic features, so that users can run older zic versions to process newer data files. Downloading the tz database describes how releases @@ -1268,6 +1270,18 @@

    Interface stability

    Leap seconds

    +

    +Leap seconds were introduced in 1972 to accommodate the +difference between atomic time and the less regular rotation of the earth. +Unfortunately they caused so many problems with civil +timekeeping that they +are planned +to be discontinued by 2035, with some as-yet-undetermined +mechanism replacing them, perhaps after the year 2135. +Despite their impending obsolescence, a record of leap seconds is still +needed to resolve timestamps from 1972 through 2035. +

    +

    The tz code and data can account for leap seconds, thanks to code contributed by Bradley White. @@ -1282,12 +1296,12 @@

    Leap seconds

    NTP software that adjusts the kernel clock. However, kernel-clock twiddling approximates UTC only roughly, -and systems needing more-precise UTC can use this package's leap +and systems needing more precise UTC can use this package's leap second support directly.

    -The directly-supported mechanism assumes that time_t +The directly supported mechanism assumes that time_t counts of seconds since the POSIX epoch normally include leap seconds, as opposed to POSIX time_t counts which exclude leap seconds. This modified timescale is converted to UTC @@ -1348,7 +1362,15 @@

    Calendrical issues

    -

    Time and time zones on other planets

    +

    Time and time zones off Earth

    +

    +The European Space Agency is considering +the establishment of a reference timescale for the Moon, which has +days roughly equivalent to 29.5 Earth days, and where relativistic +effects cause clocks to tick slightly faster than on Earth. +

    +

    Some people's work schedules have used Mars time. diff --git a/tz/time2posix.3 b/tz/time2posix.3 index e13c431..f48402b 100644 --- a/tz/time2posix.3 +++ b/tz/time2posix.3 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 1996-06-05 by Arthur David Olson. -.TH time2posix 3 +.TH time2posix 3 "" "Time Zone Database" .SH NAME time2posix, posix2time \- convert seconds since the Epoch .SH SYNOPSIS diff --git a/tz/tz-how-to.html b/tz/tz-how-to.html index e1e28f2..9e438f9 100644 --- a/tz/tz-how-to.html +++ b/tz/tz-how-to.html @@ -548,8 +548,8 @@

    by Bill Seymour

    • The tz -database gives abbreviations for time zones in popular -usage, which is not necessarily “correct” by law. For +database gives abbreviations for time zones +in popular English-language usage. For example, the last line in Zone Pacific/Honolulu (shown below) gives “HST” for “Hawaii standard time” even though the @@ -567,7 +567,7 @@

      by Bill Seymour

      function in the “C” locale. -
    • If there is no generally-accepted abbreviation for a time zone, +
    • If there is no generally accepted abbreviation for a time zone, a numeric offset is used instead, e.g., +07 for 7 hours ahead of Greenwich. By convention, -00 is used in a zone while uninhabited, where the offset is zero but in some sense diff --git a/tz/tz-link.html b/tz/tz-link.html index d3b3766..3b5fe77 100644 --- a/tz/tz-link.html +++ b/tz/tz-link.html @@ -26,6 +26,7 @@

      Outline

    • The tz database
    • Downloading the tz database
    • Changes to the tz database
    • +
    • Coordinating with governments and distributors
    • Commentary on the tz database
  • @@ -169,14 +170,14 @@

    Downloading the tz database

    Since version 2022a, each release has been distributed in POSIX ustar interchange format, compressed as described above; -older releases use a nearly-compatible format. +older releases use a nearly compatible format. Since version 2016h, each release has contained a text file named "version" whose first (and currently only) line is the version. Older releases are archived, and are also available in an FTP directory via a -less-secure protocol.

    +less secure protocol.

    Alternatively, a development repository of code and data can be retrieved from GitHub via the shell command:

    @@ -215,23 +216,6 @@

    Changes to the tz database

    generated automatically.

    -If your government plans to change its time zone boundaries or -daylight saving rules, inform tz@iana.org well in -advance, as this will coordinate updates to many cell phones, -computers, and other devices around the world. -The change should be officially announced at least a year before it affects -how clocks operate; otherwise, there is a good chance that some -clocks will operate incorrectly after the change, due -to delays in propagating updates to software and data. The shorter -the notice, the more likely clock problems will arise; see "On -the Timing of Time Zone Changes" for examples. -The tz data can represent planned changes -far into the future, and a long-planned change can easily be reverted -or otherwise altered with a year's notice before the change would have -affected clocks. -

    -

    Changes to the tz code and data are often propagated to clients via operating system updates, so client tz data can often be corrected by @@ -286,6 +270,55 @@

    Changes to the tz database

    +
    +

    Coordinating with governments and distributors

    +

    +As discussed in +"How +Time Zones Are Coordinated", the time zone database relies on +collaboration among governments, the time zone database volunteer +community, and data distributors downstream. +

    +If your government plans to change its time zone boundaries or +daylight saving rules, please send email to tz@iana.org well in advance, +as this will coordinate updates to many cell phones, +computers, and other devices around the world. +In your email, please cite the legislation or regulation that specifies +the change, so that it can be checked for details such as the exact times +when clock transitions occur. +It is OK if a rule change is planned to affect clocks +far into the future, as a long-planned change can easily be reverted +or otherwise altered with a year's notice before the change would have +affected clocks.

    +

    +There is no fixed schedule for tzdb releases. +However, typically a release occurs every few months. +Many downstream timezone data distributors wait for +a tzdb release before they produce an update +to time zone behavior in consumer devices and software products. +After a release, various parties must integrate, test, +and roll out an update before end users see changes. +These updates can be expensive, for both the quality +assurance process and the overall cost of shipping and installing +updates to each device's copy of tzdb. +Updates may be batched with other updates and may take substantial +time to reach end users after a release. +Older devices may no longer be supported and thus may never be updated, +which means they will continue to use out-of-date rules.

    +

    +For these reasons any rule change should be promulgated at least a +year before it affects how clocks operate; otherwise, there is a good +chance that many clocks will operate incorrectly after the change, due +to delays in propagating updates to software and data. +The shorter the notice, the more likely clock problems will arise; see "On +the Timing of Time Zone Changes" for examples. +

    +
    +

    Commentary on the tz database

      @@ -384,7 +417,7 @@

      Other tz compilers

      from the resulting tarballs instead.

      • Vzic is a C +href="https://en.wikipedia.org/wiki/C_(programming_language)">C program that compiles tz source into iCalendar-compatible VTIMEZONE files. Vzic is freely @@ -409,7 +442,7 @@

        Other tz compilers

        transition in the tz database.
      • The Time Zone Database Parser is a -C++ parser and +C++ parser and runtime library with API adopted by @@ -419,7 +452,7 @@

        Other tz compilers

        MIT license.
      • International Components for Unicode (ICU) contains C/C++ and Java +href="https://en.wikipedia.org/wiki/Java_(programming_language)">Java libraries for internationalization that has a compiler from tz source and from CLDR data @@ -903,6 +936,10 @@

        National histories of legal time

        The Department of Internal Affairs maintains a brief History of Daylight Saving.
        +
        Palestine
        +
        The Ministry of Telecom and IT publishes a history of clock changes (in Arabic).
        Portugal
        The Lisbon Astronomical Observatory publishes a history of @@ -978,7 +1015,7 @@

        Precision timekeeping

        Science of Timekeeping
        is a thorough introduction to the theory and practice of precision timekeeping.
      • The Science of -Time 2016 contains several freely-readable papers.
      • +Time 2016 contains several freely readable papers.
      • NTP: The Network Time Protocol (Internet RFC 5905) @@ -1050,7 +1087,7 @@

        Precision timekeeping

        In practice the two configurations also agree for timestamps before 1972 even though the historical situation is messy, partly because neither UTC nor TAI -is well-defined for sufficiently-old timestamps.
      • +is well-defined for sufficiently old timestamps.
      • Leap Smear discusses how to gradually adjust POSIX clocks near a leap second so that they disagree with UTC by at most a @@ -1078,8 +1115,12 @@

        Precision timekeeping

        UTC might be redefined without Leap Seconds gives pointers on this -contentious issue, which was active until 2015 and could become active -again.
      • +contentious issue. +The General Conference on Weights and Measures +voted in 2022 +to discontinue the use of leap seconds by 2035, replacing them with an +as-yet-undetermined scheme some time after the year 2135. +
    diff --git a/tz/tzfile.5 b/tz/tzfile.5 index c3e86c6..59d9f6b 100644 --- a/tz/tzfile.5 +++ b/tz/tzfile.5 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 1996-06-05 by Arthur David Olson. -.TH TZFILE 5 +.TH tzfile 5 "" "Time Zone Database" .SH NAME tzfile \- timezone information .SH DESCRIPTION @@ -220,7 +220,7 @@ if there is no POSIX-style representation for such instants. If nonempty, the POSIX-style TZ string must agree with the local time type after the last transition time if present in the eight-byte data; for example, given the string -.q "WET0WEST,M3.5.0,M10.5.0/3" +.q "WET0WEST,M3.5.0/1,M10.5.0" then if a last transition time is in July, the transition's local time type must specify a daylight-saving time abbreviated .q "WEST" diff --git a/tz/tzfile.h b/tz/tzfile.h index 6b18d6b..9cbdcff 100644 --- a/tz/tzfile.h +++ b/tz/tzfile.h @@ -103,20 +103,24 @@ struct tzhead { */ #ifndef TZ_MAX_TIMES +/* This must be at least 242 for Europe/London with 'zic -b fat'. */ # define TZ_MAX_TIMES 2000 #endif /* !defined TZ_MAX_TIMES */ #ifndef TZ_MAX_TYPES -/* This must be at least 17 for Europe/Samara and Europe/Vilnius. */ +/* This must be at least 18 for Europe/Vilnius with 'zic -b fat'. */ # define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ #endif /* !defined TZ_MAX_TYPES */ #ifndef TZ_MAX_CHARS +/* This must be at least 40 for America/Anchorage. */ # define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ /* (limited by what unsigned chars can hold) */ #endif /* !defined TZ_MAX_CHARS */ #ifndef TZ_MAX_LEAPS +/* This must be at least 27 for leap seconds from 1972 through mid-2023. + There's a plan to discontinue leap seconds by 2035. */ # define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ #endif /* !defined TZ_MAX_LEAPS */ diff --git a/tz/tzselect.8 b/tz/tzselect.8 index 846b867..4578090 100644 --- a/tz/tzselect.8 +++ b/tz/tzselect.8 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 2009-05-17 by Arthur David Olson. -.TH TZSELECT 8 +.TH tzselect 8 "" "Time Zone Database" .SH NAME tzselect \- select a timezone .SH SYNOPSIS diff --git a/tz/tzselect.ksh b/tz/tzselect.ksh index 28c32a2..9a91acf 100644 --- a/tz/tzselect.ksh +++ b/tz/tzselect.ksh @@ -39,7 +39,7 @@ REPORT_BUGS_TO=tz@iana.org : ${AWK=awk} : ${TZDIR=`pwd`} -# Output one argument as-is to standard output. +# Output one argument as-is to standard output, with trailing newline. # Safer than 'echo', which can mishandle '\' or leading '-'. say() { printf '%s\n' "$1" @@ -82,8 +82,8 @@ Report bugs to $REPORT_BUGS_TO." # Ask the user to select from the function's arguments, # and assign the selected argument to the variable 'select_result'. -# Exit on EOF or I/O error. Use the shell's 'select' builtin if available, -# falling back on a less-nice but portable substitute otherwise. +# Exit on EOF or I/O error. Use the shell's nicer 'select' builtin if +# available, falling back on a portable substitute otherwise. if case $BASH_VERSION in ?*) : ;; @@ -197,16 +197,65 @@ newline=' ' IFS=$newline +# Awk script to output a country list. +output_country_list=' + BEGIN { FS = "\t" } + /^#$/ { next } + /^#[^@]/ { next } + { + commentary = $0 ~ /^#@/ + if (commentary) { + col1ccs = substr($1, 3) + conts = $2 + } else { + col1ccs = $1 + conts = $3 + } + ncc = split(col1ccs, cc, /,/) + ncont = split(conts, cont, /,/) + for (i = 1; i <= ncc; i++) { + elsewhere = commentary + for (ci = 1; ci <= ncont; ci++) { + if (cont[ci] ~ continent_re) { + if (!cc_seen[cc[i]]++) cc_list[++ccs] = cc[i] + elsewhere = 0 + } + } + if (elsewhere) { + for (i = 1; i <= ncc; i++) { + cc_elsewhere[cc[i]] = 1 + } + } + } + } + END { + while (getline &2 'Please select a continent, ocean, "coord", or "TZ".' + echo >&2 'Please select a continent, ocean, "coord", "TZ", or "time".' quoted_continents=` $AWK ' @@ -331,7 +397,8 @@ while eval ' doselect '"$quoted_continents"' \ "coord - I want to use geographical coordinates." \ - "TZ - I want to specify the timezone using the Posix TZ format." + "TZ - I want to specify the timezone using the Posix TZ format." \ + "time - I know local time already." continent=$select_result case $continent in Americas) continent=America;; @@ -384,74 +451,99 @@ while distance_table=`$AWK \ -v coord="$coord" \ -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ - "$output_distances" <"$TZ_ZONE_TABLE" | + "$output_distances_or_times" <"$TZ_ZONE_TABLE" | sort -n | sed "${location_limit}q" ` - regions=`say "$distance_table" | $AWK ' - BEGIN { FS = "\t" } - { print $NF } + regions=`$AWK \ + -v distance_table="$distance_table" ' + BEGIN { + nlines = split(distance_table, line, /\n/) + for (nr = 1; nr <= nlines; nr++) { + nf = split(line[nr], f, /\t/) + print f[nf] + } + } '` - echo >&2 'Please select one of the following timezones,' \ + echo >&2 'Please select one of the following timezones,' echo >&2 'listed roughly in increasing order' \ "of distance from $coord". doselect $regions region=$select_result - TZ=`say "$distance_table" | $AWK -v region="$region" ' - BEGIN { FS="\t" } - $NF == region { print $4 } + TZ=`$AWK \ + -v distance_table="$distance_table" \ + -v region="$region" ' + BEGIN { + nlines = split(distance_table, line, /\n/) + for (nr = 1; nr <= nlines; nr++) { + nf = split(line[nr], f, /\t/) + if (f[nf] == region) { + print f[4] + } + } + } '` ;; *) - # Get list of names of countries in the continent or ocean. - countries=`$AWK \ + case $continent in + time) + minute_format='%a %b %d %H:%M' + old_minute=`TZ=UTC0 date +"$minute_format"` + for i in 1 2 3 + do + time_table_command=` + $AWK -v output_times=1 \ + "$output_distances_or_times" <"$TZ_ZONE_TABLE" + ` + time_table=`eval "$time_table_command"` + new_minute=`TZ=UTC0 date +"$minute_format"` + case $old_minute in + "$new_minute") break;; + esac + old_minute=$new_minute + done + echo >&2 "The system says Universal Time is $new_minute." + echo >&2 "Assuming that's correct, what is the local time?" + eval doselect ` + say "$time_table" | + sort -k2n -k2,5 -k1n | + $AWK '{ + line = $6 " " $7 " " $4 " " $5 + if (line == oldline) next + oldline = line + gsub(/'\''/, "&\\\\&&", line) + printf "'\''%s'\''\n", line + }' + ` + time=$select_result + zone_table=` + say "$time_table" | + $AWK -v time="$time" '{ + if ($6 " " $7 " " $4 " " $5 == time) { + sub(/[^\t]*\t/, "") + print + } + }' + ` + countries=` + say "$zone_table" | + $AWK \ + -v continent_re='' \ + -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ + "$output_country_list" | + sort -f + ` + ;; + *) + zone_table=file + # Get list of names of countries in the continent or ocean. + countries=`$AWK \ -v continent_re="^$continent/" \ -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ - ' - BEGIN { FS = "\t" } - /^#$/ { next } - /^#[^@]/ { next } - { - commentary = $0 ~ /^#@/ - if (commentary) { - col1ccs = substr($1, 3) - conts = $2 - } else { - col1ccs = $1 - conts = $3 - } - ncc = split(col1ccs, cc, /,/) - ncont = split(conts, cont, /,/) - for (i = 1; i <= ncc; i++) { - elsewhere = commentary - for (ci = 1; ci <= ncont; ci++) { - if (cont[ci] ~ continent_re) { - if (!cc_seen[cc[i]]++) cc_list[++ccs] = cc[i] - elsewhere = 0 - } - } - if (elsewhere) { - for (i = 1; i <= ncc; i++) { - cc_elsewhere[cc[i]] = 1 - } - } - } - } - END { - while (getline &2 'Please select a country' \ 'whose clocks agree with yours.' doselect $countries + country_result=$select_result country=$select_result;; *) country=$countries @@ -466,10 +559,15 @@ while # Get list of timezones in the country. - regions=`$AWK \ + regions=` + case $zone_table in + file) cat -- "$TZ_ZONE_TABLE";; + *) say "$zone_table";; + esac | + $AWK \ -v country="$country" \ -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ - ' + ' BEGIN { FS = "\t" cc = country @@ -482,7 +580,8 @@ while } /^#/ { next } $1 ~ cc { print $4 } - ' <"$TZ_ZONE_TABLE"` + ' + ` # If there's more than one region, ask the user which one. @@ -490,17 +589,20 @@ while *"$newline"*) echo >&2 'Please select one of the following timezones.' doselect $regions - region=$select_result;; - *) - region=$regions + region=$select_result esac # Determine TZ from country and region. - TZ=`$AWK \ + TZ=` + case $zone_table in + file) cat -- "$TZ_ZONE_TABLE";; + *) say "$zone_table";; + esac | + $AWK \ -v country="$country" \ -v region="$region" \ -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ - ' + ' BEGIN { FS = "\t" cc = country @@ -512,8 +614,9 @@ while } } /^#/ { next } - $1 ~ cc && $4 == region { print $3 } - ' <"$TZ_ZONE_TABLE"` + $1 ~ cc && ($4 == region || !region) { print $3 } + ' + `;; esac # Make sure the corresponding zoneinfo file exists. @@ -549,17 +652,21 @@ Universal Time is now: $UTdate." # Output TZ info and ask the user to confirm. echo >&2 "" - echo >&2 "The following information has been given:" + echo >&2 "Based on the following information:" echo >&2 "" - case $country%$region%$coord in - ?*%?*%) say >&2 " $country$newline $region";; - ?*%%) say >&2 " $country";; - %?*%?*) say >&2 " coord $coord$newline $region";; - %%?*) say >&2 " coord $coord";; + case $time%$country_result%$region%$coord in + ?*%?*%?*%) + say >&2 " $time$newline $country_result$newline $region";; + ?*%?*%%|?*%%?*%) say >&2 " $time$newline $country_result$region";; + ?*%%%) say >&2 " $time";; + %?*%?*%) say >&2 " $country_result$newline $region";; + %?*%%) say >&2 " $country_result";; + %%?*%?*) say >&2 " coord $coord$newline $region";; + %%%?*) say >&2 " coord $coord";; *) say >&2 " TZ='$TZ'" esac say >&2 "" - say >&2 "Therefore TZ='$TZ' will be used.$extra_info" + say >&2 "TZ='$TZ' will be used.$extra_info" say >&2 "Is the above information OK?" doselect Yes No diff --git a/tz/zdump.8 b/tz/zdump.8 index 170e18d..f77c0c7 100644 --- a/tz/zdump.8 +++ b/tz/zdump.8 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 2009-05-17 by Arthur David Olson. -.TH zdump 8 +.TH zdump 8 "" "Time Zone Database" .SH NAME zdump \- timezone dumper .SH SYNOPSIS diff --git a/tz/zdump.c b/tz/zdump.c index 7acb3e2..6f9573e 100644 --- a/tz/zdump.c +++ b/tz/zdump.c @@ -15,7 +15,7 @@ #include #ifndef HAVE_SNPRINTF -# define HAVE_SNPRINTF (199901 <= __STDC_VERSION__) +# define HAVE_SNPRINTF (!PORT_TO_C89 || 199901 <= __STDC_VERSION__) #endif #ifndef HAVE_LOCALTIME_R @@ -89,7 +89,7 @@ static bool warned; static bool errout; static char const *abbr(struct tm const *); -static intmax_t delta(struct tm *, struct tm *) ATTRIBUTE_REPRODUCIBLE; +ATTRIBUTE_REPRODUCIBLE static intmax_t delta(struct tm *, struct tm *); static void dumptime(struct tm const *); static time_t hunt(timezone_t, time_t, time_t, bool); static void show(timezone_t, char *, time_t, bool); @@ -97,7 +97,7 @@ static void showextrema(timezone_t, char *, time_t, struct tm *, time_t); static void showtrans(char const *, struct tm const *, time_t, char const *, char const *); static const char *tformat(void); -static time_t yeartot(intmax_t) ATTRIBUTE_REPRODUCIBLE; +ATTRIBUTE_REPRODUCIBLE static time_t yeartot(intmax_t); /* Is C an ASCII digit? */ static bool @@ -125,7 +125,7 @@ is_alpha(char a) } } -static ATTRIBUTE_NORETURN void +ATTRIBUTE_NORETURN static void size_overflow(void) { fprintf(stderr, _("%s: size overflow\n"), progname); @@ -133,26 +133,37 @@ size_overflow(void) } /* Return A + B, exiting if the result would overflow either ptrdiff_t - or size_t. */ -static ATTRIBUTE_REPRODUCIBLE ptrdiff_t -sumsize(size_t a, size_t b) + or size_t. A and B are both nonnegative. */ +ATTRIBUTE_REPRODUCIBLE static ptrdiff_t +sumsize(ptrdiff_t a, ptrdiff_t b) { #ifdef ckd_add ptrdiff_t sum; - if (!ckd_add(&sum, a, b) && sum <= SIZE_MAX) + if (!ckd_add(&sum, a, b) && sum <= INDEX_MAX) return sum; #else - ptrdiff_t sum_max = min(PTRDIFF_MAX, SIZE_MAX); - if (a <= sum_max && b <= sum_max - a) + if (a <= INDEX_MAX && b <= INDEX_MAX - a) return a + b; #endif size_overflow(); } +/* Return the size of of the string STR, including its trailing NUL. + Report an error and exit if this would exceed INDEX_MAX which means + pointer subtraction wouldn't work. */ +static ptrdiff_t +xstrsize(char const *str) +{ + size_t len = strlen(str); + if (len < INDEX_MAX) + return len + 1; + size_overflow(); +} + /* Return a pointer to a newly allocated buffer of size SIZE, exiting - on failure. SIZE should be nonzero. */ -static void * ATTRIBUTE_MALLOC -xmalloc(size_t size) + on failure. SIZE should be positive. */ +ATTRIBUTE_MALLOC static void * +xmalloc(ptrdiff_t size) { void *p = malloc(size); if (!p) { @@ -217,7 +228,7 @@ localtime_r(time_t *tp, struct tm *tmp) # undef localtime_rz # define localtime_rz zdump_localtime_rz static struct tm * -localtime_rz(timezone_t rz, time_t *tp, struct tm *tmp) +localtime_rz(ATTRIBUTE_MAYBE_UNUSED timezone_t rz, time_t *tp, struct tm *tmp) { return localtime_r(tp, tmp); } @@ -242,7 +253,8 @@ tzalloc(char const *val) { # if HAVE_SETENV if (setenv("TZ", val, 1) != 0) { - perror("setenv"); + char const *e = strerror(errno); + fprintf(stderr, _("%s: setenv: %s\n"), progname, e); exit(EXIT_FAILURE); } tzset(); @@ -254,18 +266,18 @@ tzalloc(char const *val) static ptrdiff_t fakeenv0size; void *freeable = NULL; char **env = fakeenv, **initial_environ; - size_t valsize = strlen(val) + 1; + ptrdiff_t valsize = xstrsize(val); if (fakeenv0size < valsize) { char **e = environ, **to; ptrdiff_t initial_nenvptrs = 1; /* Counting the trailing NULL pointer. */ while (*e++) { # ifdef ckd_add - if (ckd_add(&initial_nenvptrs, initial_envptrs, 1) - || SIZE_MAX < initial_envptrs) + if (ckd_add(&initial_nenvptrs, initial_nenvptrs, 1) + || INDEX_MAX < initial_nenvptrs) size_overflow(); # else - if (initial_nenvptrs == min(PTRDIFF_MAX, SIZE_MAX) / sizeof *environ) + if (initial_nenvptrs == INDEX_MAX / sizeof *environ) size_overflow(); initial_nenvptrs++; # endif @@ -292,7 +304,7 @@ tzalloc(char const *val) } static void -tzfree(timezone_t initial_environ) +tzfree(ATTRIBUTE_MAYBE_UNUSED timezone_t initial_environ) { # if !HAVE_SETENV environ = initial_environ; @@ -314,14 +326,16 @@ gmtzinit(void) "Link GMT GMT0" line in the "backward" file, and which should work on all POSIX platforms. The rest of zdump does not use the "GMT" abbreviation that comes from this setting, so it - is OK to use "GMT" here rather than the more-modern "UTC" which + is OK to use "GMT" here rather than the modern "UTC" which would not work on platforms that omit the "backward" file. */ gmtz = tzalloc("GMT"); if (!gmtz) { static char const gmt0[] = "GMT0"; gmtz = tzalloc(gmt0); if (!gmtz) { - perror(gmt0); + char const *e = strerror(errno); + fprintf(stderr, _("%s: unknown timezone '%s': %s\n"), + progname, gmt0, e); exit(EXIT_FAILURE); } } @@ -401,7 +415,7 @@ abbrok(const char *const abbrp, const char *const zone) /* Return a time zone abbreviation. If the abbreviation needs to be saved, use *BUF (of size *BUFALLOC) to save it, and return the - abbreviation in the possibly-reallocated *BUF. Otherwise, just + abbreviation in the possibly reallocated *BUF. Otherwise, just return the abbreviation. Get the abbreviation from TMP. Exit on memory allocation failure. */ static char const * @@ -411,13 +425,13 @@ saveabbr(char **buf, ptrdiff_t *bufalloc, struct tm const *tmp) if (HAVE_LOCALTIME_RZ) return ab; else { - size_t ablen = strlen(ab); - if (*bufalloc <= ablen) { + ptrdiff_t absize = xstrsize(ab); + if (*bufalloc < absize) { free(*buf); /* Make the new buffer at least twice as long as the old, to avoid O(N**2) behavior on repeated calls. */ - *bufalloc = sumsize(*bufalloc, ablen + 1); + *bufalloc = sumsize(*bufalloc, absize); *buf = xmalloc(*bufalloc); } @@ -586,7 +600,9 @@ main(int argc, char *argv[]) struct tm tm, newtm; bool tm_ok; if (!tz) { - perror(argv[i]); + char const *e = strerror(errno); + fprintf(stderr, _("%s: unknown timezone '%s': %s\n"), + progname, argv[1], e); return EXIT_FAILURE; } if (now) { @@ -732,13 +748,9 @@ hunt(timezone_t tz, time_t lot, time_t hit, bool only_ok) for ( ; ; ) { /* T = average of LOT and HIT, rounding down. - Avoid overflow, even on oddball C89 platforms - where / rounds down and TIME_T_MIN == -TIME_T_MAX - so lot / 2 + hit / 2 might overflow. */ - time_t t = (lot / 2 - - ((lot % 2 + hit % 2) < 0) - + ((lot % 2 + hit % 2) == 2) - + hit / 2); + Avoid overflow. */ + int rem_sum = lot % 2 + hit % 2; + time_t t = (rem_sum == 2) - (rem_sum < 0) + lot / 2 + hit / 2; if (t == lot) break; tm_ok = my_localtime_rz(tz, &t, &tm) != NULL; @@ -920,7 +932,7 @@ showextrema(timezone_t tz, char *zone, time_t lo, struct tm *lotmp, time_t hi) # include /* A substitute for snprintf that is good enough for zdump. */ -static int ATTRIBUTE_FORMAT((printf, 3, 4)) +ATTRIBUTE_FORMAT((printf, 3, 4)) static int my_snprintf(char *s, size_t size, char const *format, ...) { int n; @@ -1173,7 +1185,7 @@ abbr(struct tm const *tmp) static const char * tformat(void) { -#if HAVE_GENERIC +#if HAVE__GENERIC /* C11-style _Generic is more likely to return the correct format when distinct types have the same size. */ char const *fmt = diff --git a/tz/zic.8 b/tz/zic.8 index 019a289..c467efe 100644 --- a/tz/zic.8 +++ b/tz/zic.8 @@ -1,6 +1,6 @@ .\" This file is in the public domain, so clarified as of .\" 2009-05-17 by Arthur David Olson. -.TH zic 8 +.TH zic 8 "" "Time Zone Database" .SH NAME zic \- timezone compiler .SH SYNOPSIS @@ -121,7 +121,10 @@ will act as if the input contained a link line of the form .ti +.5i Link \fItimezone\fP posixrules .sp -This feature is obsolete and poorly supported. +Unless +.I timezone is +.q "\*-" , +this option is obsolete and poorly supported. Among other things it should not be used for timestamps after the year 2037, and it should not be combined with .B "\*-b slim" @@ -145,7 +148,7 @@ to timestamps in the range from .I lo and .I hi -are possibly-signed decimal counts of seconds since the Epoch +are possibly signed decimal counts of seconds since the Epoch (1970-01-01 00:00:00 UTC). Omitted counts default to extreme values. The output files use UT offset 0 and abbreviation @@ -242,10 +245,10 @@ for .PP The output file does not contain all the information about the long-term future of a timezone, because the future cannot be summarized as -an extended POSIX TZ string. For example, as of 2019 this problem -occurs for Iran's daylight-saving rules for the predicted future, as -these rules are based on the Iranian calendar, which cannot be -represented. +an extended POSIX TZ string. For example, as of 2023 this problem +occurs for Morocco's daylight-saving rules, as these rules are based +on predictions for when Ramadan will be observed, something that +an extended POSIX TZ string cannot represent. .PP The output contains data that may not be handled properly by client code designed for older diff --git a/tz/zic.c b/tz/zic.c index 892414a..5518051 100644 --- a/tz/zic.c +++ b/tz/zic.c @@ -66,8 +66,10 @@ enum { FORMAT_LEN_GROWTH_BOUND = 5 }; # define MKDIR_UMASK 0755 #endif -/* The minimum alignment of a type, for pre-C23 platforms. */ -#if __STDC_VERSION__ < 201112 +/* The minimum alignment of a type, for pre-C23 platforms. + The __SUNPRO_C test is because Oracle Developer Studio 12.6 lacks + even though __STDC_VERSION__ == 201112. */ +#if __STDC_VERSION__ < 201112 || defined __SUNPRO_C # define alignof(type) offsetof(struct { char a; type b; }, b) #elif __STDC_VERSION__ < 202311 # include @@ -459,50 +461,49 @@ static char roll[TZ_MAX_LEAPS]; ** Memory allocation. */ -static ATTRIBUTE_NORETURN void +ATTRIBUTE_NORETURN static void memory_exhausted(const char *msg) { fprintf(stderr, _("%s: Memory exhausted: %s\n"), progname, msg); exit(EXIT_FAILURE); } -static ATTRIBUTE_NORETURN void +ATTRIBUTE_NORETURN static void size_overflow(void) { memory_exhausted(_("size overflow")); } -static ATTRIBUTE_REPRODUCIBLE ptrdiff_t +ATTRIBUTE_REPRODUCIBLE static ptrdiff_t size_sum(size_t a, size_t b) { #ifdef ckd_add ptrdiff_t sum; - if (!ckd_add(&sum, a, b) && sum <= SIZE_MAX) + if (!ckd_add(&sum, a, b) && sum <= INDEX_MAX) return sum; #else - ptrdiff_t sum_max = min(PTRDIFF_MAX, SIZE_MAX); - if (a <= sum_max && b <= sum_max - a) + if (a <= INDEX_MAX && b <= INDEX_MAX - a) return a + b; #endif size_overflow(); } -static ATTRIBUTE_REPRODUCIBLE ptrdiff_t +ATTRIBUTE_REPRODUCIBLE static ptrdiff_t size_product(ptrdiff_t nitems, ptrdiff_t itemsize) { #ifdef ckd_mul ptrdiff_t product; - if (!ckd_mul(&product, nitems, itemsize) && product <= SIZE_MAX) + if (!ckd_mul(&product, nitems, itemsize) && product <= INDEX_MAX) return product; #else - ptrdiff_t nitems_max = min(PTRDIFF_MAX, SIZE_MAX) / itemsize; + ptrdiff_t nitems_max = INDEX_MAX / itemsize; if (nitems <= nitems_max) return nitems * itemsize; #endif size_overflow(); } -static ATTRIBUTE_REPRODUCIBLE ptrdiff_t +ATTRIBUTE_REPRODUCIBLE static ptrdiff_t align_to(ptrdiff_t size, ptrdiff_t alignment) { ptrdiff_t lo_bits = alignment - 1, sum = size_sum(size, lo_bits); @@ -526,7 +527,7 @@ memcheck(void *ptr) return ptr; } -static void * ATTRIBUTE_MALLOC +ATTRIBUTE_MALLOC static void * emalloc(size_t size) { return memcheck(malloc(size)); @@ -538,7 +539,7 @@ erealloc(void *ptr, size_t size) return memcheck(realloc(ptr, size)); } -static char * ATTRIBUTE_MALLOC +ATTRIBUTE_MALLOC static char * estrdup(char const *str) { return memcheck(strdup(str)); @@ -551,11 +552,10 @@ grow_nitems_alloc(ptrdiff_t *nitems_alloc, ptrdiff_t itemsize) #if defined ckd_add && defined ckd_mul ptrdiff_t product; if (!ckd_add(nitems_alloc, *nitems_alloc, addend) - && !ckd_mul(&product, *nitems_alloc, itemsize) && product <= SIZE_MAX) + && !ckd_mul(&product, *nitems_alloc, itemsize) && product <= INDEX_MAX) return product; #else - ptrdiff_t amax = min(PTRDIFF_MAX, SIZE_MAX); - if (*nitems_alloc <= ((amax - 1) / 3 * 2) / itemsize) { + if (*nitems_alloc <= ((INDEX_MAX - 1) / 3 * 2) / itemsize) { *nitems_alloc += addend; return *nitems_alloc * itemsize; } @@ -608,7 +608,7 @@ eat(int fnum, lineno num) eats(fnum, num, 0, -1); } -static void ATTRIBUTE_FORMAT((printf, 1, 0)) +ATTRIBUTE_FORMAT((printf, 1, 0)) static void verror(const char *const string, va_list args) { /* @@ -626,7 +626,7 @@ verror(const char *const string, va_list args) fprintf(stderr, "\n"); } -static void ATTRIBUTE_FORMAT((printf, 1, 2)) +ATTRIBUTE_FORMAT((printf, 1, 2)) static void error(const char *const string, ...) { va_list args; @@ -636,7 +636,7 @@ error(const char *const string, ...) errors = true; } -static void ATTRIBUTE_FORMAT((printf, 1, 2)) +ATTRIBUTE_FORMAT((printf, 1, 2)) static void warning(const char *const string, ...) { va_list args; @@ -666,7 +666,7 @@ close_file(FILE *stream, char const *dir, char const *name, } } -static ATTRIBUTE_NORETURN void +ATTRIBUTE_NORETURN static void usage(FILE *stream, int status) { fprintf(stream, @@ -1397,7 +1397,7 @@ static char * relname(char const *target, char const *linkname) { size_t i, taillen, dir_len = 0, dotdots = 0; - ptrdiff_t dotdotetcsize, linksize = min(PTRDIFF_MAX, SIZE_MAX); + ptrdiff_t dotdotetcsize, linksize = INDEX_MAX; char const *f = target; char *result = NULL; if (*linkname == '/') { @@ -1672,8 +1672,7 @@ infile(int fnum, char const *name) wantcont = false; for (num = 1; ; ++num) { enum { bufsize_bound - = (min(INT_MAX, min(PTRDIFF_MAX, SIZE_MAX)) - / FORMAT_LEN_GROWTH_BOUND) }; + = (min(INT_MAX, INDEX_MAX) / FORMAT_LEN_GROWTH_BOUND) }; char buf[min(_POSIX2_LINE_MAX, bufsize_bound)]; int nfields; char *fields[MAX_FIELDS]; @@ -3597,7 +3596,7 @@ lowerit(char a) } /* case-insensitive equality */ -static ATTRIBUTE_REPRODUCIBLE bool +ATTRIBUTE_REPRODUCIBLE static bool ciequal(register const char *ap, register const char *bp) { while (lowerit(*ap) == lowerit(*bp++)) @@ -3606,7 +3605,7 @@ ciequal(register const char *ap, register const char *bp) return false; } -static ATTRIBUTE_REPRODUCIBLE bool +ATTRIBUTE_REPRODUCIBLE static bool itsabbr(register const char *abbr, register const char *word) { if (lowerit(*abbr) != lowerit(*word)) @@ -3622,7 +3621,7 @@ itsabbr(register const char *abbr, register const char *word) /* Return true if ABBR is an initial prefix of WORD, ignoring ASCII case. */ -static ATTRIBUTE_REPRODUCIBLE bool +ATTRIBUTE_REPRODUCIBLE static bool ciprefix(char const *abbr, char const *word) { do @@ -3725,14 +3724,14 @@ getfields(char *cp, char **array, int arrayelts) return nsubs; } -static ATTRIBUTE_NORETURN void +ATTRIBUTE_NORETURN static void time_overflow(void) { error(_("time overflow")); exit(EXIT_FAILURE); } -static ATTRIBUTE_REPRODUCIBLE zic_t +ATTRIBUTE_REPRODUCIBLE static zic_t oadd(zic_t t1, zic_t t2) { #ifdef ckd_add @@ -3746,7 +3745,7 @@ oadd(zic_t t1, zic_t t2) time_overflow(); } -static ATTRIBUTE_REPRODUCIBLE zic_t +ATTRIBUTE_REPRODUCIBLE static zic_t tadd(zic_t t1, zic_t t2) { #ifdef ckd_add diff --git a/tz/zone.tab b/tz/zone.tab index 6e5adb9..dbcb617 100644 --- a/tz/zone.tab +++ b/tz/zone.tab @@ -121,9 +121,8 @@ CA +744144-0944945 America/Resolute Central - NU (Resolute) CA +624900-0920459 America/Rankin_Inlet Central - NU (central) CA +5024-10439 America/Regina CST - SK (most areas) CA +5017-10750 America/Swift_Current CST - SK (midwest) -CA +5333-11328 America/Edmonton Mountain - AB; BC (E); SK (W) +CA +5333-11328 America/Edmonton Mountain - AB; BC (E); NT (E); SK (W) CA +690650-1050310 America/Cambridge_Bay Mountain - NU (west) -CA +6227-11421 America/Yellowknife Mountain - NT (central) CA +682059-1334300 America/Inuvik Mountain - NT (west) CA +4906-11631 America/Creston MST - BC (Creston) CA +5546-12014 America/Dawson_Creek MST - BC (Dawson Cr, Ft St John) @@ -139,7 +138,7 @@ CG -0416+01517 Africa/Brazzaville CH +4723+00832 Europe/Zurich CI +0519-00402 Africa/Abidjan CK -2114-15946 Pacific/Rarotonga -CL -3327-07040 America/Santiago Chile (most areas) +CL -3327-07040 America/Santiago most of Chile CL -5309-07055 America/Punta_Arenas Region of Magallanes CL -2709-10926 Pacific/Easter Easter Island CM +0403+00942 Africa/Douala @@ -151,10 +150,10 @@ CU +2308-08222 America/Havana CV +1455-02331 Atlantic/Cape_Verde CW +1211-06900 America/Curacao CX -1025+10543 Indian/Christmas -CY +3510+03322 Asia/Nicosia Cyprus (most areas) +CY +3510+03322 Asia/Nicosia most of Cyprus CY +3507+03357 Asia/Famagusta Northern Cyprus CZ +5005+01426 Europe/Prague -DE +5230+01322 Europe/Berlin Germany (most areas) +DE +5230+01322 Europe/Berlin most of Germany DE +4742+00841 Europe/Busingen Busingen DJ +1136+04309 Africa/Djibouti DK +5540+01235 Europe/Copenhagen @@ -187,7 +186,7 @@ GF +0456-05220 America/Cayenne GG +492717-0023210 Europe/Guernsey GH +0533-00013 Africa/Accra GI +3608-00521 Europe/Gibraltar -GL +6411-05144 America/Nuuk Greenland (most areas) +GL +6411-05144 America/Nuuk most of Greenland GL +7646-01840 America/Danmarkshavn National Park (east coast) GL +7029-02158 America/Scoresbysund Scoresbysund/Ittoqqortoormiit GL +7634-06847 America/Thule Thule/Pituffik @@ -235,7 +234,7 @@ KP +3901+12545 Asia/Pyongyang KR +3733+12658 Asia/Seoul KW +2920+04759 Asia/Kuwait KY +1918-08123 America/Cayman -KZ +4315+07657 Asia/Almaty Kazakhstan (most areas) +KZ +4315+07657 Asia/Almaty most of Kazakhstan KZ +4448+06528 Asia/Qyzylorda Qyzylorda/Kyzylorda/Kzyl-Orda KZ +5312+06337 Asia/Qostanay Qostanay/Kostanay/Kustanay KZ +5017+05710 Asia/Aqtobe Aqtobe/Aktobe @@ -259,12 +258,12 @@ MD +4700+02850 Europe/Chisinau ME +4226+01916 Europe/Podgorica MF +1804-06305 America/Marigot MG -1855+04731 Indian/Antananarivo -MH +0709+17112 Pacific/Majuro Marshall Islands (most areas) +MH +0709+17112 Pacific/Majuro most of Marshall Islands MH +0905+16720 Pacific/Kwajalein Kwajalein MK +4159+02126 Europe/Skopje ML +1239-00800 Africa/Bamako MM +1647+09610 Asia/Yangon -MN +4755+10653 Asia/Ulaanbaatar Mongolia (most areas) +MN +4755+10653 Asia/Ulaanbaatar most of Mongolia MN +4801+09139 Asia/Hovd Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan MN +4804+11430 Asia/Choibalsan Dornod, Sukhbaatar MO +221150+1133230 Asia/Macau @@ -302,7 +301,7 @@ NO +5955+01045 Europe/Oslo NP +2743+08519 Asia/Kathmandu NR -0031+16655 Pacific/Nauru NU -1901-16955 Pacific/Niue -NZ -3652+17446 Pacific/Auckland New Zealand (most areas) +NZ -3652+17446 Pacific/Auckland most of New Zealand NZ -4357-17633 Pacific/Chatham Chatham Islands OM +2336+05835 Asia/Muscat PA +0858-07932 America/Panama @@ -310,7 +309,7 @@ PE -1203-07703 America/Lima PF -1732-14934 Pacific/Tahiti Society Islands PF -0900-13930 Pacific/Marquesas Marquesas Islands PF -2308-13457 Pacific/Gambier Gambier Islands -PG -0930+14710 Pacific/Port_Moresby Papua New Guinea (most areas) +PG -0930+14710 Pacific/Port_Moresby most of Papua New Guinea PG -0613+15534 Pacific/Bougainville Bougainville PH +1435+12100 Asia/Manila PK +2452+06703 Asia/Karachi @@ -356,7 +355,7 @@ RU +4310+13156 Asia/Vladivostok MSK+07 - Amur River RU +643337+1431336 Asia/Ust-Nera MSK+07 - Oymyakonsky RU +5934+15048 Asia/Magadan MSK+08 - Magadan RU +4658+14242 Asia/Sakhalin MSK+08 - Sakhalin Island -RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E); North Kuril Is +RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E); N Kuril Is RU +5301+15839 Asia/Kamchatka MSK+09 - Kamchatka RU +6445+17729 Asia/Anadyr MSK+09 - Bering Sea RW -0157+03004 Africa/Kigali @@ -397,7 +396,7 @@ TT +1039-06131 America/Port_of_Spain TV -0831+17913 Pacific/Funafuti TW +2503+12130 Asia/Taipei TZ -0648+03917 Africa/Dar_es_Salaam -UA +5026+03031 Europe/Kyiv Ukraine (most areas) +UA +5026+03031 Europe/Kyiv most of Ukraine UG +0019+03225 Africa/Kampala UM +2813-17722 Pacific/Midway Midway Islands UM +1917+16637 Pacific/Wake Wake Island @@ -420,7 +419,7 @@ US +465042-1012439 America/North_Dakota/New_Salem Central - ND (Morton rural) US +471551-1014640 America/North_Dakota/Beulah Central - ND (Mercer) US +394421-1045903 America/Denver Mountain (most areas) US +433649-1161209 America/Boise Mountain - ID (south); OR (east) -US +332654-1120424 America/Phoenix MST - Arizona (except Navajo) +US +332654-1120424 America/Phoenix MST - AZ (except Navajo) US +340308-1181434 America/Los_Angeles Pacific US +611305-1495401 America/Anchorage Alaska (most areas) US +581807-1342511 America/Juneau Alaska - Juneau area @@ -428,7 +427,7 @@ US +571035-1351807 America/Sitka Alaska - Sitka area US +550737-1313435 America/Metlakatla Alaska - Annette Island US +593249-1394338 America/Yakutat Alaska - Yakutat US +643004-1652423 America/Nome Alaska (west) -US +515248-1763929 America/Adak Aleutian Islands +US +515248-1763929 America/Adak Alaska - western Aleutians US +211825-1575130 Pacific/Honolulu Hawaii UY -345433-0561245 America/Montevideo UZ +3940+06648 Asia/Samarkand Uzbekistan (west) diff --git a/tz/zone1970.tab b/tz/zone1970.tab index a9b36d3..1f1cecb 100644 --- a/tz/zone1970.tab +++ b/tz/zone1970.tab @@ -18,7 +18,10 @@ # Please see the theory.html file for how these names are chosen. # If multiple timezones overlap a country, each has a row in the # table, with each column 1 containing the country code. -# 4. Comments; present if and only if a country has multiple timezones. +# 4. Comments; present if and only if countries have multiple timezones, +# and useful only for those countries. For example, the comments +# for the row with countries CH,DE,LI and name Europe/Zurich +# are useful only for DE, since CH and LI have no other timezones. # # If a timezone covers multiple countries, the most-populous city is used, # and that country is listed first in column 1; any other countries @@ -34,7 +37,7 @@ #country- #codes coordinates TZ comments AD +4230+00131 Europe/Andorra -AE,OM,RE,SC,TF +2518+05518 Asia/Dubai UAE, Oman, Réunion, Seychelles, Crozet, Scattered Is +AE,OM,RE,SC,TF +2518+05518 Asia/Dubai Crozet, Scattered Is AF +3431+06912 Asia/Kabul AL +4120+01950 Europe/Tirane AM +4011+04430 Asia/Yerevan @@ -45,7 +48,7 @@ AQ -6448-06406 Antarctica/Palmer Palmer AQ -6734-06808 Antarctica/Rothera Rothera AQ -720041+0023206 Antarctica/Troll Troll AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF) -AR -3124-06411 America/Argentina/Cordoba Argentina (most areas: CB, CC, CN, ER, FM, MN, SE, SF) +AR -3124-06411 America/Argentina/Cordoba most areas: CB, CC, CN, ER, FM, MN, SE, SF AR -2447-06525 America/Argentina/Salta Salta (SA, LP, NQ, RN) AR -2411-06518 America/Argentina/Jujuy Jujuy (JY) AR -2649-06513 America/Argentina/Tucuman Tucumán (TM) @@ -56,7 +59,7 @@ AR -3253-06849 America/Argentina/Mendoza Mendoza (MZ) AR -3319-06621 America/Argentina/San_Luis San Luis (SL) AR -5138-06913 America/Argentina/Rio_Gallegos Santa Cruz (SC) AR -5448-06818 America/Argentina/Ushuaia Tierra del Fuego (TF) -AS,UM -1416-17042 Pacific/Pago_Pago Samoa, Midway +AS,UM -1416-17042 Pacific/Pago_Pago Midway AT +4813+01620 Europe/Vienna AU -3133+15905 Australia/Lord_Howe Lord Howe Island AU -5430+15857 Antarctica/Macquarie Macquarie Island @@ -101,26 +104,25 @@ CA +4439-06336 America/Halifax Atlantic - NS (most areas); PE CA +4612-05957 America/Glace_Bay Atlantic - NS (Cape Breton) CA +4606-06447 America/Moncton Atlantic - New Brunswick CA +5320-06025 America/Goose_Bay Atlantic - Labrador (most areas) -CA,BS +4339-07923 America/Toronto Eastern - ON, QC (most areas), Bahamas +CA,BS +4339-07923 America/Toronto Eastern - ON, QC (most areas) CA +6344-06828 America/Iqaluit Eastern - NU (most areas) CA +4953-09709 America/Winnipeg Central - ON (west); Manitoba CA +744144-0944945 America/Resolute Central - NU (Resolute) CA +624900-0920459 America/Rankin_Inlet Central - NU (central) CA +5024-10439 America/Regina CST - SK (most areas) CA +5017-10750 America/Swift_Current CST - SK (midwest) -CA +5333-11328 America/Edmonton Mountain - AB; BC (E); SK (W) +CA +5333-11328 America/Edmonton Mountain - AB; BC (E); NT (E); SK (W) CA +690650-1050310 America/Cambridge_Bay Mountain - NU (west) -CA +6227-11421 America/Yellowknife Mountain - NT (central) CA +682059-1334300 America/Inuvik Mountain - NT (west) CA +5546-12014 America/Dawson_Creek MST - BC (Dawson Cr, Ft St John) CA +5848-12242 America/Fort_Nelson MST - BC (Ft Nelson) CA +6043-13503 America/Whitehorse MST - Yukon (east) CA +6404-13925 America/Dawson MST - Yukon (west) CA +4916-12307 America/Vancouver Pacific - BC (most areas) -CH,DE,LI +4723+00832 Europe/Zurich Swiss time +CH,DE,LI +4723+00832 Europe/Zurich Büsingen CI,BF,GH,GM,GN,IS,ML,MR,SH,SL,SN,TG +0519-00402 Africa/Abidjan CK -2114-15946 Pacific/Rarotonga -CL -3327-07040 America/Santiago Chile (most areas) +CL -3327-07040 America/Santiago most of Chile CL -5309-07055 America/Punta_Arenas Region of Magallanes CL -2709-10926 Pacific/Easter Easter Island CN +3114+12128 Asia/Shanghai Beijing Time @@ -129,10 +131,10 @@ CO +0436-07405 America/Bogota CR +0956-08405 America/Costa_Rica CU +2308-08222 America/Havana CV +1455-02331 Atlantic/Cape_Verde -CY +3510+03322 Asia/Nicosia Cyprus (most areas) +CY +3510+03322 Asia/Nicosia most of Cyprus CY +3507+03357 Asia/Famagusta Northern Cyprus CZ,SK +5005+01426 Europe/Prague -DE,DK,NO,SE,SJ +5230+01322 Europe/Berlin Germany (most areas), Scandinavia +DE,DK,NO,SE,SJ +5230+01322 Europe/Berlin most of Germany DO +1828-06954 America/Santo_Domingo DZ +3647+00303 Africa/Algiers EC -0210-07950 America/Guayaquil Ecuador (mainland) @@ -153,7 +155,7 @@ GB,GG,IM,JE +513030-0000731 Europe/London GE +4143+04449 Asia/Tbilisi GF +0456-05220 America/Cayenne GI +3608-00521 Europe/Gibraltar -GL +6411-05144 America/Nuuk Greenland (most areas) +GL +6411-05144 America/Nuuk most of Greenland GL +7646-01840 America/Danmarkshavn National Park (east coast) GL +7029-02158 America/Scoresbysund Scoresbysund/Ittoqqortoormiit GL +7634-06847 America/Thule Thule/Pituffik @@ -183,12 +185,12 @@ JO +3157+03556 Asia/Amman JP +353916+1394441 Asia/Tokyo KE,DJ,ER,ET,KM,MG,SO,TZ,UG,YT -0117+03649 Africa/Nairobi KG +4254+07436 Asia/Bishkek -KI,MH,TV,UM,WF +0125+17300 Pacific/Tarawa Gilberts, Marshalls, Tuvalu, Wallis & Futuna, Wake +KI,MH,TV,UM,WF +0125+17300 Pacific/Tarawa Gilberts, Marshalls, Wake KI -0247-17143 Pacific/Kanton Phoenix Islands KI +0152-15720 Pacific/Kiritimati Line Islands KP +3901+12545 Asia/Pyongyang KR +3733+12658 Asia/Seoul -KZ +4315+07657 Asia/Almaty Kazakhstan (most areas) +KZ +4315+07657 Asia/Almaty most of Kazakhstan KZ +4448+06528 Asia/Qyzylorda Qyzylorda/Kyzylorda/Kzyl-Orda KZ +5312+06337 Asia/Qostanay Qostanay/Kostanay/Kustanay KZ +5017+05710 Asia/Aqtobe Aqtöbe/Aktobe @@ -205,14 +207,14 @@ MA +3339-00735 Africa/Casablanca MD +4700+02850 Europe/Chisinau MH +0905+16720 Pacific/Kwajalein Kwajalein MM,CC +1647+09610 Asia/Yangon -MN +4755+10653 Asia/Ulaanbaatar Mongolia (most areas) +MN +4755+10653 Asia/Ulaanbaatar most of Mongolia MN +4801+09139 Asia/Hovd Bayan-Ölgii, Govi-Altai, Hovd, Uvs, Zavkhan MN +4804+11430 Asia/Choibalsan Dornod, Sükhbaatar MO +221150+1133230 Asia/Macau MQ +1436-06105 America/Martinique MT +3554+01431 Europe/Malta MU -2010+05730 Indian/Mauritius -MV,TF +0410+07330 Indian/Maldives Maldives, Kerguelen, St Paul I, Amsterdam I +MV,TF +0410+07330 Indian/Maldives Kerguelen, St Paul I, Amsterdam I MX +1924-09909 America/Mexico_City Central Mexico MX +2105-08646 America/Cancun Quintana Roo MX +2058-08937 America/Merida Campeche, Yucatán @@ -225,7 +227,7 @@ MX +2313-10625 America/Mazatlan Baja California Sur, Nayarit (most areas), Sinal MX +2048-10515 America/Bahia_Banderas Bahía de Banderas MX +2904-11058 America/Hermosillo Sonora MX +3232-11701 America/Tijuana Baja California -MY,BN +0133+11020 Asia/Kuching Sabah, Sarawak, Brunei +MY,BN +0133+11020 Asia/Kuching Sabah, Sarawak MZ,BI,BW,CD,MW,RW,ZM,ZW -2558+03235 Africa/Maputo Central Africa Time NA -2234+01706 Africa/Windhoek NC -2216+16627 Pacific/Noumea @@ -237,7 +239,7 @@ NR -0031+16655 Pacific/Nauru NU -1901-16955 Pacific/Niue NZ,AQ -3652+17446 Pacific/Auckland New Zealand time NZ -4357-17633 Pacific/Chatham Chatham Islands -PA,CA,KY +0858-07932 America/Panama EST - Panama, Cayman, ON (Atikokan), NU (Coral H) +PA,CA,KY +0858-07932 America/Panama EST - ON (Atikokan), NU (Coral H) PE -1203-07703 America/Lima PF -1732-14934 Pacific/Tahiti Society Islands PF -0900-13930 Pacific/Marquesas Marquesas Islands @@ -285,13 +287,13 @@ RU +4310+13156 Asia/Vladivostok MSK+07 - Amur River RU +643337+1431336 Asia/Ust-Nera MSK+07 - Oymyakonsky RU +5934+15048 Asia/Magadan MSK+08 - Magadan RU +4658+14242 Asia/Sakhalin MSK+08 - Sakhalin Island -RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E); North Kuril Is +RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E); N Kuril Is RU +5301+15839 Asia/Kamchatka MSK+09 - Kamchatka RU +6445+17729 Asia/Anadyr MSK+09 - Bering Sea -SA,AQ,KW,YE +2438+04643 Asia/Riyadh Arabia, Syowa -SB,FM -0932+16012 Pacific/Guadalcanal Solomons, Pohnpei +SA,AQ,KW,YE +2438+04643 Asia/Riyadh Syowa +SB,FM -0932+16012 Pacific/Guadalcanal Pohnpei SD +1536+03232 Africa/Khartoum -SG,MY +0117+10351 Asia/Singapore Singapore, peninsular Malaysia +SG,MY +0117+10351 Asia/Singapore peninsular Malaysia SR +0550-05510 America/Paramaribo SS +0451+03137 Africa/Juba ST +0020+00644 Africa/Sao_Tome @@ -299,7 +301,7 @@ SV +1342-08912 America/El_Salvador SY +3330+03618 Asia/Damascus TC +2128-07108 America/Grand_Turk TD +1207+01503 Africa/Ndjamena -TH,CX,KH,LA,VN +1345+10031 Asia/Bangkok Indochina (most areas) +TH,CX,KH,LA,VN +1345+10031 Asia/Bangkok north Vietnam TJ +3835+06848 Asia/Dushanbe TK -0922-17114 Pacific/Fakaofo TL -0833+12535 Asia/Dili @@ -308,7 +310,7 @@ TN +3648+01011 Africa/Tunis TO -210800-1751200 Pacific/Tongatapu TR +4101+02858 Europe/Istanbul TW +2503+12130 Asia/Taipei -UA +5026+03031 Europe/Kyiv Ukraine (most areas) +UA +5026+03031 Europe/Kyiv most of Ukraine US +404251-0740023 America/New_York Eastern (most areas) US +421953-0830245 America/Detroit Eastern - MI (most areas) US +381515-0854534 America/Kentucky/Louisville Eastern - KY (Louisville area) @@ -328,7 +330,7 @@ US +465042-1012439 America/North_Dakota/New_Salem Central - ND (Morton rural) US +471551-1014640 America/North_Dakota/Beulah Central - ND (Mercer) US +394421-1045903 America/Denver Mountain (most areas) US +433649-1161209 America/Boise Mountain - ID (south); OR (east) -US,CA +332654-1120424 America/Phoenix MST - Arizona (except Navajo), Creston BC +US,CA +332654-1120424 America/Phoenix MST - AZ (most areas), Creston BC US +340308-1181434 America/Los_Angeles Pacific US +611305-1495401 America/Anchorage Alaska (most areas) US +581807-1342511 America/Juneau Alaska - Juneau area @@ -336,13 +338,13 @@ US +571035-1351807 America/Sitka Alaska - Sitka area US +550737-1313435 America/Metlakatla Alaska - Annette Island US +593249-1394338 America/Yakutat Alaska - Yakutat US +643004-1652423 America/Nome Alaska (west) -US +515248-1763929 America/Adak Aleutian Islands -US,UM +211825-1575130 Pacific/Honolulu Hawaii +US +515248-1763929 America/Adak Alaska - western Aleutians +US +211825-1575130 Pacific/Honolulu Hawaii UY -345433-0561245 America/Montevideo UZ +3940+06648 Asia/Samarkand Uzbekistan (west) UZ +4120+06918 Asia/Tashkent Uzbekistan (east) VE +1030-06656 America/Caracas -VN +1045+10640 Asia/Ho_Chi_Minh Vietnam (south) +VN +1045+10640 Asia/Ho_Chi_Minh south Vietnam VU -1740+16825 Pacific/Efate WS -1350-17144 Pacific/Apia ZA,LS,SZ -2615+02800 Africa/Johannesburg