Web lists-archives.org

Re: [Mingw-users] Porting localtime_r and gmtime_r




Brian Dessent wrote:
> JonY wrote:
> 
>> Good point, I suppose copying it to malloc'ed location immediately won't
>> be safe too, but I did find this message suggesting win32 localtime is
>> thread safe.
> 
> Yeah, in that case it might do.  I wasn't aware that Win32 uses a thread
> local buffer.
> 
> Brian
> 

OK, I wasn't worried until I found this

http://msdn2.microsoft.com/en-us/library/aa246456(VS.60).aspx

 > gmtime, mktime, and localtime all use a single statically allocated tm
 > structure for the conversion. Each call to one of these routines
 > destroys the result of the previous call.

Is this specific to msvc++ or does it also apply to msvcrt.dll as well?

http://msdn2.microsoft.com/en-us/library/bf12f0hc(VS.80).aspx

 > Both the 32-bit and 64-bit versions of gmtime, mktime, mkgmtime, and
 > localtime all use a single tm structure per thread for the conversion.
 > Each call to one of these routines destroys the result of the previous
 > call.

Does this mean I need to link to msvcr80.dll?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users