mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Andreas Damm made getdate use gmtime_r if available
This commit is contained in:
parent
cc2f1d4894
commit
0d5bfe883e
@ -2102,7 +2102,14 @@ curl_getdate (const char *p, const time_t *now)
|
|||||||
if (cookie.yyHaveZone)
|
if (cookie.yyHaveZone)
|
||||||
{
|
{
|
||||||
long delta;
|
long delta;
|
||||||
struct tm *gmt = gmtime (&Start);
|
struct tm *gmt;
|
||||||
|
#ifdef HAVE_GMTIME_R
|
||||||
|
/* thread-safe version */
|
||||||
|
struct tm keeptime;
|
||||||
|
gmt = (struct tm *)gmtime_r(&Start, &keeptime);
|
||||||
|
#else
|
||||||
|
gmt = gmtime(&Start);
|
||||||
|
#endif
|
||||||
if (!gmt)
|
if (!gmt)
|
||||||
return -1;
|
return -1;
|
||||||
delta = cookie.yyTimezone * 60L + difftm (&tm, gmt);
|
delta = cookie.yyTimezone * 60L + difftm (&tm, gmt);
|
||||||
|
@ -211,7 +211,7 @@ typedef struct _CONTEXT {
|
|||||||
%expect 13
|
%expect 13
|
||||||
|
|
||||||
/* turn global variables into locals, additionally enable extra arguments
|
/* turn global variables into locals, additionally enable extra arguments
|
||||||
** for yylex (pointer to yylval and use defined value)
|
** for yylex (pointer to yylval and user defined value)
|
||||||
*/
|
*/
|
||||||
%pure_parser
|
%pure_parser
|
||||||
|
|
||||||
@ -1058,7 +1058,14 @@ curl_getdate (const char *p, const time_t *now)
|
|||||||
if (cookie.yyHaveZone)
|
if (cookie.yyHaveZone)
|
||||||
{
|
{
|
||||||
long delta;
|
long delta;
|
||||||
struct tm *gmt = gmtime (&Start);
|
struct tm *gmt;
|
||||||
|
#ifdef HAVE_GMTIME_R
|
||||||
|
/* thread-safe version */
|
||||||
|
struct tm keeptime;
|
||||||
|
gmt = (struct tm *)gmtime_r(&Start, &keeptime);
|
||||||
|
#else
|
||||||
|
gmt = gmtime(&Start);
|
||||||
|
#endif
|
||||||
if (!gmt)
|
if (!gmt)
|
||||||
return -1;
|
return -1;
|
||||||
delta = cookie.yyTimezone * 60L + difftm (&tm, gmt);
|
delta = cookie.yyTimezone * 60L + difftm (&tm, gmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user