]> granicus.if.org Git - libevent/commitdiff
Another tweak on the date patch: win32 has no gmtime_r, but its gmtime() function...
authorNick Mathewson <nickm@torproject.org>
Fri, 7 Sep 2007 01:18:53 +0000 (01:18 +0000)
committerNick Mathewson <nickm@torproject.org>
Fri, 7 Sep 2007 01:18:53 +0000 (01:18 +0000)
svn:r414

http.c

diff --git a/http.c b/http.c
index 25a040117da03879d992687febc156afc251e472..892e7159e22bdf4b6addf010461093ccb357bd0d 100644 (file)
--- a/http.c
+++ b/http.c
@@ -352,11 +352,16 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
                if (evhttp_find_header(req->output_headers,
                                                           "Date") == NULL) {
                        char date[50];
-                       struct tm cur;
+                       struct tm cur, *cur_p;
                        time_t t = time(NULL);
+#ifdef WIN32
+                       cur_p = gmtime(&t);
+#else
                        gmtime_r(&t, &cur);
+                        cur_p = &cur;
+#endif
                        if (strftime(date, sizeof(date),
-                                                "%a, %d %b %Y %H:%M:%S GMT", &cur) != 0) {
+                                                "%a, %d %b %Y %H:%M:%S GMT", cur_p) != 0) {
                                evhttp_add_header(req->output_headers, "Date", date);
                        }
                }