Re: [Mingw-users] Porting localtime_r and gmtime_r
- Date: Tue, 5 Feb 2008 08:57:48 +0200
- From: "Tor Lillqvist" <tml@xxxxxx>
- Subject: Re: [Mingw-users] Porting localtime_r and gmtime_r
> 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.
That is misleading. Even in the C runtime sources included with the
venerable MSVC6, gmtime uses thread-local storage for their buffer in
the multithreaded versions of the C runtime (i.e., including
msvcrt.dll). (localtime calls gmtime, and mktime calls gmtime and
localtime, they don't use any static or thread-local buffer of their
own as far as I could see.)
I would be surprised if this had been changed in some later version of
msvcrt.dll, or one of the other runtimes like msvcr80.dll. Certainly
in the C runtime sources included with MSVS8 and the Platform SDK "for
Windows Server 2003 R2" gmtime still uses thread-local storage.
--tml
-------------------------------------------------------------------------
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