aboutsummaryrefslogtreecommitdiff
path: root/lib/gtls.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-02-07 15:00:48 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-02-07 15:00:48 +0100
commit54d9f060b4b0a8fb5fa006813e4db1ca5c1a07e8 (patch)
tree119331774fece19f0d5b727c1be50184b87298df /lib/gtls.c
parent2cacd82661b4a46ea52a23099ce0b23046a1f172 (diff)
Curl_gmtime: added a portable gmtime
Instead of polluting many places with #ifdefs, we create a single place for this function, and also check return code properly so that a NULL pointer returned won't cause problems.
Diffstat (limited to 'lib/gtls.c')
-rw-r--r--lib/gtls.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/gtls.c b/lib/gtls.c
index b5ef8fb99..89174edf2 100644
--- a/lib/gtls.c
+++ b/lib/gtls.c
@@ -170,13 +170,12 @@ static void showtime(struct SessionHandle *data,
const char *text,
time_t stamp)
{
- struct tm *tm;
-#ifdef HAVE_GMTIME_R
struct tm buffer;
- tm = (struct tm *)gmtime_r(&stamp, &buffer);
-#else
- tm = gmtime(&stamp);
-#endif
+ const struct tm *tm = &buffer;
+ CURLcode result = Curl_gmtime(stamp, &buffer);
+ if(result)
+ return;
+
snprintf(data->state.buffer,
BUFSIZE,
"\t %s: %s, %02d %s %4d %02d:%02d:%02d GMT\n",