]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Fix incorrect timestamp in scrollback with server-time
authorbendem <redacted>
Mon, 2 Mar 2015 18:58:27 +0000 (19:58 +0100)
committerbendem <redacted>
Mon, 2 Mar 2015 18:58:27 +0000 (19:58 +0100)
Fixes #1148

src/common/text.c

index 00bc372949a3966adecc3c0df3cda6114440607c..11516ae269de216202cd53d2721612f945aa56b2 100644 (file)
@@ -207,10 +207,9 @@ scrollback_shrink (session *sess)
 }
 
 static void
-scrollback_save (session *sess, char *text)
+scrollback_save (session *sess, char *text, time_t stamp)
 {
        char *buf;
-       time_t stamp;
        int len;
 
        if (sess->type == SESS_SERVER && prefs.hex_gui_tab_server == 1)
@@ -238,7 +237,8 @@ scrollback_save (session *sess, char *text)
                        return;
        }
 
-       stamp = time (0);
+       if (!stamp)
+               stamp = time(0);
        if (sizeof (stamp) == 4)        /* gcc will optimize one of these out */
                buf = g_strdup_printf ("T %d ", (int) stamp);
        else
@@ -831,7 +831,7 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
        }
 
        log_write (sess, text, timestamp);
-       scrollback_save (sess, text);
+       scrollback_save (sess, text, timestamp);
        fe_print_text (sess, text, timestamp, FALSE);
        g_free (text);
 }