* looking for devel@balabit.hu--other-1/syslog-ng--mainline--2.0--patch-97 to compare with
* comparing to devel@balabit.hu--other-1/syslog-ng--mainline--2.0--patch-97
M  src/logmsg.c
M  tests/unit/test_msgparse.c

* modified files

--- orig/src/logmsg.c
+++ mod/src/logmsg.c
@@ -51,7 +51,7 @@ static char repeat_msg_string[] = "last 
 void
 log_stamp_format(LogStamp *stamp, GString *target, gint ts_format, glong zone_offset, gint frac_digits)
 {
-  glong target_zone_offset = 0, ofs;
+  glong target_zone_offset = 0;
   struct tm *tm;
   char ts[128], buf[8];
   time_t t;
@@ -96,8 +96,7 @@ log_stamp_format(LogStamp *stamp, GStrin
                   frac_digits--;
                 }
             }
-          ofs = target_zone_offset < 0 ? -target_zone_offset : target_zone_offset;
-          format_zone_info(buf, sizeof(buf), ofs);
+          format_zone_info(buf, sizeof(buf), target_zone_offset);
           g_string_append(target, buf);
           break;
         case TS_FMT_FULL:
@@ -210,7 +209,7 @@ log_msg_parse(LogMessage *self, gchar *d
       stamp_length = (p - src);
       
       g_string_assign_len(self->date, src, stamp_length);
-      memset(&tm, 0, sizeof(tm));
+      tm = *localtime(&now);
       p = strptime(self->date->str, "%Y-%m-%dT%H:%M:%S", &tm);
       
       self->stamp.time.tv_usec = 0;
@@ -249,13 +248,13 @@ log_msg_parse(LogMessage *self, gchar *d
       /* NOTE: mktime() returns the time assuming that the timestamp we
        * received was in local time. This is not true, as there's a
        * zone_offset in the timestamp as well. We need to adjust this offset
-       * by substracting the local timezone offset at the specific time,
+       * by adding the local timezone offset at the specific time to get UTC,
        * which means that tv_sec becomes as if tm was in the 00:00 timezone. 
        * Also we have to take into account that at the zone barriers an hour
        * might be skipped or played twice this is what the 
        * (tm.tm_hour - * unnormalized_hour) part fixes up. */
       
-      self->stamp.time.tv_sec = self->stamp.time.tv_sec - get_local_timezone_ofs(self->stamp.time.tv_sec) + (tm.tm_hour - unnormalized_hour) * 3600 + self->stamp.zone_offset;
+      self->stamp.time.tv_sec = self->stamp.time.tv_sec + get_local_timezone_ofs(self->stamp.time.tv_sec) - (tm.tm_hour - unnormalized_hour) * 3600 - self->stamp.zone_offset;
       
       src += stamp_length;
       left -= stamp_length;


--- orig/tests/unit/test_msgparse.c
+++ mod/tests/unit/test_msgparse.c
@@ -90,19 +90,19 @@ main(int argc G_GNUC_UNUSED, char *argv[
            "openvpn[2499]: PTHREAD support initialized" // msg
            );
 
-  testcase("<7>2004-09-07T10:43:21.156+02:00 bzorp openvpn[2499]: PTHREAD support initialized", 0, NULL,
+  testcase("<7>2006-11-10T10:43:21.156+02:00 bzorp openvpn[2499]: PTHREAD support initialized", 0, NULL,
            7, 			// pri
-           1094546601, 156000, 7200,	// timestamp (sec/usec/zone)
-           "2004-09-07T10:43:21.156+02:00",   // originally formatted timestamp
+           1163148201, 156000, 7200,	// timestamp (sec/usec/zone)
+           "2006-11-10T10:43:21.156+02:00",   // originally formatted timestamp
            "bzorp",		// host
            "openvpn",		// openvpn
            "openvpn[2499]: PTHREAD support initialized" // msg
            );
 
-  testcase("<7>2004-09-07T10:43:21.156+01:00 bzorp openvpn[2499]: PTHREAD support initialized", 0, NULL,
+  testcase("<7>2006-11-10T10:43:21.156+01:00 bzorp openvpn[2499]: PTHREAD support initialized", 0, NULL,
            7, 			// pri
-           1094543001, 156000, 3600,	// timestamp (sec/usec/zone)
-           "2004-09-07T10:43:21.156+01:00",   // originally formatted timestamp
+           1163151801, 156000, 3600,	// timestamp (sec/usec/zone)
+           "2006-11-10T10:43:21.156+01:00",   // originally formatted timestamp
            "bzorp",		// host
            "openvpn",		// openvpn
            "openvpn[2499]: PTHREAD support initialized" // msg
@@ -161,7 +161,7 @@ main(int argc G_GNUC_UNUSED, char *argv[
   /* the same in a foreign timezone */
   testcase("<7>2006-10-29T01:00:00.156+01:00 bzorp openvpn[2499]: PTHREAD support initialized", 0, NULL,
            7, 			// pri
-           1162072800, 156000, 3600,	// timestamp (sec/usec/zone)
+           1162080000, 156000, 3600,	// timestamp (sec/usec/zone)
            NULL,                // originally formatted timestamp
            "bzorp",		// host
            "openvpn",		// openvpn
@@ -169,7 +169,7 @@ main(int argc G_GNUC_UNUSED, char *argv[
            );
   testcase("<7>2006-10-29T01:59:59.156+01:00 bzorp openvpn[2499]: PTHREAD support initialized", 0, NULL,
            7, 			// pri
-           1162076399, 156000, 3600,	// timestamp (sec/usec/zone)
+           1162083599, 156000, 3600,	// timestamp (sec/usec/zone)
            NULL,                // originally formatted timestamp
            "bzorp",		// host
            "openvpn",		// openvpn
@@ -177,7 +177,7 @@ main(int argc G_GNUC_UNUSED, char *argv[
            );
   testcase("<7>2006-10-29T02:00:00.156+01:00 bzorp openvpn[2499]: PTHREAD support initialized", 0, NULL,
            7, 			// pri
-           1162076400, 156000, 3600,	// timestamp (sec/usec/zone)
+           1162083600, 156000, 3600,	// timestamp (sec/usec/zone)
            NULL,                // originally formatted timestamp
            "bzorp",		// host
            "openvpn",		// openvpn
@@ -188,7 +188,7 @@ main(int argc G_GNUC_UNUSED, char *argv[
 
   testcase("<7>2006-10-29T02:00:00.156+01:00 %bzorp openvpn[2499]: PTHREAD support initialized", LP_CHECK_HOSTNAME, NULL,
            7, 			// pri
-           1162076400, 156000, 3600,	// timestamp (sec/usec/zone)
+           1162083600, 156000, 3600,	// timestamp (sec/usec/zone)
            NULL,                // originally formatted timestamp
            "",		// host
            "%bzorp openvpn",		// openvpn
@@ -197,7 +197,7 @@ main(int argc G_GNUC_UNUSED, char *argv[
 
   testcase("<7>2006-10-29T02:00:00.156+01:00 ctld snmpd[2499]: PTHREAD support initialized", 0, "^ctld",
            7, 			// pri
-           1162076400, 156000, 3600,	// timestamp (sec/usec/zone)
+           1162083600, 156000, 3600,	// timestamp (sec/usec/zone)
            NULL,                // originally formatted timestamp
            "",		// host
            "ctld snmpd",		// openvpn



Diffing against syslog-ng--mainline--2.0
TLA version: '1.3.3-2'
Running command 'tla changes --diffs -d /home/bazsi/zwa/tla/devel@balabit.hu--other-1/syslog-ng--mainline--2.0 devel@balabit.hu--other-1/syslog-ng--mainline--2.0', cwd=''
