Lack of documentation reported by Jonathan Lennox in:
http://mm.icann.org/pipermail/tz/2014-August/021529.html
* newtzset.3: Document tzalloc and tzfree.
* newctime.3: Document localtime_rz and mktime_z.
* NEWS: Mention this.
Suggested by Jonathan Lennox in:
http://mm.icann.org/pipermail/tz/2014-August/021529.html
* localtime.c (tzalloc): Treat NULL argument like tzsetwall.
(tzsetwall_unlocked): Remove, replacing with ...
(tzsetlcl): New function, which merges the old tzsetwall and
tzset_unlocked.
(zoneinit): Treat a null NAME like tzsetwall.
(tzsetwall, tzset_unlocked): Rewrite to use tzsetlcl.
* NEWS: Document this.
These don't fix any bugs, but make the recently-introduced 'bool'
code easier to follow.
* localtime.c (gmtcheck): Move gmt_is_set's definition here,
since it's used only here.
(localtime_r): Explicitly convert integer to boolean rather
than relying on C99 semantics.
This is mostly for convenience, so that plain 'make' works out of
the box on Solaris, instead of having to run something awkward like
'make CFLAGS="-xc99=all -DHAVE_INCOMPATIBLE_CTIME_R=1"', and
similarly for Irix 6.5.
* private.h (_POSIX_PTHREAD_SEMANTICS):
* private.h, zdump.c (__EXTENSIONS__):
New macros, to make Solaris headers more like what we want out
of the box.
(LLONG_MAX, LLONG_MIN): Default from __LONG_LONG_MAX__ if it's defined.
This simplifies later code.
(SCNdFAST64, PRIdMAX): Don't assume they're defined when
INT_FAST64_MAX is, as that's not true on Solaris 10 + Sun C 5.12.
(PRIuMAX): Likewise, for Solaris 11 + Sun C 5.12.
* zdump.c (HAVE_LOCALTIME_RZ): Default to 1 only if TM_ZONE.
* Makefile, NEWS: Document this.
Problem reported by Alan Barrett in:
http://mm.icann.org/pipermail/tz/2014-August/021518.html
* localtime.c (zoneinit): Use UTC if !name.
That way, tzalloc(NULL) returns UTC, as in NetBSD.
(mktime_z): Use UTC if !sp.
* NEWS: Document this.
This is significantly faster and is cleaner internally.
* Makefile, NEWS: Document this.
* zdump.c (NETBSD_INSPIRED): Default to 1.
(HAVE_LOCALTIME_RZ): New macro; defaults to NETBSD_INSPIRED && USE_LTZ.
(timezone_t) [!HAVE_LOCALTIME_RZ]: New macro, as a substitute.
(localtime_r) [!HAVE_LOCALTIME_RZ && (!HAVE_LOCALTIME_R||!HAVE_TZSET)]:
(localtime_rz, tzalloc, tzfree) [!HAVE_LOCALTIME_RZ]:
(mktime_rz) [!HAVE_LOCALTIME_RZ && TYPECHECK]:
New substitute function and macro, compatible with NetBSD.
All other uses of localtime_r changed to use localtime_rz.
(settimezone): Remove; all uses replaced by tzalloc.
(tzalloc): Use most of the code of the old settimezone function,
but don't free the old storage.
(tzfree): Free it here instead.
(my_localtime_rz): Rename from my_localtime_r, and make it
compatible with localtime_rz. All uses changed.
(saveabbr): Return the abbreviation. If HAVE_LOCALTIME_RZ
simply return the output of abbr; that's faster.
(main): Diagnose any tzalloc failure. tzfree after use.
(hunt, show): New timezone_t arg. All uses changed.
* Makefile, NEWS: Document this.
* localtime.c (NETBSD_INSPIRED_EXTERN): New macro.
(zoneinit): New function, with tzset_unlocked's internals.
(tzset_unlocked): Use it.
(tzalloc, tzfree) [NETBSD_INSPIRED]: New functions.
(localsub, gmtsub, time2sub, time2, time1, leapcorr):
New time zone argument. All uses changed.
(localsub, gmtsub): Cast to char *, since the time zone argument
is a pointer-to-const.
(localtime_rz): New function, with localtime_tzset's internals.
(localtime_tzset): Use it.
(mktime_z): New function, with mktime's internals.
(mktime): Use it.
(leapcorr): Pass time_t by value, not by reference.
(time2posix_z): New function, with time2posix's internals.
(time2posix): Use it. Omit unnecessary local.
(posix2time_z): New function, with posix2time's internals.
(posix2time): Use it.
* private.h (NETBSD_INSPIRED): Default to 1.
(localtime_rz, mktime_z, timezone_t, strftime, tzalloc, tzfree):
Define if NETBSD_INSPIRED is defined.
Use macros to avoid any clashes with <time.h>.
(posiztime_z, time2posix_z): Likewise, but only if
STD_INSPIRED is also defined.
These files were removed from Solaris long ago,
and are not present on any current platforms.
* Makefile, NEWS: Document this.
* private.h (LOCALE_HOME): Remove.
* strftime.c: Assume LOCALE_HOME is not defined.
Do not include sys/stat.h.
(localebuf, _loc) [LOCALE_HOME]: Remove. All uses removed.
This fixes some schizophrenia in the build, which linked zdump to
the tz library code but did not compile zdump with the tz library API.
* zdump.c (USE_LTZ): New macro.
Use it, not time_tz, to decide whether to include private.h.
* Makefile, NEWS: Document this.
* Makefile (CHECK_TIME_T_ALTERNATIVES): New macro.
(public): Use it.
* localtime.c (SMALLEST): New macro.
(time2sub) [TM_GMTOFF && !UNINIT_TRAP]:
If the UTC offset doesn't match the request, try the requested offset.
This catches a problem caught by -DTYPECHECK with a time stamp
near a transition from LMT to standard time, where both sides of
the transition have tm_isdst == 0. If !defined TM_GMTOFF ||
UNINIT_TRAP you're out of luck: mktime will still conform
to its spec but it'll be more likely to guess wrong on these
ambiguous inputs.
* private.h (UNINIT_TRAP): New macro that defaults to 0.
* Makefile, NEWS: Document this.
This is a bit cleaner and faster.
* zdump.c (HAVE_LOCALTIME_R, HAVE_TZSET): Default to 1.
(tzset) [!HAVE_TZSET]:
(localtime_r) [!HAVE_LOCALTIME_R]: Provide a replacement.
(settimezone): Call tzset after changing environ.
(my_localtime_r): Rename from my_localtime, and change API to
be compatible with localtime_r, not localtime. All uses changed.
* Makefile, NEWS: Document this.
The Mach project has been inactive for decades,
and mktime has evidently replaced gtime.
* Makefile: Remove comment about CMUCS.
* localtime.c (gtime) [CMUCS]: Remove.
* NEWS: Document the above.
* NEWS, newctime.3, newstrftime.3, newtzset.3, time2posix.3:
Mention localtime_r etc. Also, use function prototypes rather
than K&R style, and use 'restrict' where POSIX does.
* asia: Move commentary about Portuguese India from here ...
* backzone: ... to here. Add comment about 19th-century Madras time.
* NEWS: Document this.
Instead, allocate a longer buffer, exiting if memory is exhausted.
* zdump.c (saveabbr): New function.
(main, loab): Use it.
(abbr): Arg is now a pointer-to-const, for saveabbr.
(longest): Now int, since it can't exceed INT_MAX.
(sumsize, settimezone): New functions.
(main): Don't let 'longest' exceed INT_MAX. Use settimezone.
(show): Remove no-longer-necessary cast that formerly had undefined
behavior if 'longest' exceeded INT_MAX.
* localtime.c (tzload): Avoid undefined behavior on integer overflow
when reading a file containing integers out of machine range.
Simplify some of the existing overflow checking.
Handle out-of-range leap-second transitions similarly to the
way we now handle out-of-range ordinary transitions.
* NEWS: Document this and other recent fixes.