Module Name: src Committed By: christos Date: Wed Jul 3 15:50:16 UTC 2019
Modified Files: src/lib/libc/time: Makefile NEWS localtime.c theory.html tz-art.html tz-how-to.html tz-link.html tzfile.5 tzset.3 version zic.8 zic.c Log Message: Sync with 2019b: zic's new -b option supports a way to control data bloat and to test for year-2038 bugs in software that reads TZif files. 'zic -b fat' and 'zic -b slim' generate larger and smaller output; for example, changing from fat to slim shrinks the Europe/London file from 3648 to 1599 bytes, saving about 56%. Fat and slim files represent the same set of timestamps and use the same TZif format as documented in tzfile(5) and in Internet RFC 8536. Fat format attempts to work around bugs or incompatibilities in older software, notably software that mishandles 64-bit TZif data or uses obsolete TZ strings like "EET-2EEST" that lack DST rules. Slim format is more efficient and does not work around 64-bit bugs or obsolete TZ strings. Currently zic defaults to fat format unless you compile with -DZIC_BLOAT_DEFAULT=\"slim\"; this out-of-the-box default is intended to change in future releases as the buggy software often mishandles timestamps anyway. zic no longer treats a set of rules ending in 2037 specially. Previously, zic assumed that such a ruleset meant that future timestamps could not be predicted, and therefore omitted a POSIX-like TZ string in the TZif output. The old behavior is no longer needed for current tzdata, and caused problems with newlib when used with older tzdata (reported by David Gauchard). zic no longer generates some artifact transitions. For example, Europe/London no longer has a no-op transition in January 1996. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/lib/libc/time/Makefile cvs rdiff -u -r1.28 -r1.29 src/lib/libc/time/NEWS src/lib/libc/time/tzfile.5 cvs rdiff -u -r1.121 -r1.122 src/lib/libc/time/localtime.c cvs rdiff -u -r1.7 -r1.8 src/lib/libc/time/theory.html cvs rdiff -u -r1.4 -r1.5 src/lib/libc/time/tz-art.html cvs rdiff -u -r1.6 -r1.7 src/lib/libc/time/tz-how-to.html cvs rdiff -u -r1.5 -r1.6 src/lib/libc/time/tz-link.html cvs rdiff -u -r1.41 -r1.42 src/lib/libc/time/tzset.3 cvs rdiff -u -r1.11 -r1.12 src/lib/libc/time/version cvs rdiff -u -r1.32 -r1.33 src/lib/libc/time/zic.8 cvs rdiff -u -r1.74 -r1.75 src/lib/libc/time/zic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/time/Makefile diff -u src/lib/libc/time/Makefile:1.43 src/lib/libc/time/Makefile:1.44 --- src/lib/libc/time/Makefile:1.43 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/Makefile Wed Jul 3 11:50:16 2019 @@ -35,11 +35,13 @@ DATAFORM= main LOCALTIME= GMT -# If you want something other than Eastern United States time as a template -# for handling ruleless POSIX-style timezone environment variables, +# The POSIXRULES macro controls interpretation of nonstandard and obsolete +# POSIX-like TZ settings like TZ='EET-2EEST' that lack DST transition rules. +# In the reference implementation, if you want something other than Eastern +# United States time as 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). -# A ruleless environment setting like TZ='CST6CDT' uses the rules in the +# A setting like TZ='EET-2EEST' is supposed to use the rules in the # 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. @@ -49,6 +51,17 @@ LOCALTIME= GMT # Use the command # make zonenames # to get a list of the values you can use for POSIXRULES. +# +# If POSIXRULES is empty, no template is installed; this is the intended +# future default for POSIXRULES. +# +# Nonempty POSIXRULES is obsolete and should not be relied on, because: +# * It does not work correctly in popular implementations such as GNU/Linux. +# * It does not work in the tzdb implementation for timestamps after 2037. +# * It is incompatible with 'zic -b slim' if POSIXRULES specifies transitions +# at standard time or UT rather than at local time. +# In short, software should avoid ruleless settings like TZ='EET-2EEST' +# and so should not depend on the value of POSIXRULES. POSIXRULES= America/New_York @@ -231,6 +244,13 @@ LDLIBS= # other than simply getting garbage data # -DUSE_LTZ=0 to build zdump with the system time zone library # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"slim\" to default zic's -b option to "slim", and +# similarly for "fat". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably readers that mishandle 64-bit +# data in TZif files. Slim TZif files are more efficient and do not +# work around these incompatibilities and bugs. If not given, the +# current default is "fat" but this is intended to change as readers +# requiring fat files often mishandle timestamps after 2037 anyway. # -DZIC_MAX_ABBR_LEN_WO_WARN=3 # (or some other number) to set the maximum time zone abbreviation length # that zic will accept without a warning (the default is 6) @@ -364,7 +384,9 @@ ZIC= $(zic) $(ZFLAGS) # To shrink the size of installed TZif files, # append "-r @N" to omit data before N-seconds-after-the-Epoch. -# See the zic man page for more about -r. +# You can also append "-b slim" if that is not already the default; +# see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. ZFLAGS= # How to use zic to install TZif files. @@ -388,6 +410,9 @@ KSHELL= /bin/bash # Name of curl <https://curl.haxx.se/>, used for HTML validation. CURL= curl +# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions. +GPG= gpg + # The path where SGML DTDs are kept and the catalog file(s) to use when # validating HTML 4.01. The default should work on both Debian and Red Hat. SGML_TOPDIR= /usr @@ -562,7 +587,9 @@ install: all $(DATA) $(REDO) $(MANS) '$(DESTDIR)$(LIBDIR)' \ '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ '$(DESTDIR)$(MANDIR)/man8' - $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) \ + $(ZIC_INSTALL) -l $(LOCALTIME) \ + `case '$(POSIXRULES)' in ?*) echo '-p';; esac \ + ` $(POSIXRULES) \ -t '$(DESTDIR)$(TZDEFAULT)' cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' cp tzselect '$(DESTDIR)$(BINDIR)/.' @@ -781,12 +808,6 @@ CHECK_CC_LIST = { n = split($$1,a,/,/); check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu - $(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu - $(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c - $(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \ - LC_ALL=C sort -c - $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ - LC_ALL=C sort -cu touch $@ check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi @@ -1051,7 +1072,7 @@ tzdata$(VERSION).tar.gz.asc: tzdata$(VER tzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz $(ALL_ASC): - gpg2 --armor --detach-sign $? + $(GPG) --armor --detach-sign $? TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T typecheck: typecheck_long_long typecheck_unsigned Index: src/lib/libc/time/NEWS diff -u src/lib/libc/time/NEWS:1.28 src/lib/libc/time/NEWS:1.29 --- src/lib/libc/time/NEWS:1.28 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/NEWS Wed Jul 3 11:50:16 2019 @@ -1,6 +1,100 @@ News for the tz database -Release 20198 - 2019-03-25 22:01:33 -0700 +Release 2019b - 2019-07-01 00:09:53 -0700 + + Briefly: + Brazil no longer observes DST. + 'zic -b slim' outputs smaller TZif files; please try it out. + Palestine's 2019 spring-forward transition was on 03-29, not 03-30. + + Changes to future timestamps + + Brazil has canceled DST and will stay on standard time indefinitely. + (Thanks to Steffen Thorsen, Marcus Diniz, and Daniel Soares de + Oliveira.) + + Predictions for Morocco now go through 2087 instead of 2037, to + work around a problem on newlib when using TZif files output by + zic 2019a or earlier. (Problem reported by David Gauchard.) + + Changes to past and future timestamps + + Palestine's 2019 spring transition was 03-29 at 00:00, not 03-30 + at 01:00. (Thanks to Sharef Mustafa and Even Scharning.) Guess + future transitions to be March's last Friday at 00:00. + + Changes to past timestamps + + Hong Kong's 1941-06-15 spring-forward transition was at 03:00, not + 03:30. Its 1945 transition from JST to HKT was on 11-18 at 02:00, + not 09-15 at 00:00. In 1946 its spring-forward transition was on + 04-21 at 00:00, not the previous day at 03:30. From 1946 through + 1952 its fall-back transitions occurred at 04:30, not at 03:30. + In 1947 its fall-back transition was on 11-30, not 12-30. + (Thanks to P Chan.) + + Changes to past time zone abbreviations + + Italy's 1866 transition to Rome Mean Time was on December 12, not + September 22. This affects only the time zone abbreviation for + Europe/Rome between those dates. (Thanks to Stephen Trainor and + Luigi Rosa.) + + Changes affecting metadata only + + Add info about the Crimea situation in zone1970.tab and zone.tab. + (Problem reported by Serhii Demediuk.) + + Changes to code + + zic's new -b option supports a way to control data bloat and to + test for year-2038 bugs in software that reads TZif files. + 'zic -b fat' and 'zic -b slim' generate larger and smaller output; + for example, changing from fat to slim shrinks the Europe/London + file from 3648 to 1599 bytes, saving about 56%. Fat and slim + files represent the same set of timestamps and use the same TZif + format as documented in tzfile(5) and in Internet RFC 8536. + Fat format attempts to work around bugs or incompatibilities in + older software, notably software that mishandles 64-bit TZif data + or uses obsolete TZ strings like "EET-2EEST" that lack DST rules. + Slim format is more efficient and does not work around 64-bit bugs + or obsolete TZ strings. Currently zic defaults to fat format + unless you compile with -DZIC_BLOAT_DEFAULT=\"slim\"; this + out-of-the-box default is intended to change in future releases + as the buggy software often mishandles timestamps anyway. + + zic no longer treats a set of rules ending in 2037 specially. + Previously, zic assumed that such a ruleset meant that future + timestamps could not be predicted, and therefore omitted a + POSIX-like TZ string in the TZif output. The old behavior is no + longer needed for current tzdata, and caused problems with newlib + when used with older tzdata (reported by David Gauchard). + + zic no longer generates some artifact transitions. For example, + Europe/London no longer has a no-op transition in January 1996. + + Changes to build procedure + + tzdata.zi now assumes zic 2017c or later. This shrinks tzdata.zi + by a percent or so. + + Changes to documentation and commentary + + The Makefile now documents the POSIXRULES macro as being obsolete, + and similarly, zic's -p POSIXRULES option is now documented as + being obsolete. Although the POSIXRULES feature still exists and + works as before, in practice it is rarely used for its intended + purpose, and it does not work either in the default reference + implementation (for timestamps after 2037) or in common + implementations such as GNU/Linux (for contemporary timestamps). + Since POSIXRULES was designed primarily as a temporary transition + facility for System V platforms that died off decades ago, it is + being decommissioned rather than institutionalized. + + New info on Bonin Islands and Marcus (thanks to Wakaba and Phake Nick). + + +Release 2019a - 2019-03-25 22:01:33 -0700 Briefly: Palestine "springs forward" on 2019-03-30 instead of 2019-03-23. @@ -481,7 +575,7 @@ Release 2018d - 2018-03-22 07:05:46 -070 The code is a bit more portable to MS-Windows. Installers can compile with -DRESERVE_STD_EXT_IDS on MS-Windows platforms that reserve identifiers like 'localtime'. (Thanks to Manuela - Friedrich). + Friedrich.) Changes to documentation and commentary @@ -2276,7 +2370,7 @@ Release 2014f - 2014-08-05 17:42:36 -070 warlord Jin Shuren in the data. Commentary about the coverage of each Russian zone has been standardized. - (Thanks to Tim Parenti). + (Thanks to Tim Parenti.) There is new commentary about contemporary timekeeping in Ethiopia. @@ -2724,7 +2818,7 @@ Release 2013e - 2013-09-19 23:50:04 -070 Change the UT offset of Bern Mean Time from 0:29:44 to 0:29:46. This affects Europe/Zurich timestamps from 1853 to 1894. (Thanks - to Alois Treindl). + to Alois Treindl.) Change the date of the circa-1850 Zurich transition from 1849-09-12 to 1853-07-16, overriding Shanks with data from Messerli about @@ -3034,7 +3128,7 @@ Release 2013a - 2013-02-27 09:20:35 -080 (Thanks to Arthur David Olson.) Improve the commentary about which districts observe what times - in Russia. (Thanks to Oscar van Vlijmen and Arthur David Olson). + in Russia. (Thanks to Oscar van Vlijmen and Arthur David Olson.) Add web page links to tz.js. Index: src/lib/libc/time/tzfile.5 diff -u src/lib/libc/time/tzfile.5:1.28 src/lib/libc/time/tzfile.5:1.29 --- src/lib/libc/time/tzfile.5:1.28 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/tzfile.5 Wed Jul 3 11:50:16 2019 @@ -1,8 +1,8 @@ -.\" $NetBSD: tzfile.5,v 1.28 2019/04/04 18:18:31 christos Exp $ +.\" $NetBSD: tzfile.5,v 1.29 2019/07/03 15:50:16 christos Exp $ .\" .\" This file is in the public domain, so clarified as of .\" 1996-06-05 by Arthur David Olson (arthur_david_ol...@nih.gov). -.Dd April 4, 2019 +.Dd July 2, 2019 .Dt TZFILE 5 .Os .Sh NAME @@ -17,6 +17,17 @@ These files use the format described in .Rs .%R RFC 8536 .Re +Each file is a sequence of 8-bit bytes. +In a file, a binary integer is represented by a sequence of one or +more bytes in network order (bigendian, or high-order byte first), +with all bits significant, +a signed binary integer is represented using two's complement, +and a boolean is represented by a one-byte binary integer that is +either +.Dv 0 +(false) or +.Dv 1 +(true). .Bl -bullet .It The magic four-byte ASCII sequence begin with the magic characters @@ -33,11 +44,9 @@ or .It Fifteen bytes containing zeros reserved for future use. .It -Six four-byte integer values written in a standard byte order -(the high-order byte of the value is written first). -These values are, in order: +Six four-byte integer values, in the following order: .Bl -inset -.It Va tzh_ttisgmtcnt +.It Va tzh_ttisutcnt The number of UT/local indicators stored in the file. .It Va tzh_ttisstdcnt The number of standard/wall indicators stored in the file. @@ -78,18 +87,18 @@ These values serve as indices into the n entries, each defined as follows: .Bd -literal struct ttinfo { - int32_t tt_gmtoff; + int32_t tt_uttoff; unsigned char tt_isdst; - unsigned char tt_abbrind; + unsigned char tt_desigind; }; .Ed .Pp Each structure is written as a four-byte signed integer value for .Va tt_gmtoff -in a standard byte order, followed by a one-byte value for +in a network byte order, followed by a one-byte value for .Va tt_isdst and a one-byte value for -.Va tt_abbrind . +.Va tt_desigidx . In each structure, .Va tt_gmtoff gives the number of seconds to be added to UT, @@ -99,18 +108,29 @@ tells whether should be set by .Xr localtime 3 and -.Va tt_abbrind +.Va tt_desigidx serves as an index into the array of timezone abbreviation bytes that follow the .Va ttinfo structure(s) in the file. +The +.Va tt_utoff ++value is never equal to \-2**31, +to let 32-bit clients negate it without overflow. +Also, in realistic applications +.Va tt_utoff +is in the range [\-89999, 93599] +(i.e., more than \-25 hours and less than 26 +hours); this allows easy support by implementations that +already support the POSIX-required range +.Dv [ \-24:59:59 , 25:59:59 ] . .It Va tzh_leapcnt -pairs of four-byte values, written in standard byte order; +pairs of four-byte values, written in network byte order; the first value of each pair gives the time (as returned by .Xr time 3 ) at which a leap second occurs; -the second gives the +the second is a signed integer specifying the .Em total number of leap seconds to be applied during the time period starting at the given time. @@ -118,26 +138,44 @@ The pairs of values are sorted in ascend Each transition is for one leap second, either positive or negative; transitions always separated by at least 28 days minus 1 second. .It Va tzh_ttisstdcnt -standard/wall indicators, each stored as a one-byte value; +standard/wall indicators, each stored as a one-byte boolean; they tell whether the transition times associated with local time types -were specified as standard time or wall clock time, -and are used when a timezone file is used in handling POSIX-style -timezone environment variables. -.It Va tzh_ttisgmtcnt -UT/local indicators, each stored as a one-byte value; +were specified as standard time or local (wall clock) time. +.It Va tzh_ttisutcnt +UT/local indicators, each stored as a one-byte boolean; they tell whether the transition times associated with local time types -were specified as UT or local time, -and are used when a timezone file is used in handling POSIX-style -timezone environment variables. +were specified as UT or local time. +If a UT/local indicator is set, the corresponding standard/wall indicator +must also be set. +.Pp +The standard/wall and UT/local indicators were designed for +transforming a TZif file's transition times into transitions appropriate +for another time zone specified via a POSIX-style TZ string that lacks rules. +For example, when +.Dv TZ="EET\*-2EEST" +and there is no TZif file +.Dq EET\*-2EEST , +the idea was to adapt the transition times from a TZif file with the +well-known name "posixrules" that is present only for this purpose and +is a copy of the file +.Dq Europe/Brussels , +a file with a different UT offset. +POSIX does not specify this obsolete transformational behavior, +the default rules are installation-dependent, and no implementation +is known to support this feature for timestamps past +.Dv 2037 , +so users desiring (say) Greek time should instead specify +.Dv TZ="Europe/Athens" +for better historical coverage, falling back on +.Dv TZ="EET\*-2EEST,M3.5.0/3,M10.5.0/4" +if POSIX conformance is required +and older timestamps need not be handled accurately. .Pp The .Xr localtime 3 -function uses the first standard-time +function normally uses the first .Fa ttinfo structure in the file -(or simply the first -.Fa ttinfo -structure in the absence of a standard-time structure) if either .Va tzh_timecnt is zero or the time argument is less than the first transition time recorded @@ -172,7 +210,8 @@ For version-3-format timezone files, the use two minor extensions to the POSIX TZ format, as described in .Xr tzset 3 . First, the hours part of its transition times may be signed and range from -\-167 through 167 instead of the POSIX-required unsigned values +\-167 through 167 +instead of the POSIX-required unsigned values from 0 through 24. Second, DST is in effect all year if it starts January 1 at 00:00 and ends December 31 at 24:00 plus the difference Index: src/lib/libc/time/localtime.c diff -u src/lib/libc/time/localtime.c:1.121 src/lib/libc/time/localtime.c:1.122 --- src/lib/libc/time/localtime.c:1.121 Wed Apr 17 13:37:29 2019 +++ src/lib/libc/time/localtime.c Wed Jul 3 11:50:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: localtime.c,v 1.121 2019/04/17 17:37:29 christos Exp $ */ +/* $NetBSD: localtime.c,v 1.122 2019/07/03 15:50:16 christos Exp $ */ /* Convert timestamp from time_t to struct tm. */ @@ -12,7 +12,7 @@ #if 0 static char elsieid[] = "@(#)localtime.c 8.17"; #else -__RCSID("$NetBSD: localtime.c,v 1.121 2019/04/17 17:37:29 christos Exp $"); +__RCSID("$NetBSD: localtime.c,v 1.122 2019/07/03 15:50:16 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -104,11 +104,11 @@ static const char gmt[] = "GMT"; #endif struct ttinfo { /* time type information */ - int_fast32_t tt_gmtoff; /* UT offset in seconds */ + int_fast32_t tt_utoff; /* UT offset in seconds */ bool tt_isdst; /* used to set tm_isdst */ - int tt_abbrind; /* abbreviation list index */ + int tt_desigidx; /* abbreviation list index */ bool tt_ttisstd; /* transition is std time */ - bool tt_ttisgmt; /* transition is UT */ + bool tt_ttisut; /* transition is UT */ }; struct lsinfo { /* leap second information */ @@ -227,15 +227,15 @@ long altzone = 0; # endif /* defined ALTZONE */ #endif /* !HAVE_POSIX_DECLS */ -/* Initialize *S to a value based on GMTOFF, ISDST, and ABBRIND. */ +/* Initialize *S to a value based on UTOFF, ISDST, and DESIGIDX. */ static void -init_ttinfo(struct ttinfo *s, int_fast32_t gmtoff, bool isdst, int abbrind) +init_ttinfo(struct ttinfo *s, int_fast32_t utoff, bool isdst, int desigidx) { - s->tt_gmtoff = gmtoff; + s->tt_utoff = utoff; s->tt_isdst = isdst; - s->tt_abbrind = abbrind; + s->tt_desigidx = desigidx; s->tt_ttisstd = false; - s->tt_ttisgmt = false; + s->tt_ttisut = false; } static int_fast32_t @@ -294,7 +294,7 @@ tzgetname(const timezone_t sp, int isdst for (i = 0; i < sp->typecnt; ++i) { const struct ttinfo *const ttisp = &sp->ttis[i]; if (ttisp->tt_isdst == isdst) - name = &sp->chars[ttisp->tt_abbrind]; + name = &sp->chars[ttisp->tt_desigidx]; } if (name != NULL) return name; @@ -311,7 +311,7 @@ tzgetgmtoff(const timezone_t sp, int isd const struct ttinfo *const ttisp = &sp->ttis[i]; if (ttisp->tt_isdst == isdst) { - l = ttisp->tt_gmtoff; + l = ttisp->tt_utoff; } } if (l == -1) @@ -335,7 +335,7 @@ scrub_abbrs(struct state *sp) */ for (i = 0; i < sp->typecnt; ++i) { const struct ttinfo * const ttisp = &sp->ttis[i]; - char * cp = &sp->chars[ttisp->tt_abbrind]; + char *cp = &sp->chars[ttisp->tt_desigidx]; if (strlen(cp) > TZ_ABBR_MAX_LEN && strcmp(cp, GRANDPARENTED) != 0) @@ -347,15 +347,15 @@ static void update_tzname_etc(const struct state *sp, const struct ttinfo *ttisp) { #if HAVE_TZNAME - tzname[ttisp->tt_isdst] = __UNCONST(&sp->chars[ttisp->tt_abbrind]); + tzname[ttisp->tt_isdst] = __UNCONST(&sp->chars[ttisp->tt_desigidx]); #endif #if USG_COMPAT if (!ttisp->tt_isdst) - timezone = - ttisp->tt_gmtoff; + timezone = - ttisp->tt_utoff; #endif #ifdef ALTZONE if (ttisp->tt_isdst) - altzone = - ttisp->tt_gmtoff; + altzone = - ttisp->tt_utoff; #endif /* defined ALTZONE */ } @@ -503,7 +503,7 @@ tzloadbody(char const *name, struct stat return errno; for (stored = 4; stored <= 8; stored *= 2) { int_fast32_t ttisstdcnt = detzcode(up->tzhead.tzh_ttisstdcnt); - int_fast32_t ttisgmtcnt = detzcode(up->tzhead.tzh_ttisgmtcnt); + int_fast32_t ttisutcnt = detzcode(up->tzhead.tzh_ttisutcnt); int_fast64_t prevtr = 0; int_fast32_t prevcorr = 0; int_fast32_t leapcnt = detzcode(up->tzhead.tzh_leapcnt); @@ -519,7 +519,7 @@ tzloadbody(char const *name, struct stat && 0 <= timecnt && timecnt < TZ_MAX_TIMES && 0 <= charcnt && charcnt < TZ_MAX_CHARS && (ttisstdcnt == typecnt || ttisstdcnt == 0) - && (ttisgmtcnt == typecnt || ttisgmtcnt == 0))) + && (ttisutcnt == typecnt || ttisutcnt == 0))) return EINVAL; if ((size_t)nread < (tzheadsize /* struct tzhead */ @@ -529,7 +529,7 @@ tzloadbody(char const *name, struct stat + charcnt /* chars */ + leapcnt * (stored + 4) /* lsinfos */ + ttisstdcnt /* ttisstds */ - + ttisgmtcnt)) /* ttisgmts */ + + ttisutcnt)) /* ttisuts */ return EINVAL; sp->leapcnt = leapcnt; sp->timecnt = timecnt; @@ -571,19 +571,19 @@ tzloadbody(char const *name, struct stat sp->timecnt = timecnt; for (i = 0; i < sp->typecnt; ++i) { struct ttinfo * ttisp; - unsigned char isdst, abbrind; + unsigned char isdst, desigidx; ttisp = &sp->ttis[i]; - ttisp->tt_gmtoff = detzcode(p); + ttisp->tt_utoff = detzcode(p); p += 4; isdst = *p++; if (! (isdst < 2)) return EINVAL; ttisp->tt_isdst = isdst; - abbrind = *p++; - if (! (abbrind < sp->charcnt)) + desigidx = *p++; + if (! (desigidx < sp->charcnt)) return EINVAL; - ttisp->tt_abbrind = abbrind; + ttisp->tt_desigidx = desigidx; } for (i = 0; i < sp->charcnt; ++i) sp->chars[i] = *p++; @@ -634,12 +634,12 @@ tzloadbody(char const *name, struct stat struct ttinfo * ttisp; ttisp = &sp->ttis[i]; - if (ttisgmtcnt == 0) - ttisp->tt_ttisgmt = false; + if (ttisutcnt == 0) + ttisp->tt_ttisut = false; else { if (*p != true && *p != false) return EINVAL; - ttisp->tt_ttisgmt = *p++; + ttisp->tt_ttisut = *p++; } } /* @@ -668,11 +668,11 @@ tzloadbody(char const *name, struct stat int gotabbr = 0; int charcnt = sp->charcnt; for (i = 0; i < ts->typecnt; i++) { - char *tsabbr = ts->chars + ts->ttis[i].tt_abbrind; + char *tsabbr = ts->chars + ts->ttis[i].tt_desigidx; int j; for (j = 0; j < charcnt; j++) if (strcmp(sp->chars + j, tsabbr) == 0) { - ts->ttis[i].tt_abbrind = j; + ts->ttis[i].tt_desigidx = j; gotabbr++; break; } @@ -681,7 +681,7 @@ tzloadbody(char const *name, struct stat if (j + tsabbrlen < TZ_MAX_CHARS) { strcpy(sp->chars + j, tsabbr); charcnt = (int_fast32_t)(j + tsabbrlen + 1); - ts->ttis[i].tt_abbrind = j; + ts->ttis[i].tt_desigidx = j; gotabbr++; } } @@ -815,12 +815,13 @@ typesequiv(const struct state *sp, int a else { const struct ttinfo * ap = &sp->ttis[a]; const struct ttinfo * bp = &sp->ttis[b]; - result = ap->tt_gmtoff == bp->tt_gmtoff && - ap->tt_isdst == bp->tt_isdst && - ap->tt_ttisstd == bp->tt_ttisstd && - ap->tt_ttisgmt == bp->tt_ttisgmt && - strcmp(&sp->chars[ap->tt_abbrind], - &sp->chars[bp->tt_abbrind]) == 0; + result = (ap->tt_utoff == bp->tt_utoff + && ap->tt_isdst == bp->tt_isdst + && ap->tt_ttisstd == bp->tt_ttisstd + && ap->tt_ttisut == bp->tt_ttisut + && (strcmp(&sp->chars[ap->tt_desigidx], + &sp->chars[bp->tt_desigidx]) + == 0)); } return result; } @@ -1293,7 +1294,7 @@ tzparse(const char *name, struct state * j = sp->types[i]; if (!sp->ttis[j].tt_isdst) { theirstdoffset = - -sp->ttis[j].tt_gmtoff; + - sp->ttis[j].tt_utoff; break; } } @@ -1302,7 +1303,7 @@ tzparse(const char *name, struct state * j = sp->types[i]; if (sp->ttis[j].tt_isdst) { theirdstoffset = - -sp->ttis[j].tt_gmtoff; + - sp->ttis[j].tt_utoff; break; } } @@ -1318,7 +1319,7 @@ tzparse(const char *name, struct state * for (i = 0; i < sp->timecnt; ++i) { j = sp->types[i]; sp->types[i] = sp->ttis[j].tt_isdst; - if (sp->ttis[j].tt_ttisgmt) { + if (sp->ttis[j].tt_ttisut) { /* No adjustment to transition time */ } else { /* @@ -1344,7 +1345,7 @@ tzparse(const char *name, struct state * (stdoffset - theirstdoffset); } } - theiroffset = -sp->ttis[j].tt_gmtoff; + theiroffset = -sp->ttis[j].tt_utoff; if (sp->ttis[j].tt_isdst) theirstdoffset = theiroffset; else theirdstoffset = theiroffset; @@ -1589,14 +1590,14 @@ localsub(struct state const *sp, time_t /* ** To get (wrong) behavior that's compatible with System V Release 2.0 ** you'd replace the statement below with - ** t += ttisp->tt_gmtoff; + ** t += ttisp->tt_utoff; ** timesub(&t, 0L, sp, tmp); */ - result = timesub(&t, ttisp->tt_gmtoff, sp, tmp); + result = timesub(&t, ttisp->tt_utoff, sp, tmp); if (result) { result->tm_isdst = ttisp->tt_isdst; #ifdef TM_ZONE - result->TM_ZONE = __UNCONST(&sp->chars[ttisp->tt_abbrind]); + result->TM_ZONE = __UNCONST(&sp->chars[ttisp->tt_desigidx]); #endif /* defined TM_ZONE */ if (setname) update_tzname_etc(sp, ttisp); @@ -2135,8 +2136,8 @@ again: if (sp->ttis[j].tt_isdst == sp->ttis[i].tt_isdst) continue; - off = sp->ttis[j].tt_gmtoff - - sp->ttis[i].tt_gmtoff; + off = sp->ttis[j].tt_utoff - + sp->ttis[i].tt_utoff; yourtm.tm_sec += off < 0 ? -off : off; goto again; @@ -2197,8 +2198,8 @@ again: for (j = sp->typecnt - 1; j >= 0; --j) { if (sp->ttis[j].tt_isdst == yourtm.tm_isdst) continue; - newt = (time_t)(t + sp->ttis[j].tt_gmtoff - - sp->ttis[i].tt_gmtoff); + newt = (time_t)(t + sp->ttis[j].tt_utoff - + sp->ttis[i].tt_utoff); if (! funcp(sp, &newt, offset, &mytm)) continue; if (tmcomp(&mytm, &yourtm) != 0) @@ -2314,16 +2315,16 @@ time1(struct tm *const tmp, otheri = types[otherind]; if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst) continue; - tmp->tm_sec += (int)(sp->ttis[otheri].tt_gmtoff - - sp->ttis[samei].tt_gmtoff); + tmp->tm_sec += (int)(sp->ttis[otheri].tt_utoff - + sp->ttis[samei].tt_utoff); tmp->tm_isdst = !tmp->tm_isdst; t = time2(tmp, funcp, sp, offset, &okay); if (okay) { errno = save_errno; return t; } - tmp->tm_sec -= (int)(sp->ttis[otheri].tt_gmtoff - - sp->ttis[samei].tt_gmtoff); + tmp->tm_sec -= (int)(sp->ttis[otheri].tt_utoff - + sp->ttis[samei].tt_utoff); tmp->tm_isdst = !tmp->tm_isdst; } } Index: src/lib/libc/time/theory.html diff -u src/lib/libc/time/theory.html:1.7 src/lib/libc/time/theory.html:1.8 --- src/lib/libc/time/theory.html:1.7 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/theory.html Wed Jul 3 11:50:16 2019 @@ -88,7 +88,7 @@ href="https://en.wikipedia.org/wiki/POSI standard for <a href="https://en.wikipedia.org/wiki/Unix">UNIX</a>-like systems. As of this writing, the current edition of POSIX is: <a -href="http://pubs.opengroup.org/onlinepubs/9699919799/"> The Open +href="https://pubs.opengroup.org/onlinepubs/9699919799/"> The Open Group Base Specifications Issue 7</a>, IEEE Std 1003.1-2017, 2018 Edition. Because the database's scope encompasses real-world changes to civil @@ -186,7 +186,7 @@ in decreasing order of importance: href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> letters, '<code>.</code>', '<code>-</code>' and '<code>_</code>'. Do not use digits, as that might create an ambiguity with <a - href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX + href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX <code>TZ</code> strings</a>. A file name component must not exceed 14 characters or start with '<code>-</code>'. @@ -301,7 +301,7 @@ in decreasing order of importance: <p> Guidelines have evolved with time, and names following old versions of -this guideline might not follow the current version. When guidelines +these guidelines might not follow the current version. When guidelines have changed, old names continue to be supported. Guideline changes have included the following: </p> @@ -330,7 +330,7 @@ and the file '<code>northamerica</code>' </li> <li> -Older versions of this guideline said that +Older versions of these guidelines said that there should typically be at least one name for each <a href="https://en.wikipedia.org/wiki/ISO_3166-1"><abbr title="International Organization for Standardization">ISO</abbr> @@ -379,8 +379,8 @@ in decreasing order of importance: special meaning to the <a href="https://en.wikipedia.org/wiki/Unix_shell">UNIX shell</a> and cause commands like - '<code><a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set">set</a> - `<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html">date</a>`</code>' + '<code><a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set">set</a> + `<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html">date</a>`</code>' to have unexpected effects. Previous editions of this guideline required upper-case letters, but the Congressman who introduced @@ -955,7 +955,7 @@ an older <code>zic</code>. </li> <li> In POSIX, there is no tamper-proof way for a process to learn the - system's best idea of local wall clock. + system's best idea of local (wall clock) time. This is important for applications that an administrator wants used only at certain times – without regard to whether the user has fiddled the @@ -1052,14 +1052,14 @@ an older <code>zic</code>. </li> <li> A function <code>tzsetwall</code> has been added to arrange for the - system's best approximation to local wall clock time to be delivered + system's best approximation to local (wall clock) time to be delivered by subsequent calls to <code>localtime</code>. - Source code for portable applications that "must" run on local wall - clock time should call <code>tzsetwall</code>; + Source code for portable applications that "must" run on local + time should call <code>tzsetwall</code>; if such code is moved to "old" systems that do not provide <code>tzsetwall</code>, you will not be able to generate an executable program. - (These functions also arrange for local wall clock time to + (These functions also arrange for local time to be used if <code>tzset</code> is called – directly or indirectly – and there is no <code>TZ</code> environment variable; portable applications should not, however, rely on this @@ -1354,11 +1354,11 @@ Sources for time on other planets: Michael Allison and Robert Schmunk, "<a href="https://www.giss.nasa.gov/tools/mars24/help/notes.html">Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock</a>" - (2015-06-30). + (2018-12-13). </li> <li> Jia-Rui Chong, - "<a href="http://articles.latimes.com/2004/jan/14/science/sci-marstime14">Workdays + "<a href="https://www.latimes.com/archives/la-xpm-2004-jan-14-sci-marstime14-story.html">Workdays Fit for a Martian</a>", <cite>Los Angeles Times</cite> (2004-01-14), pp A1, A20–A21. </li> Index: src/lib/libc/time/tz-art.html diff -u src/lib/libc/time/tz-art.html:1.4 src/lib/libc/time/tz-art.html:1.5 --- src/lib/libc/time/tz-art.html:1.4 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/tz-art.html Wed Jul 3 11:50:16 2019 @@ -25,7 +25,7 @@ briefly says why France has more time zo "About Time" (1962; 59 minutes) is part of the Bell Science extravaganza, with Frank Baxter, Richard Deacon, and Les Tremayne. Its advisor was Richard Feynman, and it was voiced by Mel Blanc. -(<a href="http://www.imdb.com/title/tt0154110/">IMDb entry</a>.)</li> +(<a href="https://www.imdb.com/title/tt0154110/">IMDb entry</a>.)</li> </ul> <h2>Movies</h2> <ul> @@ -36,14 +36,14 @@ there is a reference to British Double S The time does not play a large part in the plot; it's just a passing reference to the time when one of the characters was supposed to have died (but didn't). -(<a href="http://us.imdb.com/title/tt0038733/">IMDb entry.</a>) +(<a href="https://www.imdb.com/title/tt0038733/">IMDb entry.</a>) (Dave Cantor) <li> The 1953 railway comedy movie <em>The Titfield Thunderbolt</em> includes a play on words on British Double Summer Time. Valentine's wife wants him to leave the pub and asks him, "Do you know what time it is?" And he, happy where he is, replies: "Yes, my love. Summer double time." -(<a href="http://us.imdb.com/title/tt0046436/">IMDb entry.</a>) +(<a href="https://www.imdb.com/title/tt0046436/">IMDb entry.</a>) (Mark Brader, 2009-10-02) </li> <li> @@ -56,7 +56,7 @@ a gigantic computerized theft. To achiev crooks interfere with the microwave system supplying time signals to the computer, advancing the time by 0.1 second each minute over the last hour of 1999. (So this movie teaches us that 0.1 × 60 = 10.) -(<a href="http://us.imdb.com/title/tt0137494/">IMDb entry.</a>) +(<a href="https://www.imdb.com/title/tt0137494/">IMDb entry.</a>) (Mark Brader, 2009-10-02) </li> <li> @@ -183,7 +183,7 @@ European readers of the 1870s clearly he deep contempt; the protagonists cross the U.S. without once reading a paper. Available versions include -<a href="http://www.literature.org/Works/Jules-Verne/eighty">an English +<a href="https://www.gutenberg.org/ebooks/103">an English translation</a>, and <a href="https://fourmilab.ch/etexts/www/tdm80j">the original French</a> "with illustrations from the original 1873 French-language edition". @@ -203,7 +203,7 @@ part in the novel." (Paul Eggert, 2006-0 </li> <li> John Dunning, <a -href="http://books.simonandschuster.com/Two-OClock-Eastern-Wartime/John-Dunning/9781439171530"><em>Two +href="https://www.simonandschuster.com/books/Two-OClock-Eastern-Wartime/John-Dunning/9781439171530"><em>Two O'Clock, Eastern Wartime</em></a>, 2001. Mystery, history, daylight saving time, and old-time radio. </li> @@ -234,7 +234,7 @@ Todd Strait, drums</td></tr> <tr><td>Notes</td><td>CD notes "additional lyric by Karrin Allyson; arranged by Russ Long and Karrin Allyson"</td></tr> <tr><td>ADO Rating</td><td>1 star</td></tr> -<tr><td><a href="http://www.allmusic.com/album/i-didnt-know-about-you-mw0000618657">AMG Rating</a></td><td>4 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/i-didnt-know-about-you-mw0000618657">AMG Rating</a></td><td>4 stars</td></tr> <tr><td>Penguin Rating</td><td>3.5 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Kevin Mahogany</td></tr> @@ -249,7 +249,7 @@ Ray Drummond, bass; Ralph Moore, tenor saxophone; Lewis Nash, drums</td></tr> <tr><td>ADO Rating</td><td>1.5 stars</td></tr> -<tr><td><a href="http://www.allmusic.com/album/double-rainbow-mw0000620371">AMG Rating</a></td><td>3 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/double-rainbow-mw0000620371">AMG Rating</a></td><td>3 stars</td></tr> <tr><td>Penguin Rating</td><td>3 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Joe Williams</td></tr> @@ -263,7 +263,7 @@ The Robert Farnon [39 piece] Orchestra</ <tr><td>Notes</td><td>This CD is also available as part of a 3-CD package from Telarc, "Triple Play" (CD-83461)</td></tr> <tr><td>ADO Rating</td><td>black dot</td></tr> -<tr><td><a href="http://www.allmusic.com/album/heres-to-life-mw0000623648">AMG Rating</a></td><td>2 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/heres-to-life-mw0000623648">AMG Rating</a></td><td>2 stars</td></tr> <tr><td>Penguin Rating</td><td>3 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Charles Fambrough</td></tr> @@ -278,7 +278,7 @@ Edward Simon, piano; Lenny White, drums; Marion Simon, percussion</td></tr> <tr><td>ADO Rating</td><td>2 stars</td></tr> -<tr><td><a href="http://www.allmusic.com/album/keeper-of-the-spirit-mw0000176559">AMG Rating</a></td><td>unrated</td></tr> +<tr><td><a href="https://www.allmusic.com/album/keeper-of-the-spirit-mw0000176559">AMG Rating</a></td><td>unrated</td></tr> <tr><td>Penguin Rating</td><td>3 stars</td></tr> </table> <hr> @@ -296,7 +296,7 @@ David Piltch, string bass</td></tr> <tr><td>Notes</td><td>Lyrical reference to "Eastern Standard Time" in Tom Waits' "Purple Avenue"</td></tr> <tr><td>ADO Rating</td><td>2.5 stars</td></tr> -<tr><td><a href="http://www.allmusic.com/album/blame-it-on-my-youth-mw0000274303">AMG Rating</a></td><td>3 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/blame-it-on-my-youth-mw0000274303">AMG Rating</a></td><td>3 stars</td></tr> <tr><td>Penguin Rating</td><td>unrated</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Milt Hinton</td></tr> @@ -327,7 +327,7 @@ and Good Time Charlie. <a href="http://www.chiaroscurojazz.com/album.php?C=310">Album info</a> is available.</td></tr> <tr><td>ADO Rating</td><td>3 stars</td></tr> -<tr><td><a href="http://www.allmusic.com/album/old-man-time-mw0000269353">AMG Rating</a></td><td>4.5 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/old-man-time-mw0000269353">AMG Rating</a></td><td>4.5 stars</td></tr> <tr><td>Penguin Rating</td><td>3 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Alan Broadbent</td></tr> @@ -341,7 +341,7 @@ Putter Smith, Bass; Frank Gibson, Jr., drums</td></tr> <tr><td>Notes</td><td>The CD cover features an analemma for equation-of-time fans</td></tr> <tr><td>ADO Rating</td><td>1 star</td></tr> -<tr><td><a href="http://www.allmusic.com/album/pacific-standard-time-mw0000645433">AMG Rating</a></td><td>4 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/pacific-standard-time-mw0000645433">AMG Rating</a></td><td>4 stars</td></tr> <tr><td>Penguin Rating</td><td>3.5 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Anthony Braxton/Richard Teitelbaum</td></tr> @@ -356,7 +356,7 @@ Leo Smith, trumpet and miscellaneous ins Leroy Jenkins, violin and miscellaneous instruments; Richard Teitelbaum, modular moog and micromoog synthesizer</td></tr> <tr><td>ADO Rating</td><td>black dot</td></tr> -<tr><td><a href="http://www.allmusic.com/album/silence-time-zones-mw0000595735">AMG Rating</a></td><td>4 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/silence-time-zones-mw0000595735">AMG Rating</a></td><td>4 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Charles Gayle</td></tr> <tr><td>CD</td><td>Time Zones</td></tr> @@ -366,7 +366,7 @@ Richard Teitelbaum, modular moog and mic <tr><td>Total Time</td><td>49:06</td></tr> <tr><td>Personnel</td><td>Charles Gayle, piano</td></tr> <tr><td>ADO Rating</td><td>1 star</td></tr> -<tr><td><a href="http://www.allmusic.com/album/time-zones-mw0000349642">AMG Rating</a></td><td>4.5 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/time-zones-mw0000349642">AMG Rating</a></td><td>4.5 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>The Get Up Kids</td></tr> <tr><td>CD</td><td>Eudora</td></tr> @@ -375,7 +375,7 @@ Richard Teitelbaum, modular moog and mic <tr><td>ID</td><td>357</td></tr> <tr><td>Total Time</td><td>65:12</td></tr> <tr><td>Notes</td><td>Includes the song "Central Standard Time." Thanks to Colin Bowern for this information.</td></tr> -<tr><td><a href="http://www.allmusic.com/album/eudora-mw0000592063">AMG Rating</a></td><td>2.5 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/eudora-mw0000592063">AMG Rating</a></td><td>2.5 stars</td></tr> <tr><td> </td><td></td></tr> <tr><td>Artist</td><td>Coldplay</td></tr> @@ -420,7 +420,7 @@ Supernaw.</td></tr> <tr><td>ID</td><td>272</td></tr> <tr><td>Total Time</td><td>73:05</td></tr> <tr><td>Notes</td><td>Includes the song "Twilight Time Zone."</td></tr> -<tr><td><a href="http://www.allmusic.com/album/lobster-leaps-in-mw0000794929">AMG Rating</a></td><td>3.5 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/lobster-leaps-in-mw0000794929">AMG Rating</a></td><td>3.5 stars</td></tr> <tr><td>ADO Rating</td><td>2 stars</td></tr> <tr><td> </td><td></td></tr> @@ -431,7 +431,7 @@ Supernaw.</td></tr> <tr><td>Label</td><td>Columbia</td></tr> <tr><td>ID</td><td>CK-8905</td></tr> <tr><td>Total Time</td><td>45:36</td></tr> -<tr><td><a href="http://www.allmusic.com/album/the-times-they-a-changin-mw0000202344">AMG Rating</a></td><td>4.5 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/the-times-they-a-changin-mw0000202344">AMG Rating</a></td><td>4.5 stars</td></tr> <tr><td>ADO Rating</td><td>1.5 stars</td></tr> <tr><td>Notes<td>The title song is also available on "Bob Dylan's Greatest Hits" and "The Essential Bob Dylan."</td></tr> <tr><td> </td><td></td></tr> @@ -442,7 +442,7 @@ Supernaw.</td></tr> <tr><td>Label</td><td>Universal Jazz France</td></tr> <tr><td>ID</td><td>B0012688-02</td></tr> <tr><td>Total Time</td><td>42:31</td></tr> -<tr><td><a href="http://www.allmusic.com/album/tide-mw0000815692">AMG Rating</a></td><td>3.5 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/tide-mw0000815692">AMG Rating</a></td><td>3.5 stars</td></tr> <tr><td>ADO Rating</td><td>2.5 stars</td></tr> <tr><td>Notes<td>Includes the song "Fire and Wood" with the lyric "The clocks were turned back you remember/Think it's still November." @@ -455,7 +455,7 @@ Supernaw.</td></tr> <tr><td>ID</td><td>B0005171-02</td></tr> <tr><td>Total Time</td><td>156:22</td></tr> <tr><td>ADO Rating</td><td>1 star</td></tr> -<tr><td><a href="http://www.allmusic.com/album/youre-getting-better-the-word-jazz-dot-masters-mw0000736197">AMG Rating</a></td><td>4.5 stars</td></tr> +<tr><td><a href="https://www.allmusic.com/album/youre-getting-better-the-word-jazz-dot-masters-mw0000736197">AMG Rating</a></td><td>4.5 stars</td></tr> <tr><td>Notes</td><td>Includes the piece "What Time Is It" ("He knew what time it was everywhere...that counted").</td></tr> </table> @@ -478,16 +478,16 @@ The related book <em>What If?</em> has a </li> <li> Pig kills time in <a -href="http://www.gocomics.com/pearlsbeforeswine/2016/11/06"><em>Pearls +href="https://www.gocomics.com/pearlsbeforeswine/2016/11/06"><em>Pearls Before Swine</em> (2016-11-06)</a>. </li> <li> Stonehenge is abandoned in <a -href='http://www.gocomics.com/nonsequitur/2017/03/12'><em>Non Sequitur</em> +href='https://www.gocomics.com/nonsequitur/2017/03/12'><em>Non Sequitur</em> (2017-03-12)</a>. <li> The boss freaks out in <a -href='http://dilbert.com/strip/1998-03-14'><em>Dilbert</em> (1998-03-14)</a>. +href='https://dilbert.com/strip/1998-03-14'><em>Dilbert</em> (1998-03-14)</a>. </li> <li> Peppermint Patty: "What if the world comes to an end tonight, Marcie?" @@ -495,7 +495,7 @@ Peppermint Patty: "What if the world com Marcie: "I promise there'll be a tomorrow, sir ... in fact, it's already tomorrow in Australia!" <br> -(Charles M. Schulz, <a href='http://www.gocomics.com/peanuts/1980/06/13'><em>Peanuts</em>, 1980-06-13</a>) +(Charles M. Schulz, <a href='https://www.gocomics.com/peanuts/1980/06/13'><em>Peanuts</em>, 1980-06-13</a>) </li> </ul> <h2>Jokes</h2> Index: src/lib/libc/time/tz-how-to.html diff -u src/lib/libc/time/tz-how-to.html:1.6 src/lib/libc/time/tz-how-to.html:1.7 --- src/lib/libc/time/tz-how-to.html:1.6 Sat Oct 27 18:29:24 2018 +++ src/lib/libc/time/tz-how-to.html Wed Jul 3 11:50:16 2019 @@ -102,7 +102,7 @@ in some localizable way. It’s used to determine whether a given year will have a US presidential election; but everything related to that use is commented out.) -<p>The <code>SAVE</code> column contains the wall clock offset from +<p>The <code>SAVE</code> column contains the local (wall clock) offset from local standard time. This is usually either zero for standard time or one hour for daylight saving time; but there’s no reason, in principle, why it can’t @@ -250,10 +250,10 @@ Rule US 2007 max - Nov Sun>=1 <p>There are two interesting things to note here.</p> <p>First, the time that something happens (in the <code>AT</code> -column) is not necessarily the local wall clock time. The time can be +column) is not necessarily the local (wall clock) time. The time can be suffixed with ‘s’ (for “standard”) to mean -local standard time (different from wall clock time when observing -daylight saving time); or it can be suffixed with ‘g’, +local standard time, different from local (wall clock) time when observing +daylight saving time; or it can be suffixed with ‘g’, ‘u’, or ‘z’, all three of which mean the standard time at the <a href="https://en.wikipedia.org/wiki/Prime_Meridian">prime meridian</a>. @@ -265,8 +265,8 @@ href="https://en.wikipedia.org/wiki/Coor (whichever was official at the time); ‘z’ stands for the <a href="https://en.wikipedia.org/wiki/Nautical_time">nautical time zone</a> Z (a.k.a. “Zulu” which, in turn, stands for ‘Z’). -The time can also be suffixed with ‘w’ meaning “wall -clock time;” but it usually isn’t because that’s the +The time can also be suffixed with ‘w’ meaning local (wall +clock) time; but it usually isn’t because that’s the default.</p> <p>Second, the day in the <code>ON</code> column, in addition to @@ -314,7 +314,7 @@ rule, so there should be no change.</li> <tr> <td colspan="6" align="center"><table><tr><td> <pre> -#Zone NAME GMTOFF RULES FORMAT [UNTIL] +#Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Chicago -5:50:36 - LMT 1883 Nov 18 12:09:24 -6:00 US C%sT 1920 -6:00 Chicago C%sT 1936 Mar 1 2:00 @@ -419,7 +419,7 @@ differing by 24 hours; this corresponds Line. For example:</p> <pre> -#Zone NAME GMTOFF RULES FORMAT [UNTIL] +#Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Juneau 15:02:19 - LMT 1867 Oct 18 -8:57:41 - LMT ... </pre> @@ -458,7 +458,7 @@ given alphabetic string.</li> <p>An example of a specific amount of time is:</p> <pre> -#Zone NAME GMTOFF RULES FORMAT [UNTIL] +#Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Honolulu ... 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 12:00 ... @@ -466,8 +466,8 @@ Zone Pacific/Honolulu ... <p>Hawaii tried daylight saving time for three weeks in 1933 and decided they didn’t like it. <code>8-) </code>Note that -the <code>GMTOFF</code> column always contains the standard time -offset, so the wall clock time during this period was GMT − +the <code>STDOFF</code> column always contains the standard time +offset, so the local (wall clock) time during this period was GMT − 10:30 + 1:00 = GMT − 9:30.</p> <p>The <code>FORMAT</code> column specifies the usual abbreviation of @@ -492,7 +492,7 @@ appropriate Rule’s <code>LETTER</c <p>An example of a slash is:</p> <pre> -#Zone NAME GMTOFF RULES FORMAT [UNTIL] +#Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/London ... 1996 0:00 EU GMT/BST </pre> @@ -535,9 +535,9 @@ href="https://en.wikipedia.org/wiki/Inte the abbreviations. They are intended to be the values returned through the <code>"%Z"</code> format specifier to <a href="https://en.wikipedia.org/wiki/C_(programming_language)">C</a>’s -<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html"><code>strftime</code></a> +<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html"><code>strftime</code></a> function in the -<a href="http://kirste.userpage.fu-berlin.de/chemnet/use/info/libc/libc_19.html#SEC324">“C” locale</a>. +<a href="https://kirste.userpage.fu-berlin.de/chemnet/use/info/libc/libc_19.html#SEC324">“C” locale</a>. <li>If there is no generally-accepted abbreviation for a time zone, a numeric offset is used instead, e.g., <code>+07</code> for 7 hours @@ -569,7 +569,7 @@ Rule US 1945 only - Sep lastSun 2 <tr> <td colspan="6" align="center"><table><tr><td> <pre> -#Zone NAME GMTOFF RULES FORMAT [UNTIL] +#Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 -10:30 - HST 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 2:00 Index: src/lib/libc/time/tz-link.html diff -u src/lib/libc/time/tz-link.html:1.5 src/lib/libc/time/tz-link.html:1.6 --- src/lib/libc/time/tz-link.html:1.5 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/tz-link.html Wed Jul 3 11:50:16 2019 @@ -18,6 +18,46 @@ histories and planned futures are often is a summary of attempts to organize and record relevant data in this area. </p> + <h3>Outline</h3> + <nav> + <ul> + <li>The <code><abbr>tz</abbr></code> database product and process + <ul> + <li><a href="#tzdb">The <code><abbr>tz</abbr></code> database</a></li> + <li><a href="#download">Downloading the <code><abbr>tz</abbr></code> database</a></li> + <li><a href="#changes">Changes to the <code><abbr>tz</abbr></code> database</a></li> + <li><a href="#commentary">Commentary on the <code><abbr>tz</abbr></code> database</a></li> + </ul> + </li> + <li>Uses of the <code><abbr>tz</abbr></code> database + <ul> + <li><a href="#web">Web sites using recent versions of the <code><abbr>tz</abbr></code> database</a></li> + <li><a href="#protocols">Network protocols for <code><abbr>tz</abbr></code> data</a></li> + <li><a href="#compilers">Other <code><abbr>tz</abbr></code> compilers</a></li> + <li><a href="#TZif">Other <abbr>TZif</abbr> readers</a></li> + <li><a href="#software">Other <code><abbr>tz</abbr></code>-based time zone software</a></li> + </ul> + </li> + <li>Related data + <ul> + <li><a href="#other-dbs">Other time zone databases</a></li> + <li><a href="#maps">Maps</a></li> + <li><a href="#boundaries">Time zone boundaries</a></li> + </ul> + </li> + <li>Timekeeping concepts + <ul> + <li><a href="#civil">Civil time concepts and history</a></li> + <li><a href="#national">National histories of legal time</a></li> + <li><a href="#precision">Precision timekeeping</a></li> + <li><a href="#notation">Time notation</a></li> + <li><a href="#see-also">See also</a></li> + </ul> + </li> + </ul> + </nav> + +<section> <h2 id="tzdb">The <code><abbr title="time zone">tz</abbr></code> database</h2> <p> The <a href="https://en.wikipedia.org/wiki/Public_domain">public-domain</a> @@ -41,8 +81,6 @@ title="Berkeley Software Distribution">B <a href="https://www.openbsd.org">Open<abbr>BSD</abbr></a>, <a href="https://www.chromium.org/chromium-os">Chromium OS</a>, <a href="https://cygwin.com">Cygwin</a>, -<a href="http://www.delorie.com/djgpp/"><abbr -title="DJ's GNU Programming Platform">DJGPP</abbr></a>, <a href="https://en.wikipedia.org/wiki/MINIX">MINIX</a>, <a href="https://www.mysql.com">MySQL</a>, <a href="https://en.wikipedia.org/wiki/WebOS"><abbr @@ -50,13 +88,13 @@ title="Web Operating System">webOS</abbr <a href="https://ibm.com/aix"><abbr title="Advanced Interactive eXecutive">AIX</abbr></a>, <a href="https://en.wikipedia.org/wiki/BlackBerry_10">BlackBerry 10</a>, -<a href="https://www.apple.com/ios/"><abbr +<a href="https://www.apple.com/ios"><abbr title="iPhone OS">iOS</abbr></a>, -<a href="https://www.apple.com/macos/">macOS</a>, +<a href="https://www.apple.com/macos">macOS</a>, <a href="https://www.microsoft.com/en-us/windows">Microsoft Windows</a>, -<a href="https://www.hpe.com/info/openvms">Open<abbr +<a href="https://www.vmssoftware.com">Open<abbr title="Virtual Memory System">VMS</abbr></a>, -<a href="https://www.oracle.com/database/index.html">Oracle Database</a>, and +<a href="https://www.oracle.com/database/">Oracle Database</a>, and <a href="https://www.oracle.com/solaris">Oracle Solaris</a>.</p> <p> Each main entry in the database represents a <dfn>timezone</dfn> @@ -90,6 +128,9 @@ Universal Time</a> (<abbr>UTC</abbr>). The database also records when daylight saving time was in use, along with some time zone abbreviations such as <abbr>EST</abbr> for Eastern Standard Time in the <abbr>US</abbr>.</p> +</section> + +<section> <h2 id="download">Downloading the <code><abbr>tz</abbr></code> database</h2> <p> The following <a @@ -150,6 +191,9 @@ specified by <a href="https://tools.ietf The code also lets you read a <abbr>TZif</abbr> file and interpret timestamps for that location.</p> +</section> + +<section> <h2 id="changes">Changes to the <code><abbr>tz</abbr></code> database</h2> <p> The <code><abbr>tz</abbr></code> code and data @@ -228,6 +272,9 @@ found in <a href="theory.html">Theory an <a href="https://a0.github.io/a0-tzmigration/">A0 TimeZone Migration</a> displays changes between recent <code><abbr>tzdb</abbr></code> versions. </p> +</section> + +<section> <h2 id="commentary">Commentary on the <code><abbr>tz</abbr></code> database</h2> <ul> <li>The article @@ -241,6 +288,9 @@ href="https://blog.jonudell.net/2009/10/ literary appreciation of the Olson/Zoneinfo/tz database</a> comments on the database's style.</li> </ul> +</section> + +<section> <h2 id="web">Web sites using recent versions of the <code><abbr>tz</abbr></code> database</h2> <p> @@ -251,16 +301,15 @@ These are listed roughly in ascending or time and zones.</li> <li><a href="https://www.timejones.com">TimeJones.com</a>, <a href="https://timezoneconverterapp.com">Time Zone Converter</a> and -<a href="http://worldclock.com">The World Clock</a> +<a href="https://worldclock.com">The World Clock</a> are time zone converters.</li> <li><a -href="http://twiki.org/cgi-bin/xtra/tzdatepick.html">Date and Time Gateway</a> +href="https://twiki.org/cgi-bin/xtra/tzdatepick.html">Date and Time Gateway</a> lets you see the <code><abbr>TZ</abbr></code> values directly.</li> <li><a href="http://www.convertit.com/Go/ConvertIt/World_Time/Current_Time.ASP">Current Time in 1000 Places</a> uses descriptions of the values.</li> -<li><a href="http://www.timezoneconverter.com/cgi-bin/tzc.tzc">Time Zone -Converter</a> +<li><a href="https://timezoneconverterapp.com/">Time Zone Converter</a> uses a pulldown menu.</li> <li><a href="http://home.kpn.nl/vanadovv/time/TZworld.html">Complete timezone information for all countries</a> displays tables of DST rules. @@ -273,6 +322,9 @@ calculates the current time difference b <li><a href="http://www.wx-now.com">Weather Now</a> and <a href="http://www.thetimenow.com">The Time Now</a> list the weather too.</li> </ul> +</section> + +<section> <h2 id="protocols">Network protocols for <code><abbr>tz</abbr></code> data</h2> <ul> <li>The <a href="https://www.ietf.org">Internet Engineering Task Force</a>'s @@ -284,10 +336,10 @@ along with <a href="https://tools.ietf.o (Internet <abbr>RFC</abbr> 7809), a calendar access protocol for transferring time zone data by reference. The <a href="https://www.ietf.org/mailman/listinfo/tzdist-bis">tzdist-bis -mailing list</a> discusses the Internet draft <a +mailing list</a> discussed the Internet draft <a id="TZDIST-Geolocate" href="https://tools.ietf.org/html/draft-murchison-tzdist-geolocate">TZDIST -Geolocate Extension</a>, which lets a client determine its timezone +Geolocate Extension</a> (now expired), which let a client determine its timezone from its geographic location using a <a href="https://tools.ietf.org/html/rfc5870">'geo' URI</a>.</li> <li>The <a href="https://tools.ietf.org/html/rfc5545"> @@ -305,6 +357,9 @@ title="Extensible Markup Language">XML</ uses <a href="https://www.json.org"><abbr title="JavaScript Object Notation">JSON</abbr></a> format.</li> </ul> +</section> + +<section> <h2 id="compilers">Other <code><abbr>tz</abbr></code> compilers</h2> <ul> <li><a href="https://sourceforge.net/projects/vzic/">Vzic</a> is a <a @@ -318,7 +373,7 @@ General Public License (<abbr title="General Public License">GPL</abbr>)</a>.</li> <li><a href="https://sourceforge.net/projects/tzical/">tziCal – tz database conversion utility</a> is like Vzic, except for the <a -href="https://www.microsoft.com/net">.NET framework</a> +href="https://dotnet.microsoft.com">.NET framework</a> and with a <abbr>BSD</abbr>-style license.</li> <li><a href="https://metacpan.org/release/DateTime-TimeZone">DateTime::TimeZone</a> @@ -336,11 +391,9 @@ Database Parser</a> is a <a href="https://en.wikipedia.org/wiki/C%2B%2B">C++</a> parser and runtime library that is <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0355r4.html">moving -forward</a> for inclusion in the next iteration of <a -href="https://isocpp.org/std/the-standard"><em><abbr -title="International Organization for Standardization">ISO</abbr> -International Standard ISO/IEC 14882:2017(E) – Programming -Language C++</em></a>. +forward</a> for inclusion in +<a href="https://en.wikipedia.org/wiki/C++20">C++20</a>, +the next iteration of the C++ standard. It is freely available under the <abbr title="Massachusetts Institute of Technology">MIT</abbr> license.</li> <li><a id="ICU" href="http://site.icu-project.org">International Components for @@ -366,8 +419,7 @@ tool</a> compiles <code><abbr>tz</abbr>< Oracle Java.</li> <li>The <a href="https://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html">Java -SE <code>java.time</code> <abbr>API</abbr></a> in Java 8 and later -can be supplemented by <a +SE 8 Date and Time</a> <abbr>API</abbr> can be supplemented by <a href="https://www.threeten.org/threeten-extra/">ThreeTen-Extra</a>, which is freely available under a <abbr>BSD</abbr>-style license.</li> <li><a href="https://www.joda.org/joda-time/">Joda-Time – Java date @@ -409,16 +461,14 @@ license.</li> <li><a href="https://github.com/mde/timezone-js">TimezoneJS.Date</a>'s <abbr>API</abbr> is upward compatible with standard JavaScript Dates. It is freely available under the Apache License.</li> -<li><a href="https://github.com/sproutsocial/walltime-js">Walltime-js</a> -translates <abbr>UT</abbr> to local time. It is freely available under -the <abbr>MIT</abbr> license.</li> </ul> <li><a href="https://github.com/JuliaTime/">JuliaTime</a> contains a compiler from <code><abbr>tz</abbr></code> source into <a href="https://julialang.org/">Julia</a>. It is freely available under the <abbr>MIT</abbr> license.</li> -<li><a href="https://github.com/pavkam/tzdb">Delphi/<abbr -title="Free Pascal Compiler">FPC</abbr> Time Zone Database</a> +<li><a href="https://github.com/pavkam/tzdb"><abbr>TZDB</abbr> – +<abbr>IANA</abbr> Time Zone Database for Delphi/<abbr +title="Free Pascal Compiler">FPC</abbr></a> compiles from <code><abbr>tz</abbr></code> source into <a href="https://en.wikipedia.org/wiki/Object_Pascal">Object Pascal</a> as compiled by <a href="https://en.wikipedia.org/wiki/Delphi_(IDE)">Delphi</a> @@ -447,6 +497,9 @@ source into text files, along with a run files. Tcl is freely available under a <abbr>BSD</abbr>-style license.</li> </ul> +</section> + +<section> <h2 id="TZif">Other <abbr>TZif</abbr> readers</h2> <ul> <li>The <a @@ -505,6 +558,9 @@ package contains <a href="https://www.ha parses and uses <abbr>TZif</abbr> data. It is freely available under a <abbr>BSD</abbr>-style license.</li> </ul> +</section> + +<section> <h2 id="software">Other <code><abbr>tz</abbr></code>-based time zone software</h2> <ul> <li><a href="https://foxclocks.org">FoxClocks</a> @@ -542,7 +598,7 @@ which stores time zone data in the <a href="https://unicode.org/cldr/charts/latest/supplemental/zone_tzid.html">Zone → Tzid table</a> or <a -href="https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml"><abbr>XML</abbr> +href="https://github.com/unicode-org/cldr/blob/master/common/supplemental/windowsZones.xml"><abbr>XML</abbr> file</a> of the <abbr>CLDR</abbr> data maps proprietary zone IDs to <code><abbr>tz</abbr></code> names. These mappings can be performed programmatically via the <a href="https://github.com/mj1856/TimeZoneConverter">TimeZoneConverter</a> .NET library, @@ -562,6 +618,9 @@ a macOS program. Its developers <a href="http://veladg.com/tzoffer.html">offer free licenses</a> to <code><abbr>tz</abbr></code> contributors.</li> </ul> +</section> + +<section> <h2 id="other-dbs">Other time zone databases</h2> <ul> <li><a href="https://www.astro.com/atlas">Time-zone Atlas</a> @@ -590,6 +649,9 @@ Schedules Information Manual</a> of the International Air Transport Association gives current time zone rules for airports served by commercial aviation.</li> </ul> +</section> + +<section> <h2 id="maps">Maps</h2> <ul> <li>The <a href="https://www.cia.gov/index.html">United States Central @@ -598,15 +660,15 @@ title="Central Intelligence Agency">CIA< href="https://www.cia.gov/library/publications/the-world-factbook/graphics/ref_maps/physical/pdf/standard_time_zones_of_the_world.pdf">time zone map</a>; the <a -href="https://www.lib.utexas.edu/maps/world.html">Perry–Castañeda +href="https://legacy.lib.utexas.edu/maps/world.html">Perry–Castañeda Library Map Collection</a> of the University of Texas at Austin has copies of recent editions. The pictorial quality is good, but the maps do not indicate daylight saving time, and parts of the data are a few years out of date.</li> -<li><a href="https://www.worldtimezone.com">Current time around the world -and standard time zones map of the world</a> +<li><a href="https://www.worldtimezone.com">World Time Zone Map +with current time</a> has several fancy time zone maps; it covers Russia particularly well. The maps' pictorial quality is not quite as good as the <abbr>CIA</abbr>'s @@ -617,6 +679,9 @@ much is time wrong around the world?</a> mean solar and standard time, highlighting areas such as western China where the two differ greatly. It's a bit out of date, unfortunately.</li> </ul> +</section> + +<section> <h2 id="boundaries">Time zone boundaries</h2> <p>Geographical boundaries between timezones are available from several <a href="https://en.wikipedia.org/wiki/Geolocation">geolocation</a> @@ -691,6 +756,9 @@ for land and territorial waters only). A clocks any time after entering a new time zone; midnight changes are common.</li> </ul> +</section> + +<section> <h2 id="civil">Civil time concepts and history</h2> <ul> <li><a href="https://www.nist.gov/pml/time-and-frequency-division/popular-links/walk-through-time">A @@ -712,10 +780,13 @@ time zone boundary.</li> <li><a href="http://statoids.com/tconcept.html">Basic Time Zone Concepts</a> discusses terminological issues behind time zones.</li> </ul> +</section> + +<section> <h2 id="national">National histories of legal time</h2> <dl> <dt>Australia</dt> -<dd>The Parliamentary Library has commissioned a <a +<dd>The Parliamentary Library commissioned a <a href="https://www.aph.gov.au/binaries/library/pubs/rp/2009-10/10rp10.pdf">research paper on daylight saving time in Australia</a>. The Bureau of Meteorology publishes a list of <a @@ -733,8 +804,8 @@ Portuguese)</a>.</dd> <dt>Canada</dt> <dd>National Research Council Canada publishes current and some older information about <a -href="https://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html">time -zones & daylight saving time</a>.</dd> +href="https://nrc.canada.ca/en/certifications-evaluations-standards/canadas-official-time/time-zones-daylight-saving-time">time +zones and daylight saving time</a>.</dd> <dt>Chile</dt> <dd>The Hydrographic and Oceanographic Service of the Chilean Navy publishes a <a href="https://www.horaoficial.cl/historia_hora.html" hreflang="es">history of @@ -760,7 +831,7 @@ of Legal Time in Germany</a>.</dd> href="ftp://ftp.cs.huji.ac.il/pub/tz/announcements" hreflang="he">announcements (in Hebrew)</a>.</dd> <dt>Italy</dt> -<dd>The National Institute of Metrological Research maintains a +<dd>The National Institute of Metrological Research publishes a <a href="http://oldsite.inrim.it/res/tf/ora_legale_i.shtml" hreflang="it">table of civil time (in Italian)</a>.</dd> <dt>Malaysia</dt> @@ -777,22 +848,17 @@ covers the history of local time in the <dt>New Zealand</dt> <dd>The Department of Internal Affairs maintains a brief <a href="https://www.dia.govt.nz/Daylight-Saving-History">History of -Daylight Saving</a>. The privately-maintained <a -href="http://astrologyschool.com/nztime.html">History of New Zealand -time</a> has more details.</dd> +Daylight Saving</a>.</dd> <dt>Singapore</dt> <dd><a id="Singapore" -href="http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html">Why +href="http://www.math.nus.edu.sg/~mathelmr/teaching/timezone.html">Why is Singapore in the "Wrong" Time Zone?</a> details the history of legal time in Singapore and Malaysia.</dd> <dt>United Kingdom</dt> <dd><a href="https://www.polyomino.org.uk/british-time/">History of legal time in Britain</a> discusses in detail the country -with perhaps the best-documented history of clock adjustments. -The National Physical Laboratory also maintains an <a -href="http://www.npl.co.uk/educate-explore/what-is-time/archive-of-summer-time-dates">Archive -of Summer time dates</a>.</dd> +with perhaps the best-documented history of clock adjustments.</dd> <dt>United States</dt> <dd>The Department of Transportation's <a href="https://www.transportation.gov/regulations/recent-time-zone-proceedings">Recent @@ -800,9 +866,12 @@ Time Zone Proceedings</a> lists changes <dt>Uruguay</dt> <dd>The Oceanography, Hydrography, and Meteorology Service of the Uruguayan Navy (SOHMA) publishes an annual <a -href="http://www.armada.mil.uy/Pagina/institucion/dimat/sohma/almanaque.html" hreflang="es">almanac +href="http://www.armada.gub.uy/sohma/index.php/servicios/datos-astronomicos" hreflang="es">almanac (in Spanish)</a>.</dd> </dl> +</section> + +<section> <h2 id="precision">Precision timekeeping</h2> <ul> <li><a @@ -891,6 +960,9 @@ without Leap Seconds</a> gives pointers contentious issue, which was active until 2015 and could become active again.</li> </ul> +</section> + +<section> <h2 id="notation">Time notation</h2> <ul> <li>The <a id="CLDR" href="http://cldr.unicode.org">Unicode Common Locale Data @@ -905,14 +977,14 @@ both <abbr title="Locale Data Markup Lan (an <abbr>XML</abbr> format) and <abbr>JSON</abbr>. <li> <a href="https://www.cl.cam.ac.uk/~mgk25/iso-time.html">A summary of -the international standard date and time notation</a> is a good -summary of +the international standard date and time notation</a> covers <a -href="https://www.iso.org/standard/40874.html"><em><abbr>ISO</abbr> -8601:2004 – Data elements and interchange formats – Information -interchange – Representation of dates and times</em></a>.</li> +href="https://www.iso.org/standard/70907.html"><em><abbr +title="International Organization for Standardization">ISO</abbr> +8601-1:2019 – Date and time – Representations for information +interchange – Part 1: Basic rules</em></a>.</li> <li> -<a href="https://www.w3.org/TR/xmlschema-2/#dateTime"><abbr>XML</abbr> +<a href="https://www.w3.org/TR/xmlschema/#dateTime"><abbr>XML</abbr> Schema: Datatypes – dateTime</a> specifies a format inspired by <abbr>ISO</abbr> 8601 that is in common use in <abbr>XML</abbr> data.</li> <li><a href="https://tools.ietf.org/html/rfc5322#section-3.3">§3.3 of @@ -959,18 +1031,23 @@ any future changes to the rules. One sho local time is nine hours ahead of <abbr>UT</abbr> and the time zone is called "<abbr>GMT</abbr>".</li> </ul> +</section> + +<section> <h2 id="see-also">See also</h2> <ul> <li><a href="theory.html">Theory and pragmatics of the tz code and data</a></li> <li><a href="tz-art.html">Time and the Arts</a></li> </ul> +</section> + +<footer> <hr> -<address> This web page is in the public domain, so clarified as of 2009-05-17 by Arthur David Olson. <br> Please send corrections to this web page to the <a href="mailto:t...@iana.org">time zone mailing list</a>. -</address> +</footer> </body> </html> Index: src/lib/libc/time/tzset.3 diff -u src/lib/libc/time/tzset.3:1.41 src/lib/libc/time/tzset.3:1.42 --- src/lib/libc/time/tzset.3:1.41 Sat Apr 20 03:27:39 2019 +++ src/lib/libc/time/tzset.3 Wed Jul 3 11:50:16 2019 @@ -1,5 +1,5 @@ -.\" $NetBSD: tzset.3,v 1.41 2019/04/20 07:27:39 wiz Exp $ -.Dd April 18, 2019 +.\" $NetBSD: tzset.3,v 1.42 2019/07/03 15:50:16 christos Exp $ +.Dd July 2, 2019 .Dt TZSET 3 .Os .Sh NAME @@ -127,7 +127,7 @@ If .Ev TZ is .Dv NULL , -the best available approximation to local wall clock time, as +the best available approximation to local (wall clock) time, as specified by the .Xr tzfile 5 format file Index: src/lib/libc/time/version diff -u src/lib/libc/time/version:1.11 src/lib/libc/time/version:1.12 --- src/lib/libc/time/version:1.11 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/version Wed Jul 3 11:50:16 2019 @@ -1 +1 @@ -2019a +2019b Index: src/lib/libc/time/zic.8 diff -u src/lib/libc/time/zic.8:1.32 src/lib/libc/time/zic.8:1.33 --- src/lib/libc/time/zic.8:1.32 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/zic.8 Wed Jul 3 11:50:16 2019 @@ -1,5 +1,5 @@ -.\" $NetBSD: zic.8,v 1.32 2019/04/04 18:18:31 christos Exp $ -.Dd April 4, 2019 +.\" $NetBSD: zic.8,v 1.33 2019/07/03 15:50:16 christos Exp $ +.Dd July 2, 2019 .Dt ZIC 8 .Os .Sh NAME @@ -8,6 +8,8 @@ .Sh SYNOPSIS .Nm .Op Fl \-version +.Op Fl \-help +.Op Fl b .Op Fl d Ar directory .Op Fl L Ar leapsecondfilename .Op Fl l Ar localtime @@ -34,13 +36,34 @@ standard input is read. Output version information and exit. .It Fl \-help Output short usage message and exit. +.It Fl b Ar bloat +Output backward-compatibility data as specified by +.Ar bloat . +If +.Ar bloat +is +.Dv fat , +generate additional data entries that work around potential bugs or +incompatibilities in older software, such as software that mishandles +the 64-bit generated data. +If +.Ar bloat +is +.Dv slim , +keep the output files small; this can help check for the bugs +and incompatibilities. +Although the default is currently +.Dv fat , +this is intended to change in future +.Nm +versions, as software that mishandles the 64-bit data typically +mishandles timestamps after the year 2038 anyway. +Also see the +.Fl r +option for another way to shrink output size. .It Fl d Ar directory Create time conversion information files in the named directory rather than in the standard directory named below. -.It Fl L Ar leapsecondfilename -Read leap second information from the file with the given name. -If this option is not used, -no leap second information appears in output files. .It Fl l Ar timezone Use the .Ar timezone @@ -48,16 +71,28 @@ as local time. .Nm will act as if the input contained a link line of the form .Dl Link timezone localtime +.It Fl L Ar leapsecondfilename +Read leap second information from the file with the given name. +If this option is not used, +no leap second information appears in output files. .It Fl p Ar timezone Use .Ar timezone's rules when handling POSIX-format TZ strings like -.Dq CST6CDT +.Qq EET\*-2EEST that lack transition rules. .Nm will act as if the input contained a link line of the form .Dl Link timezone posixrules +.Pp +This feature 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 +.Fl b Ar slim +if +.Va timezone's +transitions are at standard time or UT instead of local time. .It Fl r Op Ar @lo / Op Ar @hi Reduce the size of output files by limiting their applicability to timestamps in the range from @@ -87,6 +122,9 @@ Or using zic -r @$(date +%s) .Ed omits data intended for past timestamps. +Also see the +.Fl b Ar slim +option for another way to shrink output size. .It Fl t Ar file When creating local time information, put the configuration link in the named file rather than in the standard location. @@ -97,20 +135,48 @@ Be more verbose, and complain about the The input specifies a link to a link. .It A year that appears in a data file is outside the range -of years representable by -.Xr time 2 -values. +of representable years. .It A time of 24:00 or more appears in the input. Pre-1998 versions of -.Xr zic 8 +.Nm prohibit 24:00, and pre-2007 versions prohibit times greater than 24:00. .It A rule goes past the start or end of the month. Pre-2004 versions of -.Xr zic 8 +.Nm prohibit this. .It +A time zone abbreviation uses a +.Dv %z +format. +Pre-2015 versions of +.Nm +do not support this. +.It +A timestamp contains fractional seconds. +Pre-2018 versions of +.Nm +do not support this. +.It +The input contains abbreviations that are mishandled by pre-2018 versions of +.Nm +due to a longstanding coding bug. +These abbreviations include +.Qq L +for +.Qq Link , +.Qq mi +for +.Qq min , +.Qq Sa +for +.Qq Sat , +and +.Qq Su +for +.Qq Sun . +.It 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. @@ -126,18 +192,25 @@ output formats. These compatibility issues affect only timestamps before 1970 or after the start of 2038. .It -A time zone abbreviation has fewer than 3 characters. -POSIX requires at least 3. +The output file contains more than 1200 transitions, +which may be mishandled by some clients. +The current reference client supports at most 2000 transitions; +pre-2014 versions of the reference client support at most 1200 +transitions. +.It +A time zone abbreviation has fewer than 3 or more than 6 characters. +POSIX requires at least 3, and requires implementations to support +at least 6. .It An output file name contains a byte that is not an ASCII letter, -.Dq - , -.Dq / , +.Qq - , +.Qq / , or -.Dq _ ; +.Qq _ ; or it or it contains a file name component that contains more than 14 bytes or that starts with -.Dq - . +.Qq - . .El .El .Pp @@ -180,11 +253,11 @@ rule lines, zone lines, and link lines. Names must be in English and are case insensitive. They appear in several contexts, and include month and weekday names and keywords such as -.Dq maximum , -.Dq only , -.Dq Rolling , +.Qq maximum , +.Qq only , +.Qq Rolling , and -.Dq Zone . +.Qq Zone . A name can be abbreviated by omitting all but an initial prefix; any abbreviation must be unambiguous in context. .Pp @@ -236,7 +309,7 @@ may be used to repeat the value of the field. .It TYPE should be -.Dq - +.Qq - and is present for compatibility with older versions of .Nm in which it could contain year types. @@ -262,15 +335,24 @@ last Sunday on or before the 25th .Pp Names of days of the week may be abbreviated or spelled out in full. A weekday name (e.g., -.Dq Sunday ) +.Qq Sunday ) or a weekday name preceded by -.Dq last +.Qq last (e.g., -.Dq lastSunday ) +.Qq lastSunday ) may be abbreviated or spelled out in full. -Note that there must be no spaces within the +There must be no white space characters within the .Em ON field. +The +.Qq <= +and +.Qq >= +constructs can result in a day in the neighboring month; +for example, the IN-ON combination +.Qq "Oct Sun>=31" +tands for the first Sunday on or after October 31, +even if that Sunday occurs in November. .It AT Gives the time of day at which the rule takes effect, relative to 00:00, the start of a calendar day. @@ -307,13 +389,12 @@ to other applications requiring greater The source format does not specify any maximum precision. Any of these forms may be followed by the letter .Em w -if the given time is local -.Dq wall clock +if the given time is local or +.Qq wall clock time, .Em s -if the given time is local -.Dq standard -time, or +if the given time is standard time without any adjustment for daylight saving, +or .Em u (or .Em g @@ -321,7 +402,7 @@ or .Em z ) if the given time is universal time; in the absence of an indicator, -wall clock time is assumed. +local (wall clock) time is assumed. These forms ignore leap seconds; for example, if a leap second occurs at 00:59:60 local time, .q "1:00" @@ -356,15 +437,15 @@ from a 10:00 standard time plus a 1:00 .Em SAVE . .It LETTER/S Gives the -.Dq variable part +.Qq variable part (for example, the -.Dq S +.Qq S or -.Dq D +.Qq D in -.Dq EST +.Qq EST or -.Dq EDT ) +.Qq EDT ) of time zone abbreviations to be used when this rule is in effect. If this field is .Em \&- , @@ -373,7 +454,7 @@ the variable part is null. .Pp A zone line has the form .Pp -.Dl Zone NAME UTOFF RULES/SAVE FORMAT [UNTIL] +.Dl Zone NAME STDOFF RULES/SAVE FORMAT [UNTIL] .Pp For example: .Pp @@ -386,13 +467,14 @@ The name of the timezone. This is the name used in creating the time conversion information file for the timezone. It should not contain a file name component -.Dq . +.Qq . or -.Dq .. ; +.Qq .. ; a file name component is a maximal substring that does not contain -.Dq / . -.It UTOFF -The amount of time to add to UT to get standard time. +.Qq / . +.It STDOFF +The amount of time to add to UT to get standard time, +without any adjustment for daylight saving. This field has the same format as the .Em AT and @@ -414,7 +496,7 @@ The format for time zone abbreviations. The pair of characters .Em %s is used to show where the -.Dq variable part +.Qq variable part of the time zone abbreviation goes. Alternatively, a format can use the pair of characters .Em %z @@ -435,12 +517,12 @@ a slash separates standard and daylight abbreviations. To conform to POSIX, a time zone abbreviation should contain only alphanumeric ASCII characters, -.Dq + +.Qq + and -.Dq \&- . +.Qq \&- . .It UNTIL The time at which the UT offset or the rule(s) change for a location. -It takes the form of YEAR [MONTH [DAY [TIME]]]. +It takes the form of one to four fields YEAR [MONTH [DAY [TIME]]]. If this is specified, the time zone information is generated from the given UT offset and rule change until the time specified, which is interpreted using @@ -450,10 +532,10 @@ fields of a rule; trailing fields can be earliest possible value for the missing fields. .Pp The next line must be a -.Dq continuation +.Qq continuation line; this has the same form as a zone line except that the string -.Dq Zone +.Qq Zone and the name are omitted, as the continuation line will place information starting at the time specified as the .Em until @@ -524,22 +606,22 @@ The .Em CORR field should be -.Dq \&+ +.Qq \&+ if a second was added or -.Dq \&- +.Qq \&- if a second was skipped. The .Em R/S field should be (an abbreviation of) -.Dq Stationary +.Qq Stationary if the leap second time given by the other fields should be interpreted as UTC or (an abbreviation of) -.Dq Rolling +.Qq Rolling if the leap second time given by the other fields should be interpreted as -local wall clock time. +local (wall clock) time. .Sh EXTENDED EXAMPLE Here is an extended example of .Ic zic @@ -560,10 +642,10 @@ and for its predecessor organization, th .It Rule EU 1996 max - Oct lastSun 1:00u 0 - .El .Pp -.Bl -column -compact -offset indent "# Zone" "Europe/Zurich" "0:34:08" "RULES/SAVE" "FORMAT" "UNTIL" -.It # Zone NAME UTOFF RULES/SAVE FORMAT [UNTIL] +.Bl -column -compact -offset indent "# Zone" "Europe/Zurich" "0:29:45.50" "RULES/SAVE" "FORMAT" "UNTIL" +.It # Zone NAME STDOFF RULES/SAVE FORMAT [UNTIL] .It Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 -.It 0:29:44 - BMT 1894 Jun +.It 0:29:45.50 - BMT 1894 Jun .It 1:00 Swiss CE%sT 1981 .It 1:00 EU CE%sT .Pp @@ -576,12 +658,13 @@ In this example, the timezone is named E as Europe/Vaduz. This example says that Zurich was 34 minutes and 8 seconds east of UT until 1853-07-16 at 00:00, when the legal offset -was changed to 7\(de\|26\(fm\|22.50\(sd; although this works out to -0:29:45.50, the input format cannot represent fractional seconds so it -is rounded here. +was changed to 7\(de\|26\(fm\|22.50\(sd; which this works out to +0:29:45.50; +.Nm +treats this by rounding it to 0:29:46. After 1894-06-01 at 00:00 the UT offset became one hour and Swiss daylight saving rules (defined with lines beginning with -.Dq "Rule Swiss" +.Qq "Rule Swiss" apply. From 1981 to the present, EU daylight saving rules have From 1981 to the present, EU daylight saving rules have @@ -596,9 +679,9 @@ Until 1995 it ended the last Sunday in S but this changed to the last Sunday in October starting in 1996. .Pp For purposes of display, -.Dq LMT +.Qq LMT and -.Dq BMT +.Qq BMT were initially used, respectively. Since Swiss rules and later EU rules were applied, the time zone abbreviation @@ -628,7 +711,7 @@ coincides with and is equal to a clock retreat caused by a change in UT offset, .Ic zic produces a single transition to daylight saving at the new UT offset -(without any change in wall clock time). +without any change in local (wall clock) time. To get separate transitions use multiple zone continuation lines specifying transition instants using universal time. Index: src/lib/libc/time/zic.c diff -u src/lib/libc/time/zic.c:1.74 src/lib/libc/time/zic.c:1.75 --- src/lib/libc/time/zic.c:1.74 Thu Apr 4 14:18:31 2019 +++ src/lib/libc/time/zic.c Wed Jul 3 11:50:16 2019 @@ -1,8 +1,9 @@ -/* $NetBSD: zic.c,v 1.74 2019/04/04 18:18:31 christos Exp $ */ +/* $NetBSD: zic.c,v 1.75 2019/07/03 15:50:16 christos Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2006-07-17 by Arthur David Olson. */ +/* Compile .zi time zone data into TZif binary files. */ #if HAVE_NBTOOL_CONFIG_H #include "nbtool_config.h" @@ -10,7 +11,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: zic.c,v 1.74 2019/04/04 18:18:31 christos Exp $"); +__RCSID("$NetBSD: zic.c,v 1.75 2019/07/03 15:50:16 christos Exp $"); #endif /* !defined lint */ #include "private.h" @@ -101,13 +102,10 @@ struct rule { int r_wday; zic_t r_tod; /* time from midnight */ - bool r_todisstd; /* above is standard time if 1 */ - /* or wall clock time if 0 */ - bool r_todisgmt; /* above is GMT if 1 */ - /* or local time if 0 */ + bool r_todisstd; /* is r_tod standard time? */ + bool r_todisut; /* is r_tod UT? */ bool r_isdst; /* is this daylight saving time? */ - zic_t r_stdoff; /* offset from default time (which is - usually standard time) */ + zic_t r_save; /* offset from standard time */ const char * r_abbrvar; /* variable part of abbreviation */ bool r_todo; /* a rule to do (used in outzone) */ @@ -127,13 +125,13 @@ struct zone { lineno z_linenum; const char * z_name; - zic_t z_gmtoff; + zic_t z_stdoff; char * z_rule; const char * z_format; char z_format_specifier; bool z_isdst; - zic_t z_stdoff; + zic_t z_save; struct rule * z_rules; ptrdiff_t z_nrules; @@ -171,7 +169,7 @@ static void associate(void); static void dolink(const char *, const char *, bool); static char ** getfields(char * buf); static zic_t gethms(const char * string, const char * errstring); -static zic_t getstdoff(char *, bool *); +static zic_t getsave(char *, bool *); static void infile(const char * filename); static void inleap(char ** fields, int nfields); static void inlink(char ** fields, int nfields); @@ -242,7 +240,7 @@ static int typecnt; */ #define ZF_NAME 1 -#define ZF_GMTOFF 2 +#define ZF_STDOFF 2 #define ZF_RULE 3 #define ZF_FORMAT 4 #define ZF_TILYEAR 5 @@ -256,7 +254,7 @@ static int typecnt; ** Which fields are which on a Zone continuation line. */ -#define ZFC_GMTOFF 0 +#define ZFC_STDOFF 0 #define ZFC_RULE 1 #define ZFC_FORMAT 2 #define ZFC_TILYEAR 3 @@ -277,7 +275,7 @@ static int typecnt; #define RF_MONTH 5 #define RF_DAY 6 #define RF_TOD 7 -#define RF_STDOFF 8 +#define RF_SAVE 8 #define RF_ABBRVAR 9 #define RULE_FIELDS 10 @@ -418,11 +416,11 @@ static struct attype { bool dontmerge; unsigned char type; } * attypes; -static zic_t gmtoffs[TZ_MAX_TYPES]; +static zic_t utoffs[TZ_MAX_TYPES]; static char isdsts[TZ_MAX_TYPES]; -static unsigned char abbrinds[TZ_MAX_TYPES]; +static unsigned char desigidx[TZ_MAX_TYPES]; static bool ttisstds[TZ_MAX_TYPES]; -static bool ttisgmts[TZ_MAX_TYPES]; +static bool ttisuts[TZ_MAX_TYPES]; static char chars[TZ_MAX_CHARS]; static zic_t trans[TZ_MAX_LEAPS]; static zic_t corr[TZ_MAX_LEAPS]; @@ -584,8 +582,9 @@ usage(FILE *stream, int status) { fprintf(stream, _("%s: usage is %s [ --version ] [ --help ] [ -v ] \\\n" - "\t[ -l localtime ] [ -p posixrules ] [ -d directory ] \\\n" - "\t[ -t localtime-link ] [ -L leapseconds ] [ -r '[@lo][/@hi]' ] \\\n" + "\t[ -b {slim|fat} ] [ -d directory ] [ -l localtime ]" + " [ -L leapseconds ] \\\n" + "\t[ -p posixrules ] [ -r '[@lo][/@hi]' ] [ -t localtime-link ] \\\n" "\t[ filename ... ]\n\n" "Report bugs to %s.\n"), progname, progname, REPORT_BUGS_TO); @@ -660,6 +659,21 @@ static const char * leapsec; static const char * tzdefault; static const char * yitcommand; +/* -1 if the TZif output file should be slim, 0 if default, 1 if the + output should be fat for backward compatibility. Currently the + default is fat, although this may change. */ +static int bloat; + +static bool +want_bloat(void) +{ + return 0 <= bloat; +} + +#ifndef ZIC_BLOAT_DEFAULT +# define ZIC_BLOAT_DEFAULT "fat" +#endif + int main(int argc, char **argv) { @@ -691,10 +705,22 @@ main(int argc, char **argv) } else if (strcmp(argv[k], "--help") == 0) { usage(stdout, EXIT_SUCCESS); } - while ((c = getopt(argc, argv, "d:l:L:p:r:st:vy:")) != EOF && c != -1) + while ((c = getopt(argc, argv, "b:d:l:L:p:r:st:vy:")) != EOF && c != -1) switch (c) { default: usage(stderr, EXIT_FAILURE); + case 'b': + if (strcmp(optarg, "slim") == 0) { + if (0 < bloat) + error(_("incompatible -b options")); + bloat = -1; + } else if (strcmp(optarg, "fat") == 0) { + if (bloat < 0) + error(_("incompatible -b options")); + bloat = 1; + } else + error(_("invalid option: -b '%s'"), optarg); + break; case 'd': if (directory == NULL) directory = optarg; @@ -780,6 +806,8 @@ _("%s: invalid time range: %s\n"), } if (optind == argc - 1 && strcmp(argv[optind], "=") == 0) usage(stderr, EXIT_FAILURE); /* usage message by request */ + if (bloat == 0) + bloat = strcmp(ZIC_BLOAT_DEFAULT, "slim") == 0 ? -1 : 1; if (directory == NULL) directory = TZDIR; if (tzdefault == NULL) @@ -1078,8 +1106,7 @@ associate(void) { struct zone * zp; struct rule * rp; - ptrdiff_t base, out; - int i, j; + ptrdiff_t i, j, base, out; if (nrules != 0) { qsort(rules, (size_t)nrules, sizeof *rules, rcomp); @@ -1134,7 +1161,7 @@ associate(void) ** Maybe we have a local standard time offset. */ eat(zp->z_filename, zp->z_linenum); - zp->z_stdoff = getstdoff(zp->z_rule, &zp->z_isdst); + zp->z_save = getsave(zp->z_rule, &zp->z_isdst); /* ** Note, though, that if there's no rule, ** a '%s' in the format is a bad thing. @@ -1292,10 +1319,10 @@ warning(_("values over 24 hours not hand } static zic_t -getstdoff(char *field, bool *isdst) +getsave(char *field, bool *isdst) { int dst = -1; - zic_t stdoff; + zic_t save; size_t fieldlen = strlen(field); if (fieldlen != 0) { char *ep = field + fieldlen - 1; @@ -1304,9 +1331,9 @@ getstdoff(char *field, bool *isdst) case 's': dst = 0; *ep = '\0'; break; } } - stdoff = gethms(field, _("invalid saved time")); - *isdst = dst < 0 ? stdoff != 0 : dst; - return stdoff; + save = gethms(field, _("invalid saved time")); + *isdst = dst < 0 ? save != 0 : dst; + return save; } static void @@ -1329,7 +1356,7 @@ inrule(char **fields, int nfields) } r.r_filename = filename; r.r_linenum = linenum; - r.r_stdoff = getstdoff(fields[RF_STDOFF], &r.r_isdst); + r.r_save = getsave(fields[RF_SAVE], &r.r_isdst); rulesub(&r, fields[RF_LOYEAR], fields[RF_HIYEAR], fields[RF_COMMAND], fields[RF_MONTH], fields[RF_DAY], fields[RF_TOD]); r.r_name = ecpyalloc(fields[RF_NAME]); @@ -1390,13 +1417,13 @@ inzsub(char **fields, int nfields, bool char * cp; char * cp1; static struct zone z; - int i_gmtoff, i_rule, i_format; + int i_stdoff, i_rule, i_format; int i_untilyear, i_untilmonth; int i_untilday, i_untiltime; bool hasuntil; if (iscont) { - i_gmtoff = ZFC_GMTOFF; + i_stdoff = ZFC_STDOFF; i_rule = ZFC_RULE; i_format = ZFC_FORMAT; i_untilyear = ZFC_TILYEAR; @@ -1407,7 +1434,7 @@ inzsub(char **fields, int nfields, bool } else if (!namecheck(fields[ZF_NAME])) return false; else { - i_gmtoff = ZF_GMTOFF; + i_stdoff = ZF_STDOFF; i_rule = ZF_RULE; i_format = ZF_FORMAT; i_untilyear = ZF_TILYEAR; @@ -1418,7 +1445,7 @@ inzsub(char **fields, int nfields, bool } z.z_filename = filename; z.z_linenum = linenum; - z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UT offset")); + z.z_stdoff = gethms(fields[i_stdoff], _("invalid UT offset")); if ((cp = strchr(fields[i_format], '%')) != 0) { if ((*++cp != 's' && *cp != 'z') || strchr(cp, '%') || strchr(fields[i_format], '/')) { @@ -1611,26 +1638,26 @@ rulesub(struct rule *rp, const char *loy } rp->r_month = lp->l_value; rp->r_todisstd = false; - rp->r_todisgmt = false; + rp->r_todisut = false; dp = ecpyalloc(timep); if (*dp != '\0') { ep = dp + strlen(dp) - 1; switch (lowerit(*ep)) { case 's': /* Standard */ rp->r_todisstd = true; - rp->r_todisgmt = false; + rp->r_todisut = false; *ep = '\0'; break; case 'w': /* Wall */ rp->r_todisstd = false; - rp->r_todisgmt = false; + rp->r_todisut = false; *ep = '\0'; break; case 'g': /* Greenwich */ case 'u': /* Universal */ case 'z': /* Zulu */ rp->r_todisstd = true; - rp->r_todisgmt = true; + rp->r_todisut = true; *ep = '\0'; break; } @@ -1797,17 +1824,6 @@ atcomp(const void *avp, const void *bvp) return (a < b) ? -1 : (a > b); } -static void -swaptypes(int i, int j) -{ - { zic_t t = gmtoffs[i]; gmtoffs[i] = gmtoffs[j]; gmtoffs[j] = t; } - { char t = isdsts[i]; isdsts[i] = isdsts[j]; isdsts[j] = t; } - { unsigned char t = abbrinds[i]; abbrinds[i] = abbrinds[j]; - abbrinds[j] = t; } - { bool t = ttisstds[i]; ttisstds[i] = ttisstds[j]; ttisstds[j] = t; } - { bool t = ttisgmts[i]; ttisgmts[i] = ttisgmts[j]; ttisgmts[j] = t; } -} - struct timerange { int defaulttype; ptrdiff_t base, count; @@ -1874,17 +1890,24 @@ writezone(const char *const name, const toi = 0; fromi = 0; for ( ; fromi < timecnt; ++fromi) { - if (toi != 0 && ((attypes[fromi].at + - gmtoffs[attypes[toi - 1].type]) <= - (attypes[toi - 1].at + gmtoffs[toi == 1 ? 0 - : attypes[toi - 2].type]))) { + if (toi != 0 + && ((attypes[fromi].at + + utoffs[attypes[toi - 1].type]) + <= (attypes[toi - 1].at + + utoffs[toi == 1 ? 0 + : attypes[toi - 2].type]))) { attypes[toi - 1].type = attypes[fromi].type; continue; } if (toi == 0 || attypes[fromi].dontmerge - || attypes[toi - 1].type != attypes[fromi].type) + || (utoffs[attypes[toi - 1].type] + != utoffs[attypes[fromi].type]) + || (isdsts[attypes[toi - 1].type] + != isdsts[attypes[fromi].type]) + || (desigidx[attypes[toi - 1].type] + != desigidx[attypes[fromi].type])) attypes[toi++] = attypes[fromi]; } timecnt = toi; @@ -1927,7 +1950,7 @@ writezone(const char *const name, const seconds, as the idea is to insert a transition just before 32-bit time_t rolls around, and this occurs at a slightly different moment if transitions are leap-second corrected. */ - if (WORK_AROUND_QTBUG_53071 && timecnt != 0 + if (WORK_AROUND_QTBUG_53071 && timecnt != 0 && want_bloat() && ats[timecnt - 1] < y2038_boundary - 1 && strchr(string, '<')) { ats[timecnt] = y2038_boundary - 1; types[timecnt] = types[timecnt - 1]; @@ -1976,7 +1999,7 @@ writezone(const char *const name, const int old0; char omittype[TZ_MAX_TYPES]; int typemap[TZ_MAX_TYPES]; - int thistypecnt; + int thistypecnt, stdcnt, utcnt; char thischars[TZ_MAX_CHARS]; int thischarcnt; bool toomanytimes; @@ -2048,7 +2071,6 @@ writezone(const char *const name, const THISDEFAULTTYPE appears as type 0 in the output instead of OLD0. TYPEMAP also omits unused types. */ old0 = strlen(omittype); - swaptypes(old0, thisdefaulttype); #ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH /* @@ -2059,7 +2081,7 @@ writezone(const char *const name, const ** (to help get global "altzone" and "timezone" variables ** set correctly). */ - { + if (want_bloat()) { int mrudst, mrustd, hidst, histd, type; hidst = histd = mrudst = mrustd = -1; @@ -2067,33 +2089,37 @@ writezone(const char *const name, const if (isdsts[types[i]]) mrudst = types[i]; else mrustd = types[i]; - for (i = old0; i < typecnt; i++) - if (!omittype[i]) { - if (isdsts[i]) - hidst = i; - else histd = i; - } + for (i = old0; i < typecnt; i++) { + int h = (i == old0 ? thisdefaulttype + : i == thisdefaulttype ? old0 : i); + if (!omittype[h]) { + if (isdsts[h]) + hidst = i; + else + histd = i; + } + } if (hidst >= 0 && mrudst >= 0 && hidst != mrudst && - gmtoffs[hidst] != gmtoffs[mrudst]) { + utoffs[hidst] != utoffs[mrudst]) { isdsts[mrudst] = -1; - type = addtype(gmtoffs[mrudst], - &chars[abbrinds[mrudst]], + type = addtype(utoffs[mrudst], + &chars[desigidx[mrudst]], true, ttisstds[mrudst], - ttisgmts[mrudst]); + ttisuts[mrudst]); isdsts[mrudst] = 1; omittype[type] = false; } if (histd >= 0 && mrustd >= 0 && histd != mrustd && - gmtoffs[histd] != gmtoffs[mrustd]) { + utoffs[histd] != utoffs[mrustd]) { isdsts[mrustd] = -1; - type = addtype(gmtoffs[mrustd], - &chars[abbrinds[mrustd]], + type = addtype(utoffs[mrustd], + &chars[desigidx[mrustd]], false, ttisstds[mrustd], - ttisgmts[mrustd]); + ttisuts[mrustd]); isdsts[mrustd] = 0; - omittype[type] = true; + omittype[type] = false; } } #endif /* !defined LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */ @@ -2106,15 +2132,19 @@ writezone(const char *const name, const for (i = 0; i < (int)(sizeof indmap / sizeof indmap[0]); ++i) indmap[i] = -1; - thischarcnt = 0; + thischarcnt = stdcnt = utcnt = 0; for (i = old0; i < typecnt; i++) { char * thisabbr; if (omittype[i]) continue; - if (indmap[abbrinds[i]] >= 0) + if (ttisstds[i]) + stdcnt = thistypecnt; + if (ttisuts[i]) + utcnt = thistypecnt; + if (indmap[desigidx[i]] >= 0) continue; - thisabbr = &chars[abbrinds[i]]; + thisabbr = &chars[desigidx[i]]; for (j = 0; j < thischarcnt; ++j) if (strcmp(&thischars[j], thisabbr) == 0) break; @@ -2122,14 +2152,20 @@ writezone(const char *const name, const strcpy(&thischars[thischarcnt], thisabbr); thischarcnt += strlen(thisabbr) + 1; } - indmap[abbrinds[i]] = j; + indmap[desigidx[i]] = j; + } + if (pass == 1 && !want_bloat()) { + utcnt = stdcnt = thisleapcnt = 0; + thistimecnt = - locut - hicut; + thistypecnt = thischarcnt = 1; + thistimelim = thistimei; } #define DO(field) fwrite(tzh.field, sizeof tzh.field, (size_t) 1, fp) tzh = tzh0; memcpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic); tzh.tzh_version[0] = version; - convert(thistypecnt, tzh.tzh_ttisgmtcnt); - convert(thistypecnt, tzh.tzh_ttisstdcnt); + convert(utcnt, tzh.tzh_ttisutcnt); + convert(stdcnt, tzh.tzh_ttisstdcnt); convert(thisleapcnt, tzh.tzh_leapcnt); convert(locut + thistimecnt + hicut, tzh.tzh_timecnt); convert(thistypecnt, tzh.tzh_typecnt); @@ -2137,13 +2173,22 @@ writezone(const char *const name, const DO(tzh_magic); DO(tzh_version); DO(tzh_reserved); - DO(tzh_ttisgmtcnt); + DO(tzh_ttisutcnt); DO(tzh_ttisstdcnt); DO(tzh_leapcnt); DO(tzh_timecnt); DO(tzh_typecnt); DO(tzh_charcnt); #undef DO + if (pass == 1 && !want_bloat()) { + /* Output a minimal data block with just one time type. */ + puttzcode(0, fp); /* utoff */ + putc(0, fp); /* dst */ + putc(0, fp); /* index of abbreviation */ + putc(0, fp); /* empty-string abbreviation */ + continue; + } + /* Output a LO_TIME transition if needed; see limitrange. But do not go below the minimum representable value for this pass. */ @@ -2167,12 +2212,15 @@ writezone(const char *const name, const if (hicut) putc(currenttype, fp); - for (i = old0; i < typecnt; i++) - if (!omittype[i]) { - puttzcode(gmtoffs[i], fp); - putc(isdsts[i], fp); - putc((unsigned char) indmap[abbrinds[i]], fp); - } + for (i = old0; i < typecnt; i++) { + int h = (i == old0 ? thisdefaulttype + : i == thisdefaulttype ? old0 : i); + if (!omittype[h]) { + puttzcode(utoffs[h], fp); + putc(isdsts[h], fp); + putc(indmap[desigidx[h]], fp); + } + } if (thischarcnt != 0) fwrite(thischars, sizeof thischars[0], (size_t) thischarcnt, fp); @@ -2194,18 +2242,19 @@ writezone(const char *const name, const ++j; j = types[j - 1]; } - todo = tadd(trans[i], -gmtoffs[j]); + todo = tadd(trans[i], -utoffs[j]); } else todo = trans[i]; puttzcodepass(todo, fp, pass); puttzcode(corr[i], fp); } - for (i = old0; i < typecnt; i++) + if (stdcnt != 0) + for (i = old0; i < typecnt; i++) if (!omittype[i]) putc(ttisstds[i], fp); - for (i = old0; i < typecnt; i++) + if (utcnt != 0) + for (i = old0; i < typecnt; i++) if (!omittype[i]) - putc(ttisgmts[i], fp); - swaptypes(old0, thisdefaulttype); + putc(ttisuts[i], fp); } fprintf(fp, "\n%s\n", string); close_file(fp, directory, name); @@ -2250,7 +2299,7 @@ abbroffset(char *buf, zic_t offset) static size_t doabbr(char *abbr, int abbrlen, struct zone const *zp, const char *letters, - bool isdst, zic_t stdoff, bool doquotes) + bool isdst, zic_t save, bool doquotes) { char * cp; char * slashp; @@ -2261,7 +2310,7 @@ doabbr(char *abbr, int abbrlen, struct z if (slashp == NULL) { char letterbuf[PERCENT_Z_LEN_BOUND + 1]; if (zp->z_format_specifier == 'z') - letters = abbroffset(letterbuf, zp->z_gmtoff + stdoff); + letters = abbroffset(letterbuf, zp->z_stdoff + save); else if (!letters) letters = "%s"; snprintf(abbr, abbrlen, format, letters); @@ -2326,8 +2375,7 @@ stringoffset(char *result, zic_t offset) } static int -stringrule(char *result, const struct rule *const rp, const zic_t dstoff, - const zic_t gmtoff) +stringrule(char *result, struct rule *const rp, zic_t save, const zic_t stdoff) { zic_t tod = rp->r_tod; int compat = 0; @@ -2374,10 +2422,10 @@ stringrule(char *result, const struct ru result += sprintf(result, "M%d.%d.%d", rp->r_month + 1, week, wday); } - if (rp->r_todisgmt) - tod += gmtoff; + if (rp->r_todisut) + tod += stdoff; if (rp->r_todisstd && !rp->r_isdst) - tod += dstoff; + tod += save; if (tod != 2 * SECSPERMIN * MINSPERHOUR) { *result++ = '/'; if (! stringoffset(result, tod)) @@ -2407,10 +2455,8 @@ rule_cmp(struct rule const *a, struct ru return a->r_dayofmonth - b->r_dayofmonth; } -enum { YEAR_BY_YEAR_ZONE = 1 }; - static int -stringzone(char *result, const int resultlen, const struct zone *const zpfirst, +stringzone(char *result, int resultlen, const struct zone *const zpfirst, const int zonecount) { const struct zone * zp; @@ -2464,31 +2510,23 @@ stringzone(char *result, const int resul if (rule_cmp(stdrp, rp) < 0) stdrp = rp; } - /* - ** Horrid special case: if year is 2037, - ** presume this is a zone handled on a year-by-year basis; - ** do not try to apply a rule to the zone. - */ - if (stdrp != NULL && stdrp->r_hiyear == 2037) - return YEAR_BY_YEAR_ZONE; - if (stdrp != NULL && stdrp->r_isdst) { /* Perpetual DST. */ dstr.r_month = TM_JANUARY; dstr.r_dycode = DC_DOM; dstr.r_dayofmonth = 1; dstr.r_tod = 0; - dstr.r_todisstd = dstr.r_todisgmt = false; + dstr.r_todisstd = dstr.r_todisut = false; dstr.r_isdst = stdrp->r_isdst; - dstr.r_stdoff = stdrp->r_stdoff; + dstr.r_save = stdrp->r_save; dstr.r_abbrvar = stdrp->r_abbrvar; stdr.r_month = TM_DECEMBER; stdr.r_dycode = DC_DOM; stdr.r_dayofmonth = 31; - stdr.r_tod = SECSPERDAY + stdrp->r_stdoff; - stdr.r_todisstd = stdr.r_todisgmt = false; + stdr.r_tod = SECSPERDAY + stdrp->r_save; + stdr.r_todisstd = stdr.r_todisut = false; stdr.r_isdst = false; - stdr.r_stdoff = 0; + stdr.r_save = 0; stdr.r_abbrvar = (stdabbrrp ? stdabbrrp->r_abbrvar : ""); dstrp = &dstr; @@ -2499,7 +2537,7 @@ stringzone(char *result, const int resul return -1; abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar; len = doabbr(result, resultlen, zp, abbrvar, false, 0, true); - offsetlen = stringoffset(result + len, -zp->z_gmtoff); + offsetlen = stringoffset(result + len, -zp->z_stdoff); if (! offsetlen) { result[0] = '\0'; return -1; @@ -2508,10 +2546,10 @@ stringzone(char *result, const int resul if (dstrp == NULL) return compat; len += doabbr(result + len, resultlen - len, zp, dstrp->r_abbrvar, - dstrp->r_isdst, dstrp->r_stdoff, true); - if (dstrp->r_stdoff != SECSPERMIN * MINSPERHOUR) { + dstrp->r_isdst, dstrp->r_save, true); + if (dstrp->r_save != SECSPERMIN * MINSPERHOUR) { offsetlen = stringoffset(result + len, - -(zp->z_gmtoff + dstrp->r_stdoff)); + - (zp->z_stdoff + dstrp->r_save)); if (! offsetlen) { result[0] = '\0'; return -1; @@ -2519,7 +2557,7 @@ stringzone(char *result, const int resul len += offsetlen; } result[len++] = ','; - c = stringrule(result + len, dstrp, dstrp->r_stdoff, zp->z_gmtoff); + c = stringrule(result + len, dstrp, dstrp->r_save, zp->z_stdoff); if (c < 0) { result[0] = '\0'; return -1; @@ -2528,7 +2566,7 @@ stringzone(char *result, const int resul compat = c; len += strlen(result + len); result[len++] = ','; - c = stringrule(result + len, stdrp, dstrp->r_stdoff, zp->z_gmtoff); + c = stringrule(result + len, stdrp, dstrp->r_save, zp->z_stdoff); if (c < 0) { result[0] = '\0'; return -1; @@ -2546,12 +2584,12 @@ outzone(const struct zone *zpfirst, ptrd ptrdiff_t i, j; bool usestart, useuntil; zic_t starttime, untiltime; - zic_t gmtoff; zic_t stdoff; + zic_t save; zic_t year; zic_t startoff; bool startttisstd; - bool startttisgmt; + bool startttisut; int type; char * startbuf; char * ab; @@ -2561,7 +2599,7 @@ outzone(const struct zone *zpfirst, ptrd bool prodstic; /* all rules are min to max */ int compat; bool do_extend; - int version; + char version; ptrdiff_t lastatmax = -1; zic_t one = 1; zic_t y2038_boundary = one << 31; @@ -2587,7 +2625,7 @@ outzone(const struct zone *zpfirst, ptrd ** for noting the need to unconditionally initialize startttisstd. */ startttisstd = false; - startttisgmt = false; + startttisut = false; min_year = max_year = EPOCH_YEAR; if (leapseen) { updateminmax(leapminyear); @@ -2612,13 +2650,13 @@ outzone(const struct zone *zpfirst, ptrd */ compat = stringzone(envvar, max_envvar_len + 1, zpfirst, zonecount); version = compat < 2013 ? ZIC_VERSION_PRE_2013 : ZIC_VERSION; - do_extend = compat < 0 || compat == YEAR_BY_YEAR_ZONE; + do_extend = compat < 0; if (noise) { if (!*envvar) warning("%s %s", _("no POSIX environment variable for zone"), zpfirst->z_name); - else if (compat != 0 && compat != YEAR_BY_YEAR_ZONE) { + else if (compat != 0) { /* Circa-COMPAT clients, and earlier clients, might not work for this zone when given dates before 1970 or after 2038. */ @@ -2660,36 +2698,38 @@ outzone(const struct zone *zpfirst, ptrd max_year = min_year + years_of_observations; } } - /* - ** For the benefit of older systems, - ** generate data from 1900 through 2038. - */ - if (min_year > 1900) - min_year = 1900; max_year0 = max_year; - if (max_year < 2038) + if (want_bloat()) { + /* For the benefit of older systems, + generate data from 1900 through 2038. */ + if (min_year > 1900) + min_year = 1900; + if (max_year < 2038) max_year = 2038; + } + for (i = 0; i < zonecount; ++i) { + struct rule *prevrp = NULL; /* ** A guess that may well be corrected later. */ - stdoff = 0; + save = 0; zp = &zpfirst[i]; usestart = i > 0 && (zp - 1)->z_untiltime > min_time; useuntil = i < (zonecount - 1); if (useuntil && zp->z_untiltime <= min_time) continue; - gmtoff = zp->z_gmtoff; + stdoff = zp->z_stdoff; eat(zp->z_filename, zp->z_linenum); *startbuf = '\0'; - startoff = zp->z_gmtoff; + startoff = zp->z_stdoff; if (zp->z_nrules == 0) { - stdoff = zp->z_stdoff; - doabbr(startbuf, max_abbr_len + 1, zp, - NULL, zp->z_isdst, stdoff, false); - type = addtype(oadd(zp->z_gmtoff, stdoff), + save = zp->z_save; + doabbr(startbuf, max_abbr_len + 1, + zp, NULL, zp->z_isdst, save, false); + type = addtype(oadd(zp->z_stdoff, save), startbuf, zp->z_isdst, startttisstd, - startttisgmt); + startttisut); if (usestart) { addtt(starttime, type); usestart = false; @@ -2725,16 +2765,16 @@ outzone(const struct zone *zpfirst, ptrd if (useuntil) { /* ** Turn untiltime into UT - ** assuming the current gmtoff and - ** stdoff values. + ** assuming the current stdoff and + ** save values. */ untiltime = zp->z_untiltime; - if (!zp->z_untilrule.r_todisgmt) + if (!zp->z_untilrule.r_todisut) untiltime = tadd(untiltime, - -gmtoff); + -stdoff); if (!zp->z_untilrule.r_todisstd) untiltime = tadd(untiltime, - -stdoff); + -save); } /* ** Find the rule (of those to do, if any) @@ -2747,9 +2787,9 @@ outzone(const struct zone *zpfirst, ptrd continue; eats(zp->z_filename, zp->z_linenum, rp->r_filename, rp->r_linenum); - offset = rp->r_todisgmt ? 0 : gmtoff; + offset = rp->r_todisut ? 0 : stdoff; if (!rp->r_todisstd) - offset = oadd(offset, stdoff); + offset = oadd(offset, save); jtime = rp->r_temp; if (jtime == min_time || jtime == max_time) @@ -2776,41 +2816,46 @@ outzone(const struct zone *zpfirst, ptrd rp->r_todo = false; if (useuntil && ktime >= untiltime) break; - stdoff = rp->r_stdoff; + save = rp->r_save; if (usestart && ktime == starttime) usestart = false; if (usestart) { if (ktime < starttime) { - startoff = oadd(zp->z_gmtoff, - stdoff); + startoff = oadd(zp->z_stdoff, + save); doabbr(startbuf, max_abbr_len + 1, zp, rp->r_abbrvar, rp->r_isdst, - rp->r_stdoff, + rp->r_save, false); continue; } - if (*startbuf == '\0' && - startoff == oadd(zp->z_gmtoff, - stdoff)) { + if (*startbuf == '\0' + && startoff == oadd(zp->z_stdoff, + save)) { doabbr(startbuf, max_abbr_len + 1, zp, rp->r_abbrvar, rp->r_isdst, - rp->r_stdoff, + rp->r_save, false); } } eats(zp->z_filename, zp->z_linenum, rp->r_filename, rp->r_linenum); doabbr(ab, max_abbr_len + 1, zp, rp->r_abbrvar, - rp->r_isdst, rp->r_stdoff, false); - offset = oadd(zp->z_gmtoff, rp->r_stdoff); + rp->r_isdst, rp->r_save, false); + offset = oadd(zp->z_stdoff, rp->r_save); + if (!want_bloat() && !useuntil && !do_extend + && prevrp + && rp->r_hiyear == ZIC_MAX + && prevrp->r_hiyear == ZIC_MAX) + break; type = addtype(offset, ab, rp->r_isdst, - rp->r_todisstd, rp->r_todisgmt); + rp->r_todisstd, rp->r_todisut); if (defaulttype < 0 && !rp->r_isdst) defaulttype = type; if (rp->r_hiyear == ZIC_MAX @@ -2818,6 +2863,7 @@ outzone(const struct zone *zpfirst, ptrd && ktime < attypes[lastatmax].at)) lastatmax = timecnt; addtt(ktime, type); + prevrp = rp; } } if (usestart) { @@ -2831,9 +2877,9 @@ outzone(const struct zone *zpfirst, ptrd if (*startbuf == '\0') error(_("can't determine time zone abbreviation to use just after until time")); else { - bool isdst = startoff != zp->z_gmtoff; + bool isdst = startoff != zp->z_stdoff; type = addtype(startoff, startbuf, isdst, - startttisstd, startttisgmt); + startttisstd, startttisut); if (defaulttype < 0 && !isdst) defaulttype = type; addtt(starttime, type); @@ -2844,12 +2890,12 @@ error(_("can't determine time zone abbre */ if (useuntil) { startttisstd = zp->z_untilrule.r_todisstd; - startttisgmt = zp->z_untilrule.r_todisgmt; + startttisut = zp->z_untilrule.r_todisut; starttime = zp->z_untiltime; if (!startttisstd) - starttime = tadd(starttime, -stdoff); - if (!startttisgmt) - starttime = tadd(starttime, -gmtoff); + starttime = tadd(starttime, -save); + if (!startttisut) + starttime = tadd(starttime, -stdoff); } } if (defaulttype < 0) @@ -2900,20 +2946,28 @@ addtt(zic_t starttime, int type) } static int -addtype(zic_t gmtoff, char const *abbr, bool isdst, bool ttisstd, bool ttisgmt) +addtype(zic_t utoff, char const *abbr, bool isdst, bool ttisstd, bool ttisut) { int i, j; - /* - ** See if there's already an entry for this zone type. - ** If so, just return its index. - */ - for (i = 0; i < typecnt; ++i) { - if (gmtoff == gmtoffs[i] && isdst == isdsts[i] && - strcmp(abbr, &chars[abbrinds[i]]) == 0 && - ttisstd == ttisstds[i] && - ttisgmt == ttisgmts[i]) - return i; + if (! (-1L - 2147483647L <= utoff && utoff <= 2147483647L)) { + error(_("UT offset out of range")); + exit(EXIT_FAILURE); + } + if (!want_bloat()) + ttisstd = ttisut = false; + + for (j = 0; j < charcnt; ++j) + if (strcmp(&chars[j], abbr) == 0) + break; + if (j == charcnt) + newabbr(abbr); + else { + /* If there's already an entry, return its index. */ + for (i = 0; i < typecnt; i++) + if (utoff == utoffs[i] && isdst == isdsts[i] && j == desigidx[i] + && ttisstd == ttisstds[i] && ttisut == ttisuts[i]) + return i; } /* ** There isn't one; add a new one, unless there are already too @@ -2923,22 +2977,12 @@ addtype(zic_t gmtoff, char const *abbr, error(_("too many local time types")); exit(EXIT_FAILURE); } - if (! (-1L - 2147483647L <= gmtoff && gmtoff <= 2147483647L)) { - error(_("UT offset out of range")); - exit(EXIT_FAILURE); - } - gmtoffs[i] = gmtoff; + i = typecnt++; + utoffs[i] = utoff; isdsts[i] = isdst; ttisstds[i] = ttisstd; - ttisgmts[i] = ttisgmt; - - for (j = 0; j < charcnt; ++j) - if (strcmp(&chars[j], abbr) == 0) - break; - if (j == charcnt) - newabbr(abbr); - abbrinds[i] = j; - ++typecnt; + ttisuts[i] = ttisut; + desigidx[i] = j; return i; } @@ -3159,8 +3203,8 @@ byword(const char *word, const struct lo else return NULL; /* multiple inexact matches */ } - /* Warn about any backward-compatibility issue with pre-2017c zic. */ - if (foundlp) { + if (foundlp && noise) { + /* Warn about any backward-compatibility issue with pre-2017c zic. */ bool pre_2017c_match = false; for (lp = table; lp->l_word; lp++) if (itsabbr(word, lp->l_word)) {