curl-library
Re: time_t size question on Windows
Date: Fri, 7 Mar 2008 03:35:57 +0100
2008/3/7, sherman wilcox wrote:
> I have a question related to the size of time_t when using Microsoft
> compilers and libraries. With Visual Studio 2005 and above time_t is a
> 64bit quantity. There's a pre-processor that can be added
> (_USE_32BIT_TIME_T) to make time_t become a 32bit quantity if needed.
> It appears that libcurl defaults to using the 64bit time_t sizes. I
> examined the config header for Windows as well as the libcurl .vcproj
> file and saw no mention of _USE_32BIT_TIME_T.
>
> I assume libcurl (by default) is using a 64bit time_t. Correct?
Yes libcurl will use whatever size time_t msvc handles to it
_at_compile_ time_ so for VS2005 and later that will be a 64-bit
time_t unless you have compiled libcurl with _USE_32BIT_TIME_T
defined.
In any case something like the following should go into config_win32.h...
/* VS2005 and later dafault size for time_t is 64-bit, unless */
/* _USE_32BIT_TIME_T has been defined to use a 32-bit time_t. */
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
# ifndef _USE_32BIT_TIME_T
# define SIZEOF_TIME_T 8
# else
# define SIZEOF_TIME_T 4
# endif
#endif
I would suggest you, that you add the above to config_win32.h and
experiment with function curl_getdate() and verify if it behaves
properly. The rest of the library should not be affected.
-- -=[Yang]=-Received on 2008-03-07