cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl and Visual Studio 2005 - gmtime_r

From: sherman wilcox <wilcox.sherman_at_gmail.com>
Date: Sun, 25 Feb 2007 12:55:31 -0600

Hate to reply to my own post...but here goes. Here's a line from MSDN
on gmtime_s:

"The _gmtime32_s function breaks down the time value and stores it in
a statically allocated structure of type tm, defined in Time.h. The
value of time is usually obtained from a call to the time function."

Statically allocated hints that it's not re-entrant...at least to me.

I believe that by default, time_t in Visual Studio 2005 is 64-bit. You
have to specify _USE_32BIT_TIME_T as a preprocessor to get a 32-bit
time_t. When you specify _USE_32BIT_TIME_T gmtime_s is mapped to
_gmtime32_s, I think.

I've been under the (possibly mistaken) impression that the _s series
of C functions are from the "Safer C" library. I also thought that one
of the appealing properties of these safe functions was that they
(some?) were re-entrant.

Just thought I'd add this. My original question still stands.

On 2/25/07, sherman wilcox <wilcox.sherman_at_gmail.com> wrote:
> The subject line sums it up. I'm using Visual Studio 2005 and I don't
> see a gmtime_r. Config-win32.h has this comment:
>
> /* MSVC 2003 has gmtime_r */
>
> I'm unaware of any version of Visual Studio having a gmtime_r. I do
> see a gmtime_s for Visual Studio 2005, but this isn't re-entrant. Is
> this a case of me missing the gmtime_r in VS 2005 or should I be using
> an alternative library that provides gmtime_r?
>
> What's the proper work-around if someone wishes to use libcurl in a
> multi-threaded environment?
>
> Thanks
>
Received on 2007-02-25