cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Question about some platform updates to Windows

From: Gisle Vanem <gvanem_at_yahoo.no>
Date: Thu, 24 Oct 2013 14:57:20 +0200

"Myria" <myriachan_at_cox.net> wrote:

> I noticed that Windows does not define HAVE_GMTIME_R or HAVE_LOCALTIME_R.
> It is true that Visual Studio's C runtime library doesn't have gmtime_r, but
> it has a somewhat-equivalent API, gmtime_s. gmtime_s's prototype is
> different, reversing the order of the two parameters and returning an errno
> error code instead of the tm* parameter. (gmtime_s took its reentrancy more
> seriously than gmtime_r, and doesn't modify the thread-local variable
> errno.) The same applies to localtime_r existing in Visual Studio as
> localtime_s.

Without opening a can of worms [*] by using this new _gmtime64_s() function,
we could make a thread-safe Curl_gmtime() in libcurl too? It shouldn't be that
hard; a call to gmtime64() protected inside a critical-section and with a push/pop
of errno.

localtime_r() isn't used anywhere AFAICS. So what's this HAVE_LOCALTIME_R
all about?

By "worms", I mean using a MSVCRT.DLL function in e.g. Vista that isn't available
  in Win-XP. So a libcurl.dll would not work everwhere.

--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-10-24