From 1c39128d974666107fc6d9ea15f294036851f224 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 18 Jan 2018 20:24:05 +0100 Subject: parsedate: fix date parsing for systems with 32 bit long Make curl_getdate() handle dates before 1970 as well (returning negative values). Make test 517 test dates for 64 bit time_t. This fixes bug (3) mentioned in #2238 Closes #2250 --- lib/curl_setup.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/curl_setup.h') diff --git a/lib/curl_setup.h b/lib/curl_setup.h index e5a657934..100b8d40f 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -424,6 +424,24 @@ #endif #define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1)) +#if (SIZEOF_TIME_T == 4) +# ifdef HAVE_TIME_T_UNSIGNED +# define TIME_T_MAX UINT_MAX +# define TIME_T_MIN 0 +# else +# define TIME_T_MAX INT_MAX +# define TIME_T_MIN INT_MIN +# endif +#else +# ifdef HAVE_TIME_T_UNSIGNED +# define TIME_T_MAX 0xFFFFFFFFFFFFFFFF +# define TIME_T_MIN 0 +# else +# define TIME_T_MAX 0x7FFFFFFFFFFFFFFF +# define TIME_T_MIN -0x10000000000000000 +# endif +#endif + /* * Arg 2 type for gethostname in case it hasn't been defined in config file. */ -- cgit v1.2.3