summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorRiamse <andrewwang43@gmail.com>2014-05-06 17:10:34 -0700
committerTingPing <tingping@tingping.se>2014-05-11 05:02:19 -0400
commit6ef41f7d4f1cc5b96c645a463499dc7ea0c768f7 (patch)
tree3f73c763bfc6a3f4fc71176d2b79b8412efc8395 /src
parentfea144dd19be5a8af2ddb94c8eda1e323d3cb69c (diff)
Fix logging incorrect timestamp with server-time
Fixes #972
Diffstat (limited to 'src')
-rw-r--r--src/common/text.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/text.c b/src/common/text.c
index efd8fba2..0e66c2d2 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -690,7 +690,7 @@ get_stamp_str (char *fmt, time_t tim, char **ret)
 }
 
 static void
-log_write (session *sess, char *text)
+log_write (session *sess, char *text, time_t ts)
 {
 	char *temp;
 	char *stamp;
@@ -727,7 +727,8 @@ log_write (session *sess, char *text)
 
 	if (prefs.hex_stamp_log)
 	{
-		len = get_stamp_str (prefs.hex_stamp_log_format, time (0), &stamp);
+		if (!ts) ts = time(0);
+		len = get_stamp_str (prefs.hex_stamp_log_format, ts, &stamp);
 		if (len)
 		{
 			write (sess->logfd, stamp, len);
@@ -911,7 +912,7 @@ PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
 		conv = text_validate ((char **)&text, &len);
 	}
 
-	log_write (sess, text);
+	log_write (sess, text, timestamp);
 	scrollback_save (sess, text);
 	fe_print_text (sess, text, timestamp, FALSE);