sources/interface.cpp

changeset 51
481073b016a9
parent 50
874bbfa55da8
child 52
ae5b486f6882
--- a/sources/interface.cpp	Tue Dec 16 00:05:27 2014 +0200
+++ b/sources/interface.cpp	Tue Dec 16 00:15:44 2014 +0200
@@ -29,6 +29,7 @@
 */
 
 #include <string.h>
+#include <time.h>
 #include "interface.h"
 #include "network/rconsession.h"
 #include "network/ipaddress.h"
@@ -916,6 +917,17 @@
 			continue;
 		}
 
+		if (g_output[g_output.size() - 1].length() == 0)
+		{
+			time_t now;
+			time (&now);
+			char timestamp[32];
+			strftime (timestamp, sizeof timestamp, "[%H:%M:%S] ", localtime (&now));
+
+			for (char* cp = timestamp; *cp != '\0'; ++cp)
+				g_output[g_output.size() - 1].add_char (*cp);
+		}
+
 		g_output[g_output.size() - 1].add_char (ch);
 	}
 

mercurial