curl-curl/projects/Windows/tmpl
Viktor Szakats 32454b954a
localtime: detect thread-safe alternatives and use them
- add local API `toolx_localtime()` to wrap the banned function
  `localtime()`. Used from libcurl, libtests and test servers.
- auto-detect and use `localtime_r()` where available (e.g. Linux).
  Also to support multi-threading.
- use `localtime_s()` on Windows. It requires MSVC or mingw-w64 v4+.
  Also to support multi-threading.
  Use local workaround to also support mingw-w64 v3.
- add `src/toolx` to keep internal APIs used by the curl tool and tests,
  but not by libcurl. `toolx_localtime()` is the first API in it.
- replace `localtime()` calls with `toolx_localtime()`.
  Except in examples.
- note Windows XP's default `msvcrt.dll` doesn't offer secure CRT APIs.
  XP likely needs a newer version of this DLL, or may not run.
- note that `localtime()` mirrors `gmtime()`, with the difference that
  `gmtime()`'s internal wrapper lives in curlx.

Also:
- drop redundant `int` casts.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/localtime-localtime32-localtime64
https://learn.microsoft.com/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s
https://pubs.opengroup.org/onlinepubs/9799919799/functions/localtime.html
https://linux.die.net/man/3/localtime_r

Ref: #19955 (for `gmtime_r()`)
Follow-up to 54d9f060b4
Closes #19957
2025-12-16 14:30:06 +01:00
..
.gitattributes
curl-all.sln projects: fix Windows project 'clean' function 2025-09-02 10:34:48 -04:00
curl.sln projects: fix Windows project 'clean' function 2025-09-02 10:34:48 -04:00
curl.vcxproj localtime: detect thread-safe alternatives and use them 2025-12-16 14:30:06 +01:00
curl.vcxproj.filters projects: fix Windows project 'clean' function 2025-09-02 10:34:48 -04:00
libcurl.sln projects: fix Windows project 'clean' function 2025-09-02 10:34:48 -04:00
libcurl.vcxproj projects: fix Windows project 'clean' function 2025-09-02 10:34:48 -04:00
libcurl.vcxproj.filters projects: fix Windows project 'clean' function 2025-09-02 10:34:48 -04:00
README.txt projects: fix Windows project 'clean' function 2025-09-02 10:34:48 -04:00

The files in this directory are not meant to be opened with Visual Studio.

This directory contains template files that are used to generate project files
for legacy versions of Visual Studio 2010, 2012 and 2013. To generate the
files run generate.bat in the projects directory and refer to that directory's
README.