[BUG] fix calls to localtime()

localtime() was called with pointers to tv_sec, which is time_t on
some platforms and long on others. A problem was encountered on
Sparc64 under OpenBSD where tv_sec is long (64 bits) and time_t is
32 bits. Since this architecture is big-endian, it exhibited the
bug because localtime() always worked with the high part of the
value which is always zero. This problem was identified and debugged
by Thierry Fournier.

The correct solution is to pass the date by value and not by pointer,
through an intermediate function. The use of localtime_r() instead of
localtime() also made it possible to get rid of the first call to
localtime() since it does not need to allocate memory anymore.
diff --git a/src/proto_http.c b/src/proto_http.c
index f9b51d8..f4ffae7 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -709,7 +709,7 @@
 	int tolog;
 	char *uri, *h;
 	char *svid;
-	struct tm *tm;
+	struct tm tm;
 	static char tmpline[MAX_SYSLOG_LEN];
 	int hdr;
 
@@ -726,8 +726,7 @@
 			  (const void *)&((struct sockaddr_in6 *)(&s->cli_addr))->sin6_addr,
 			  pn, sizeof(pn));
 
-	tm = localtime((time_t *)&s->logs.tv_accept.tv_sec);
-
+	get_localtime(s->logs.tv_accept.tv_sec, &tm);
 
 	/* FIXME: let's limit ourselves to frontend logging for now. */
 	tolog = fe->to_log;
@@ -785,8 +784,8 @@
 		 (s->cli_addr.ss_family == AF_INET) ?
 		 ntohs(((struct sockaddr_in *)&s->cli_addr)->sin_port) :
 		 ntohs(((struct sockaddr_in6 *)&s->cli_addr)->sin6_port),
-		 tm->tm_mday, monthname[tm->tm_mon], tm->tm_year+1900,
-		 tm->tm_hour, tm->tm_min, tm->tm_sec, s->logs.tv_accept.tv_usec/1000,
+		 tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900,
+		 tm.tm_hour, tm.tm_min, tm.tm_sec, s->logs.tv_accept.tv_usec/1000,
 		 fe->id, be->id, svid,
 		 s->logs.t_request,
 		 (s->logs.t_queue >= 0) ? s->logs.t_queue - s->logs.t_request : -1,