BUG/MINOR: log: GMT offset not updated when entering/leaving DST

GMT offset used in local time formats was computed at startup, but was not updated when DST status changed while running.

For example these two RFC5424 syslog traces where emitted 5 seconds apart, just before and after DST changed:
  <14>1 2016-03-27T01:59:58+01:00 bunch-VirtualBox haproxy 2098 - - Connect ...
  <14>1 2016-03-27T03:00:03+01:00 bunch-VirtualBox haproxy 2098 - - Connect ...

It looked like they were emitted more than 1 hour apart, unlike with the fix:
  <14>1 2016-03-27T01:59:58+01:00 bunch-VirtualBox haproxy 3381 - - Connect ...
  <14>1 2016-03-27T03:00:03+02:00 bunch-VirtualBox haproxy 3381 - - Connect ...

This patch should be backported to 1.6 and partially to 1.5 (no fix needed in log.c).
diff --git a/src/standard.c b/src/standard.c
index 40727b0..e08795f 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -2552,6 +2552,35 @@
 	return dst;
 }
 
+/* Return the GMT offset for a specific local time.
+ * The string returned has the same format as returned by strftime(... "%z", tm).
+ * Offsets are kept in an internal cache for better performances.
+ */
+const char *get_gmt_offset(struct tm *tm)
+{
+	/* Cache offsets from GMT (depending on whether DST is active or not) */
+	static char gmt_offsets[2][5+1] = { "", "" };
+
+    int old_isdst = tm->tm_isdst;
+	char *gmt_offset;
+
+    /* Pretend DST not active if its status is unknown, or strftime() will return an empty string for "%z" */
+    if (tm->tm_isdst < 0) {
+        tm->tm_isdst = 0;
+    }
+
+    /* Fetch the offset and initialize it if needed */
+    gmt_offset = gmt_offsets[tm->tm_isdst & 0x01];
+    if (unlikely(!*gmt_offset)) {
+        strftime(gmt_offset, 5+1, "%z", tm);
+    }
+
+    /* Restore previous DST flag */
+    tm->tm_isdst = old_isdst;
+
+    return gmt_offset;
+}
+
 /* gmt2str_log: write a date in the format :
  * "%02d/%s/%04d:%02d:%02d:%02d +0000" without using snprintf
  * return a pointer to the last char written (\0) or
@@ -2592,9 +2621,12 @@
  */
 char *localdate2str_log(char *dst, struct tm *tm, size_t size)
 {
+	const char *gmt_offset;
 	if (size < 27) /* the size is fixed: 26 chars + \0 */
 		return NULL;
 
+	gmt_offset = get_gmt_offset(tm);
+
 	dst = utoa_pad((unsigned int)tm->tm_mday, dst, 3); // day
 	*dst++ = '/';
 	memcpy(dst, monthname[tm->tm_mon], 3); // month
@@ -2608,7 +2640,7 @@
 	*dst++ = ':';
 	dst = utoa_pad((unsigned int)tm->tm_sec, dst, 3); // secondes
 	*dst++ = ' ';
-	memcpy(dst, localtimezone, 5); // timezone
+	memcpy(dst, gmt_offset, 5); // Offset from local time to GMT
 	dst += 5;
 	*dst = '\0';