[tz] proposed changes for Win32 and a improved mktime() algorithm

Kees Dekker Kees.Dekker at infor.com
Tue May 9 14:44:33 UTC 2017


I've a patch (diff/patch format) attached, which is the result of a longer period of testing (and delays due to other duties). The patch has been created against 2017B code. And I've tried to limit my changes to a minimum.

The patch comprises changes for 5 files, where most of the changes are in private.h and localtime.c. The changes are (summarized list):

1.       Win32/Visual Studio (2015) port. Related to including header files + handling of the Windows style backslash (by adding some macros)

2.       Adding a faster (and more efficient) algorithm for mktime(). Instead of the binary search another approach is used, but also results in different ambiguous boundaries for switching from DST to non-DST.

3.       Adding a possibility not to use putenv(). Putenv() may result in leaking memory, as it is unsure putenv() behaves on different platforms. As long as set & get of a TZ variable is within the TZ library, there is no need to use putenv()/getenv() at all. Also note that putenv/getenv on Windows are thread-unsafe (and I did not like to use the GetEnvironmentString/SetEnvironmentString() counterparts).

4.       Solved some platform (e.g. HPUX) specific errors/warnings (initializing + some fixed char buffers). Indeed, making some compilers happy (there is more than gcc only).

I'm not sure whether the way how I provide this patch is the recommended way. If another way is preferred, please let me know.
If more information is needed, please ask. I added as much as possible the comments in the affected source files itself, but I can imagine that still some questions left.
It is not my intention to see 'good luck with this patch'. If there is another preferred method to chop this patch in chunks, please let me know.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20170509/fcb6da8e/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://mm.icann.org/pipermail/tz/attachments/20170509/fcb6da8e/attachment.txt>

More information about the tz mailing list