This fixes a longstanding test-case failure with
'make check_time_t_alternatives'.
* localtime.c (detzcode64): Return int_fast64_t, not time_t,
for the benefit of platforms where time_t is narrower than 64 bits.
The distinction matters if time_t is 32-bit unsigned.
Simplify the shifts and masks.
(tzload): Fix the check for overflow when storing the loaded time
value into a time_t object. The old code didn't work when
time_t was an unsigned 32-bit quantity.
(transtime): Return the offset from the start of the year,
not the offset since the Epoch, since the former cannot overflow
but the latter can. Caller changed.
(tzparse): Check for overflow more carefully when computing
time stamps. The old code didn't work for 32-bit unsigned values,
in unusual situations such as Pacific/Fiji and Pacific/Auckland
for times past 2038.
(increment_overflow_time): New function.
* zdump.c (strtoimax) [!INTMAX_MAX]: Define like private.h does.
(SCNdMAX): Remove; no longer used.
(main): Use strtoimax, not sscanf with SCNdMAX, as strtoimax has
well-defined behavior when the input number is out of numeric range.
Problem reported by Patrick 'P. J.' McDermott in
<http://mm.icann.org/pipermail/tz/2013-October/020441.html>.
This code is quite a bit different from what he proposed.
* tzselect.ksh: Rewrite so that it should work with /bin/sh on
common platforms. For portability to Solaris 9 /bin/sh, use
`...`, not $(...), and avoid $((...)).
(doselect): New function. Use this instead of plain 'select'.
Callers no longer need to worry whether it sets the var to empty.
* Makefile, NEWS: Document this.
* Makefile: Let the user override AR, and build libtz.a before
installing it, as suggested by Michael Forney in
<https://github.com/eggert/tz/pull/3>. Also, let the user
override RANLIB. Modernize a bit by assuming POSIX.2-1992 or
later; this is safe nowadays and simplifies the libtz.a business.
And treat 'leapseconds' more like we used to, since it's
machine-independent a 'make clean' doesn't need to remove it.
(TZLIB): Remove.
(AR, RANLIB): New macros.
(TABDATA): Add leapseconds, so that 'make' builds it by default.
(DATA): Remove leapseconds, since $(TABDATA) now has it.
(all): Depend on libtz.a, not $(LIBOBJS).
(install): Install libtz.a using 'cp', like other files.
Also invoke $(RANLIB) on it, after installing.
Do not assume that TZDIR is not overridden.
(install, INSTALL, check_time_t_alternatives): Use 'mkdir -p', as
it's safe to assume nowadays (standardized in POSIX.2-1992).
(install, INSTALL): Prefer 'cp -f' to 'rm' followed by 'cp', as
it's safe to assume 'cp -f' nowadays (also standardized in POSIX.2-1992).
(libtz.a): Rename from $(DESTDIR)$(TZLIB), since we now build it here.
Use $(AR) rather than ar.
Use $(RANLIB) rather than trying to guess it.
(clean_misc): Do not remove 'leapseconds', as it's machine-independent.
(maintainer-clean): Remove 'leapseconds' here instead.
(clean, check_public): Standardize on 'rm -fr' rather than 'rm -f -r';
formerly the makefile was inconsistent.
(set-timestamps.out): Don't ignore failurs of the actual touch command.
* zic.c (outzone): Restore diagnostic that was inadvertently
suppressed by the 2013-09-08 change to the 400-years-hack.
This doesn't affect zic's binary output; it affects only the
diagnostics generated by 'zic -v'. The problem evinced itself
with Asia/Tehran, which currently should generate a diagnostic,
but doesn't without this patch.
* NEWS: Document the above.
MinGW problem reported by Theo Veenker in
<http://mm.icann.org/pipermail/tz/2013-September/020378.html>.
The patched code should work even on POSIXish hosts
where 'link' and 'symlink' fail for whatever reason,
e.g., if the destination file system is VFAT.
Also, the patch fixes some bugs when symlinks are used.
* Makefile (CFLAGS): Mention HAVE_LINK in the comment.
(TZDSRCS): Add asctime.o, since MinGW lacks asctime.
(TZDOBJS): Add asctime.c.
* private.h (HAVE_LINK): Default to 1.
* zic.c (link) [!HAVE_LINK]: New macro.
(symlink) [!HAVE_SYMLINK]: New macro.
(dolink): Fix some bugs when 'link' fails but 'symlink' succeeds.
Fall back on copying when both fail.
* NEWS: Document the above.
Problem with leapseconds reported by Matt Burgess in
<http://mm.icann.org/pipermail/tz/2013-September/020379.html>
with a followup by Ian Abbott in
<http://mm.icann.org/pipermail/tz/2013-September/020383.html>.
* Makefile (MANTXTS): New macro.
(maintainer-clean): Use it.
(DOCS): Add it.
(DATA): Add 'leapseconds'.
(LEAP_DEPS): New macro.
(leapseconds): Use it.
(public): Don't depend on set-timestamps; each tarball does that
individually now, to allow for more parallelization.
(date.1.txt, newctime.3.txt, newstrftime.3.txt, newtzset.3.txt)
(time2posix.3.txt, tzfile.5.txt, tzselect.8.txt, zdump.8.txt)
(zic.8.txt): Depend on the corresponding non-.txt file.
$(MANTXTS): New rule.
(set-timestamps.out): Rename from set-timestamps, and make it a file,
so that it has its own timestamp; this avoids useless rework.
Depend on $(ENCHILADA) and ignore files under Git that are not
also listed in $(ENCHILADA). Set the timestamp of 'leapseconds'
and each $(MANTXTS) to be the maximum of its dependencies, to avoid
timestamp churn in future tarballs. Prefer touch -m, as we don't
care about access time here.
(tzcode$(VERSION).tar.gz, tzdata$(VERSION).tar.gz):
Depend on set-timestamps.out rather than the individual files,
so timestamps are set before creating the tarballs even when
make is parallelized.
(tzcode$(VERSION).tar.gz): Don't mention *.[1-8].txt explicitly,
since we now get $(MANTXTS) via $(DOCS).
* NEWS: Document the above.
* Makefile (COMMON): Move README here ...
(DOCS): ... from here, as it talks about the public-domain status
of the files, and this should be in both tarballs.
* README: Add intro. Mention public-domain status of files.
Remove and reorganize some obsolete text, e.g., move 1989 release
info from here to NEWS's tail.
* NEWS: Document the above.
Reported by Elliott Hughes in
<http://mm.icann.org/pipermail/tz/2013-September/020376.html>.
* localtime.c (timezone) [USG_COMPAT]:
(altzone) [ALTZONE]: Now long, not time_t.
* strftime.c (_fmt): Use long, not int, to store timezone.
* NEWS: Document this.
* Makefile (set-timestamps): Use git's tformat rather than format,
to port to strict POSIX hosts where `` output in shell scripts
cannot end in a non-newline. Use git diff --quiet rather than git
diff --name-only, as it's simpler. Use touch -c for safety, and
-m to avoid setting last-access time, which we don't care about.
Diagnose files that don't match repository.
* NEWS: Document this.
We don't know of any clients where this makes a difference, but it
is a more-conservative change, as in theory older clients could
reject version-3 format files merely because of the version number.
(ZIC_VERSION_PRE_2013): New macro.
(writezone): New arg 'version'. All callers changed.
(outzone): Output version-2 format files unless the capabilities
of version 3 are used.